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

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


        share(d);
    }

    void referenceOuter(TypeDeclaration d) {
        if (!d.isToplevel()) {
            final ClassOrInterface coi = Util.getContainingClassOrInterface(d.getContainer());
            if (coi != null) {
                out(names.self(d), ".outer$");
                if (d.isClassOrInterfaceMember()) {
                    out("=this");
                } else {
View Full Code Here


                for (com.redhat.ceylon.compiler.typechecker.model.Parameter p : plist) {
                    generateAttributeForParameter(node, (com.redhat.ceylon.compiler.typechecker.model.Class)d, p);
                }
            }
            if (d.isMember()) {
                ClassOrInterface coi = Util.getContainingClassOrInterface(d.getContainer());
                if (coi != null && d.inherits(coi)) {
                    out(names.self(d), ".", names.name(d),"=", names.name(d), ";");
                }
            }
            endBlock();
View Full Code Here

    private ClassOrInterface prototypeOwner;

    private void addToPrototype(ClassOrInterface d, final Tree.Statement s,
            List<com.redhat.ceylon.compiler.typechecker.model.Parameter> params) {
        ClassOrInterface oldPrototypeOwner = prototypeOwner;
        prototypeOwner = d;
        if (s instanceof MethodDefinition) {
            addMethodToPrototype(d, (MethodDefinition)s);
        } else if (s instanceof MethodDeclaration) {
            //Don't even bother with nodes that have errors
View Full Code Here

            final boolean isCallable = !forInvoke && decl instanceof Method
                    && bme.getUnit().getCallableDeclaration().equals(bme.getTypeModel().getDeclaration());
            String who = isCallable && decl.isMember() ? gen.getMember(bme, decl, null) : null;
            if (who == null || who.isEmpty()) {
                //We may not need to wrap this in certain cases
                ClassOrInterface cont = Util.getContainingClassOrInterface(bme.getScope());
                who=cont == null ? "0" : gen.getNames().self(cont);
            }
            final boolean hasTparms = hasTypeParameters(bme);
            if (isCallable && (who != null || hasTparms)) {
                if (hasTparms) {
View Full Code Here

    /** Generates a function to initialize the specified type. */
    static void initializeType(final Tree.Declaration type, final GenerateJsVisitor gen) {
        Tree.ExtendedType extendedType = null;
        Tree.SatisfiedTypes satisfiedTypes = null;
        final ClassOrInterface decl;
        final List<Tree.Statement> stmts;
        if (type instanceof Tree.ClassDefinition) {
            Tree.ClassDefinition classDef = (Tree.ClassDefinition) type;
            extendedType = classDef.getExtendedType();
            satisfiedTypes = classDef.getSatisfiedTypes();
View Full Code Here

                gen.out(modAlias, ".");
            }
            if (t.getContainer() instanceof ClassOrInterface) {
                final Scope scope = node == null ? null : Util.getContainingClassOrInterface(node.getScope());
                List<ClassOrInterface> parents = new ArrayList<>();
                ClassOrInterface parent = (ClassOrInterface)t.getContainer();
                parents.add(0, parent);
                while (parent.getContainer() instanceof ClassOrInterface) {
                    parent = (ClassOrInterface)parent.getContainer();
                    parents.add(0, parent);
                }
                for (ClassOrInterface p : parents) {
                    if (p==scope) {
                        if (gen.opts.isOptimize()) {
View Full Code Here

            parent = parent.getScope();
        }
        if (tp.getContainer() instanceof ClassOrInterface) {
            if (parent == tp.getContainer()) {
                if (!skipSelfDecl) {
                    ClassOrInterface ontoy = Util.getContainingClassOrInterface(node.getScope());
                    while (ontoy.isAnonymous())ontoy=Util.getContainingClassOrInterface(ontoy.getScope());
                    gen.out(gen.getNames().self((TypeDeclaration)ontoy));
                    for (int i = 0; i < outers; i++) {
                        gen.out(".outer$");
                    }
                    gen.out(".");
View Full Code Here

    }

    @Test
    public void tmptest() {
        System.out.println("-----------------------");
        ClassOrInterface d0 = (ClassOrInterface)srclang.getDirectMember("Iterable", null, false);
        Assert.assertNotNull("ContainerWithFirstElement from srclang", d0);
        ClassOrInterface d1 = (ClassOrInterface)jslang.getDirectMember("Iterable", null, false);
        Assert.assertNotNull("ContainerWithFirstElement from jslang", d1);
        ProducedType seq0 = null, seq1 = null;
        for (ProducedType pt : d0.getSatisfiedTypes()) {
            System.out.println(d0 + " satisfies " + pt);
            if (pt.getProducedTypeName().startsWith("Null[]")) {
                seq0 = pt;
                break;
            }
        }
        for (ProducedType pt : d1.getSatisfiedTypes()) {
            if (pt.getProducedTypeName().startsWith("Null[]")) {
                seq1 = pt;
                break;
            }
        }
        compareTypes(seq0, seq1, new ArrayList<String>());
        System.out.println("src " + seq0 + " - js " + seq1);
        compareTypeDeclarations(d0, d1);
        MethodOrValue m0 = (MethodOrValue)d0.getDirectMember("last", null, false);
        MethodOrValue m1 = (MethodOrValue)d1.getDirectMember("last", null, false);
        System.out.println("Iterable.last " + m0 + " vs " + m1);
        System.out.println("refined member " + d0.getRefinedMember("last", null, false).getContainer() + " vs " + d1.getRefinedMember("last", null, false).getContainer());
        System.out.println("last is transient? " + m0.isTransient() + " vs " + m1.isTransient());
        System.out.println("refined " + m0.getRefinedDeclaration().getContainer() + " vs " + m1.getRefinedDeclaration().getContainer());
    }
View Full Code Here

                orderedTypes, anonymousClass);
    }

    @Override
    public void visit(Tree.ClassOrInterface that) {
        ClassOrInterface classOrInterface = that.getDeclarationModel();
        validateMemberRefinement(that, classOrInterface);
        super.visit(that);
        if (!classOrInterface.isAlias()) {
            boolean concrete =
                    !classOrInterface.isAbstract() &&
                    !classOrInterface.isFormal();
            List<Type> orderedTypes =
                    sortDAGAndBuildMetadata(classOrInterface, that);
            if (concrete) {
                checkForFormalsNotImplemented(that,
                        orderedTypes, (Class) classOrInterface);
View Full Code Here

            checkForShortcutRefinement(that, dec);
        }
    }

    private static void checkForShortcutRefinement(Node that, Declaration dec) {
        ClassOrInterface classOrInterface =
                (ClassOrInterface) dec.getContainer();
        for (Declaration im:
                classOrInterface.getInheritedMembers(dec.getName())) {
            if (im instanceof MethodOrValue &&
                    ((MethodOrValue) im).isShortcutRefinement()) {
                that.addError("refines a non-formal, non-default member: " +
                        message(im));
            }
View Full Code Here

TOP

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

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.