Search in sources :

Example 81 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.Parameter that) {
    Declaration preva = assigning;
    assigning = that.getParameterModel().getModel();
    super.visit(that);
    assigning = preva;
}
Also used : Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 82 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.AnyAttribute that) {
    Declaration preva = assigning;
    assigning = that.getDeclarationModel();
    super.visit(that);
    assigning = preva;
}
Also used : Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 83 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.SpecifierStatement that) {
    Declaration d = that.getDeclaration();
    if (d == null) {
        if (that.getBaseMemberExpression() instanceof Tree.MemberOrTypeExpression) {
            d = ((Tree.MemberOrTypeExpression) that.getBaseMemberExpression()).getDeclaration();
        }
    }
    Declaration preva = assigning;
    assigning = d;
    super.visit(that);
    assigning = preva;
/*
        Declaration d = that.getDeclaration();
        if (Decl.isSmall(d)) {
            Tree.Term term = that.getSpecifierExpression().getExpression().getTerm();
            checkSmallAssignment(d, term);
        }*/
}
Also used : Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 84 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class SmallVisitor method visit.

@Override
public void visit(Tree.PositionalArgument that) {
    Declaration d;
    if (that.getParameter() != null) {
        d = that.getParameter().getModel();
    } else {
        d = null;
    }
    Declaration preva = assigning;
    assigning = d;
    super.visit(that);
    assigning = preva;
}
Also used : Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 85 with Declaration

use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.

the class JsonPackage method loadMethod.

@SuppressWarnings("unchecked")
Function loadMethod(String name, Map<String, Object> m, Scope parent, final List<TypeParameter> existing) {
    Function md = new Function();
    md.setName(name);
    m.remove(KEY_NAME);
    md.setContainer(parent);
    md.setScope(parent);
    setAnnotations(md, (Integer) m.remove(KEY_PACKED_ANNS), m.remove(KEY_ANNOTATIONS));
    md.setUnit(u2);
    if (parent == this) {
        // Top-level declarations are directly added to the unit
        u2.addDeclaration(md);
        addMember(null);
    }
    if (m.containsKey(KEY_FLAGS)) {
        int flags = (int) m.remove(KEY_FLAGS);
        md.setDeclaredVoid((flags & 1) > 0);
        md.setDeferred((flags & 2) > 0);
    }
    md.setDynamic(m.remove(KEY_DYNAMIC) != null);
    final List<TypeParameter> tparms = parseTypeParameters((List<Map<String, Object>>) m.get(KEY_TYPE_PARAMS), md, existing);
    final List<TypeParameter> allparms = JsonPackage.merge(tparms, existing);
    md.setType(getTypeFromJson((Map<String, Object>) m.remove(KEY_TYPE), parent instanceof Declaration ? (Declaration) parent : null, allparms));
    List<List<Map<String, Object>>> paramLists = (List<List<Map<String, Object>>>) m.remove(KEY_PARAMS);
    if (paramLists == null) {
        md.addParameterList(new ParameterList());
    } else {
        boolean first = true;
        for (List<Map<String, Object>> plist : paramLists) {
            ParameterList _params = parseParameters(plist, md, allparms);
            _params.setNamedParametersSupported(first);
            first = false;
            md.addParameterList(_params);
            for (Parameter p : _params.getParameters()) {
                md.addMember(p.getModel());
            }
        }
    }
    return md;
}
Also used : TypeParameter(org.eclipse.ceylon.model.typechecker.model.TypeParameter) Function(org.eclipse.ceylon.model.typechecker.model.Function) ParameterList(org.eclipse.ceylon.model.typechecker.model.ParameterList) Parameter(org.eclipse.ceylon.model.typechecker.model.Parameter) TypeParameter(org.eclipse.ceylon.model.typechecker.model.TypeParameter) List(java.util.List) ParameterList(org.eclipse.ceylon.model.typechecker.model.ParameterList) ArrayList(java.util.ArrayList) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)370 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)309 TypedDeclaration (org.eclipse.ceylon.model.typechecker.model.TypedDeclaration)264 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)129 Type (org.eclipse.ceylon.model.typechecker.model.Type)100 Class (org.eclipse.ceylon.model.typechecker.model.Class)78 TypeParameter (org.eclipse.ceylon.model.typechecker.model.TypeParameter)74 Value (org.eclipse.ceylon.model.typechecker.model.Value)73 ClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ClassOrInterface)72 Function (org.eclipse.ceylon.model.typechecker.model.Function)71 FunctionOrValue (org.eclipse.ceylon.model.typechecker.model.FunctionOrValue)71 AnalyzerUtil.getTypedDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypedDeclaration)63 ArrayList (java.util.ArrayList)61 AnalyzerUtil.getPackageTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getPackageTypeDeclaration)60 AnalyzerUtil.getTypeDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getTypeDeclaration)60 ModelUtil.getNativeDeclaration (org.eclipse.ceylon.model.typechecker.model.ModelUtil.getNativeDeclaration)57 AnalyzerUtil.getPackageTypedDeclaration (org.eclipse.ceylon.compiler.typechecker.analyzer.AnalyzerUtil.getPackageTypedDeclaration)51 Scope (org.eclipse.ceylon.model.typechecker.model.Scope)50 Constructor (org.eclipse.ceylon.model.typechecker.model.Constructor)48 CustomTree (org.eclipse.ceylon.compiler.typechecker.tree.CustomTree)45