/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * File:   kludges.cpp
 * Author: pgess <v.melnychenko@xreate.org>
 *
 * Created on 25/04/2020
 */

#include "aux/kludges.h"
#include "aux/expressions.h"

namespace xreate { namespace kludges{
std::list <Expression>
getAnnotations(const Expression &e) {
  if (e.tags.size()){
    return xreate::getAnnotations(e);
  }

  if (e.__state == Expression::IDENT){
    Symbol s = Attachments::get<IdentifierSymbol>(e);
    Expression e2 = CodeScope::getDefinition(s, true);
    return kludges::getAnnotations(e2);
  }

  return {};
}
}} // end of xreate::kludges



