Package com.redhat.ceylon.compiler.typechecker.model

Examples of com.redhat.ceylon.compiler.typechecker.model.Scope


                        getter.setSetter(setter);
                    }
                }
            }
            else {
                Scope s = model.getContainer();
                boolean isControl;
                do {
                    Declaration member =
                            s.getDirectMember(model.getName(), null, false);
                    if (member!=null) {
                        Unit unit = model.getUnit();
                        if (member instanceof Method &&
                            model instanceof Method &&
                            s instanceof ClassOrInterface) {
                            Method abstraction;
                            if (!((Method) member).isAbstraction()) {
                                abstraction = new Method();
                                abstraction.setAbstraction(true);
                                abstraction.setType(new UnknownType(unit).getType());
                                abstraction.setName(model.getName());
                                abstraction.setShared(true);
                                abstraction.setActual(true);
                                abstraction.setContainer(s);
                                abstraction.setScope(s);
                                abstraction.setUnit(unit);
                                ((Method) member).setOverloaded(true);
                                abstraction.setOverloads(new ArrayList<Declaration>());
                                abstraction.getOverloads().add(member);
                                s.getMembers().add(abstraction);
                            }
                            else {
                                abstraction = (Method) member;
                            }
                            ((Method) model).setOverloaded(true);
                            abstraction.getOverloads().add(model);
                        }
                        else {
                            that.addError("duplicate declaration name: '" +
                                    model.getName() + "'");
                        }
                        unit.getDuplicateDeclarations().add(member);
                    }
                    isControl = s instanceof ControlBlock;
                    s = s.getContainer();
                }
                while (isControl);
            }
        }
    }
View Full Code Here


     */
    private Scope getContainer(Node that) {
        if (that instanceof Tree.Declaration &&
                !(that instanceof Tree.Parameter) &&
                !(that instanceof Tree.Variable)) {
            Scope s = scope;
            while (s instanceof ConditionScope) {
                s = s.getScope();
            }
            return s;
        }
        else {
            return scope;
View Full Code Here

    public void visit(Tree.ImportMemberOrTypeList that) {
        ImportList il = new ImportList();
        unit.getImportLists().add(il);
        that.setImportList(il);
        il.setContainer(scope);
        Scope o = enterScope(il);
        super.visit(that);
        exitScope(o);
    }
View Full Code Here

   
    @Override
    public void visit(Tree.AnyClass that) {
        Class c = that.getDeclarationModel();
        visitDeclaration(that, c);
        Scope o = enterScope(c);
        super.visit(that);
        exitScope(o);
        if (that.getParameterList()==null) {
            that.addError("missing parameter list in class declaration: '" +
                    name(that.getIdentifier()) + "' must have a parameter list", 1000);
View Full Code Here

    @Override
    public void visit(Tree.AnyInterface that) {
        Interface i = that.getDeclarationModel();
        that.setDeclarationModel(i);
        visitDeclaration(that, i);
        Scope o = enterScope(i);
        super.visit(that);
        exitScope(o);
        /*if (!i.isToplevel()) {
            that.addWarning("inner interfaces are not yet supported");
        }*/
 
View Full Code Here

    @Override
    public void visit(Tree.TypeAliasDeclaration that) {
        TypeAlias a = new TypeAlias();
        that.setDeclarationModel(a);
        visitDeclaration(that, a);
        Scope o = enterScope(a);
        super.visit(that);
        exitScope(o);
    }
View Full Code Here

    @Override
    public void visit(Tree.AnyMethod that) {
        Method m = new Method();
        that.setDeclarationModel(m);
        visitDeclaration(that, m);
        Scope o = enterScope(m);
        super.visit(that);
        exitScope(o);
        setParameterLists(m, that.getParameterLists(), that);
        Tree.Type type = that.getType();
        m.setDeclaredVoid(type instanceof Tree.VoidModifier);
View Full Code Here

    @Override
    public void visit(Tree.MethodArgument that) {
        Method m = new Method();
        that.setDeclarationModel(m);
        visitArgument(that, m);
        Scope o = enterScope(m);
        super.visit(that);
        exitScope(o);
        setParameterLists(m, that.getParameterLists(), that);
        m.setDeclaredVoid(that.getType() instanceof Tree.VoidModifier);
    }
View Full Code Here

        Method m = new Method();
        m.setName("anonymous#"+fid++);
        m.setAnonymous(true);
        that.setDeclarationModel(m);
        visitArgument(that, m);
        Scope o = enterScope(m);
        Declaration d = beginDeclaration(that.getDeclarationModel());
        super.visit(that);
        endDeclaration(d);
        exitScope(o);
        setParameterLists(m, that.getParameterLists(), that);
View Full Code Here

        Value v = new Value();
        that.setDeclarationModel(v);
        visitDeclaration(that, v);
        that.getType().setTypeModel(c.getType());
        v.setType(c.getType());
        Scope o = enterScope(c);
        super.visit(that);
        exitScope(o);
        if (c.isInterfaceMember()) {
            that.addError("object declaration may not occur directly in interface body");
        }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.model.Scope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.