Package org.apache.flex.compiler.internal.definitions

Examples of org.apache.flex.compiler.internal.definitions.InterfaceDefinition$InterfaceIterator


        }

        final TypeDefinitionBase typeDefinition;
        if (isInterface)
        {
            final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(typeName);

            final IReference[] extendedInterfaces = getReferences(iinfo.interfaceNames);
            interfaceDefinition.setExtendedInterfaceReferences(extendedInterfaces);

            setupCastFunction(iinfo, interfaceDefinition);

            typeDefinition = interfaceDefinition;
        }
View Full Code Here


            }

        }
        else if (currentDefinition instanceof InterfaceDefinition)
        {
            InterfaceDefinition interfaceDefinition = (InterfaceDefinition)currentDefinition;
            result.add(interfaceDefinition.getInterfaceNamespaceReference());
        }
        else if (currentDefinition instanceof AppliedVectorDefinition)
        {
            compilerProject.addGlobalUsedNamespacesToNamespaceSet(result);
            for (IClassDefinition classDef : ((AppliedVectorDefinition)currentDefinition).classIterable(compilerProject, true))
View Full Code Here

    @Override
    protected void analyze(EnumSet<PostProcessStep> set, ASScope scope, Collection<ICompilerProblem> problems)
    {
        if (set.contains(PostProcessStep.POPULATE_SCOPE))
        {
            InterfaceDefinition definition = buildDefinition();
            setDefinition(definition);
            scope.addDefinition(definition);

            TypeScope typeScope = new TypeScope(scope, contentsNode, definition);
            definition.setContainedScope(typeScope);
            scope = typeScope;

            setupCastFunction(set, definition, scope);
        }
       
View Full Code Here

    }

    InterfaceDefinition buildDefinition()
    {
        String definitionName = nameNode.computeSimpleReference();
        InterfaceDefinition definition = new InterfaceDefinition(definitionName);
        definition.setNode(this);

        fillInNamespaceAndModifiers(definition);
        fillInMetadata(definition);

        // Set the interfaces that this interface extends.
        if (baseInterfacesNode != null)
        {
            int n = baseInterfacesNode.getChildCount();
            IReference[] baseInterfaces = new IReference[n];
            for (int i = 0; i < n; i++)
            {
                IASNode child = baseInterfacesNode.getChild(i);
                if (child instanceof ExpressionNodeBase)
                    baseInterfaces[i] = ((ExpressionNodeBase)child).computeTypeReference();
            }
            definition.setExtendedInterfaceReferences(baseInterfaces);
        }

        return definition;
    }
View Full Code Here

        // Set the interface Names.
        int n_interfaces = interfaces.length;
        ArrayList<Name> interface_names = new ArrayList<Name>(n_interfaces);
        for (int i = 0; i < n_interfaces; i++)
        {
            InterfaceDefinition idef = (InterfaceDefinition)interfaces[i];
            if (idef != null)
            {
                Name interfaceName = ((InterfaceDefinition)interfaces[i]).getMName(project);
                interface_names.add(interfaceName);
            }
View Full Code Here

        this.emitter = emitter;
       
        this.interfaceScope = enclosing_scope.pushFrame();

        //  Create the class level structures.
        InterfaceDefinition interfDef = interfaceNode.getDefinition();
        this.interfaceName = interfDef.getMName(interfaceScope.getProject());
       
        iinfo.name = this.interfaceName;
       
        //  Check for a duplicate interface name.
        switch ( SemanticUtils.getMultiDefinitionType(interfaceNode.getDefinition(), interfaceScope.getProject()))
        {
            case AMBIGUOUS:
                this.interfaceScope.addProblem(new DuplicateInterfaceDefinitionProblem(in, this.interfaceName.getBaseName()));
                break;
            case NONE:
                break;
            default:
                assert false;       // I don't think interfaces can have other type of multiple definitions
        }
       
        if (this.interfaceName != null)
        {
            SemanticUtils.checkScopedToDefaultNamespaceProblem(this.interfaceScope, in, interfDef, this.interfaceName.getBaseName());
        }
       
        // Check for circular definition by iterating over all parent interfaces.   
        Iterator<IInterfaceDefinition> ifaces = interfDef.interfaceIterator(interfaceScope.getProject(), false, interfaceScope.getProblems());
        while (ifaces.hasNext()) {
            ifaces.next();
         
        }
        // check that args are valid
      //  checkArguments(interfDef, interfaceScope.getProject(), interfaceScope.getProblems());

        //  Interfaces can't have a superclass.
        iinfo.superName = null;

        //  Add implmented interfaces.
        IExpressionNode[] raw_interfaces = this.interfaceNode.getExtendedInterfaceNodes();
        iinfo.interfaceNames = new Name[raw_interfaces.length];

        for ( int i = 0; i < raw_interfaces.length; i++)
        {
            IExpressionNode extendedInterface = raw_interfaces[i];
            IDefinition extendedDefinition = extendedInterface.resolve(interfaceScope.getProject());
           
            if ( extendedDefinition instanceof IInterfaceDefinition )
            {
                Name interfaceName = ((DefinitionBase)extendedDefinition).getMName(interfaceScope.getProject());
                iinfo.interfaceNames[i] = interfaceName;
            }
            else if ( extendedDefinition instanceof ClassDefinition )
            {
                this.interfaceScope.addProblem(new CannotExtendClassProblem(extendedInterface, extendedDefinition.getBaseName()));
            }
            else if ( extendedDefinition instanceof AmbiguousDefinition )
            {
                if ( extendedInterface instanceof IIdentifierNode )
                {
                    this.interfaceScope.addProblem(new AmbiguousReferenceProblem(extendedInterface, ((IIdentifierNode)extendedInterface).getName()));
                }
                else
                {
                    //  Parser let something weird through.
                    this.interfaceScope.addProblem(new AmbiguousReferenceProblem(extendedInterface, ""));
                }
            }
            else if ( extendedDefinition != null )
            {
                this.interfaceScope.addProblem(new UnknownInterfaceProblem(extendedInterface, extendedDefinition.getBaseName()));
            }
            else
            {
                if ( extendedInterface instanceof IIdentifierNode )
                {
                    this.interfaceScope.addProblem(new UnknownInterfaceProblem(extendedInterface, ((IIdentifierNode)extendedInterface).getName()));
                }
                else
                {
                    //  Parser let something weird through.
                    this.interfaceScope.addProblem(new UnknownInterfaceProblem(extendedInterface, ""));
                }
            }
           
            // Report a problem if the interface is deprecated
            // and the reference to it is not within a deprecated API.
            if ( extendedDefinition != null && extendedDefinition.isDeprecated())
            {
                if (!SemanticUtils.hasDeprecatedAncestor(extendedInterface))
                {
                    ICompilerProblem problem = SemanticUtils.createDeprecationProblem(extendedDefinition, extendedInterface);
                    this.interfaceScope.addProblem(problem);
                }
            }
        }
       
        iinfo.flags |= ABCConstants.CLASS_FLAG_interface;
       
        this.cv = emitter.visitClass(iinfo, cinfo);
        cv.visit();
       
        this.itraits = cv.visitInstanceTraits();
       
        //  Define the interface in the init script.
        InstructionList setup_insns = this.interfaceScope.getGlobalScope().getInitInstructions();
        setup_insns.addInstruction(OP_getscopeobject, 0);

        //  Interfaces don't have a base class.
        setup_insns.addInstruction(OP_pushnull);

        setup_insns.addInstruction(OP_newclass, cinfo);
        setup_insns.addInstruction(OP_initproperty, interfaceName);
       
        ITraitVisitor tv = this.interfaceScope.getGlobalScope().traitsVisitor.visitClassTrait(TRAIT_Class, interfaceName, 0, cinfo);
        this.interfaceScope.processMetadata(tv, interfDef.getAllMetaTags());
        tv.visitEnd();
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.definitions.InterfaceDefinition$InterfaceIterator

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.