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

Examples of org.apache.flex.compiler.internal.definitions.ClassDefinition


   
    @Override
    protected FramesInformation computeFramesInformation() throws InterruptedException
    {
        LinkedList<SWFFrameInfo> frames = new LinkedList<SWFFrameInfo>();
        ClassDefinition rootClassDef = getRootClassDefinition();
        assert rootClassDef != null : "If the root class can not be resolved, the build should be aborted before this point";
       
        ICompilationUnit rootClassCU = getRootClassCompilationUnit();
        assert rootClassCU != null :"Unable to find compilation unit for definiton!";
       
        final SWFFrameInfo applicationFrame =
            createFrameInfoForApplicationFrame(rootClassDef);
       
        frames.addFirst(applicationFrame);
       
        final ClassDefinition initialFactoryClass =
            rootClassDef.resolveInheritedFactoryClass(flexProject);
        ClassDefinition currentFrameClass = initialFactoryClass;
       
        SWFFrameInfo systemManagerFrame = null;
       
        final FlexDelegate delegate = getDelegate();
        if (delegate.getGenerateSystemManagerAndFlexInit())
        {
            final SWFFrameInfo frameInfo = createFrameInfoForGeneratedSystemManager(initialFactoryClass);
            systemManagerFrame = frameInfo;
            frames.addFirst(frameInfo);
            currentFrameClass = currentFrameClass.resolveInheritedFactoryClass(project);
        }
       
        while ((currentFrameClass != null) && (!currentFrameClass.isImplicit()))
        {
            ICompilationUnit currentFrameClassCompilationUnit = flexProject.getScope().getCompilationUnitForDefinition(currentFrameClass);
            assert currentFrameClassCompilationUnit != null :"Unable to find compilation unit for definiton!";
            final SWFFrameInfo frameInfo = new SWFFrameInfo(currentFrameClass.getQualifiedName(), SWFFrameInfo.EXTERNS_DISALLOWED,
                    Collections.<ICompilationUnit>singleton(currentFrameClassCompilationUnit),
                    Collections.<ICompilerProblem>emptyList());
            frames.addFirst(frameInfo);
            currentFrameClass = currentFrameClass.resolveInheritedFactoryClass(project);
        }

        assert frames.getLast().rootedUnits.contains(rootClassCU) :
            "The main class definition for the last frame, must be the main class definition for the SWF.";
        final FramesInformation explicitFrames = getExplicitFramesInformation();
View Full Code Here


         */
        @Override
        protected void createFrames(SWFTarget swfTarget, ISWF swf, ImmutableSet<ICompilationUnit> builtCompilationUnits, Set<ICompilationUnit> emittedCompilationUnits, Collection<ICompilerProblem> problems) throws InterruptedException
        {
            final FlexDelegate delegate = getDelegate();
            final ClassDefinition rootClassDefinition =
                getRootClassDefinition();
            frame1Info = new FlexApplicationFrame1Info(flexProject,
                                targetSettings,
                                rootClassDefinition,
                                delegate.getGenerateSystemManagerAndFlexInit(),
                                delegate.isFlexInfo(rootClassDefinition),
                                builtCompilationUnits);
            SWFFrame applicationSWFFrame = null;
            for (final SWFFrameInfo frameInfo : frameInfos)
            {
                SWFFrame swfFrame = createFrame(swfTarget, frameInfo, builtCompilationUnits, emittedCompilationUnits, problems);
                if (frameInfo == systemManagerFrame)
                {
                    assert delegate.getGenerateSystemManagerAndFlexInit() : "systemManagerFrame should be null, unless we are generating a system manager.";
                    delegate.addGeneratedSystemManagerToFrame(swfFrame, frame1Info, initialFactoryClass, builtCompilationUnits, problems);
                }
                else if (frameInfo == applicationFrame)
                {
                    delegate.addGeneratedCodeToMainApplicationFrame(swfFrame, frame1Info, emittedCompilationUnits, problems);
                    applicationSWFFrame = swfFrame;
                }
               
                swf.addFrame(swfFrame);
            }
           
            if (delegate.getGenerateSystemManagerAndFlexInit())
            {
                final String generatedSystemManager =
                    delegate.getGeneratedSystemManagerClassName(initialFactoryClass);
                swf.setTopLevelClass(generatedSystemManager);
                validateRootCompiltionUnitCSS(builtCompilationUnits, problems);
            }
            else
            {
                swf.setTopLevelClass(rootClassDefinition.getQualifiedName());
               
                // if we are not generating a system manager but have RSLs to load, generate
                // a warning.
                if (hasRSLs())
                {
View Full Code Here

                ICompilerProblem problem = new MXMLSemanticProblem(childTag);
                builder.addProblem(problem);
            }
           
            MXMLFileScope fileScope = builder.getFileScope();
            ClassDefinition definitionTagClass =
                    fileScope.getClassDefinitionForDefinitionTag(tag);

            assert tagDefinition == definitionTagClass.resolveBaseClass(project);

            containedClassDefinitionNode.setClassReference(project, tagDefinition); // TODO Move this logic to initializeFromTag().
            containedClassDefinitionNode.setClassDefinition(definitionTagClass); // TODO Move this logic to initializeFromTag().
            containedClassDefinitionNode.initializeFromTag(builder, childTag);

            int nameStart = definitionTagClass.getNameStart();
            int nameEnd = definitionTagClass.getNameEnd();
            definitionTagClass.setNode(containedClassDefinitionNode);
            // TODO The above call is setting nameStart and nameEnd to -1
            // because the MXML class definition node doesn't have a name expression node.
            // We need to reset the correct nameStart and nameEnd.
            definitionTagClass.setNameLocation(nameStart, nameEnd);
        }
        if (!handled)
        {
            super.processChildTag(builder, tag, childTag, info);
        }
View Full Code Here

        final String classQName = data.getQName();
        Name className = new Name(classQName);

        IDefinition baseClass = project.resolveQNameToDefinition(skinClass);
        assert (baseClass instanceof ClassDefinition) : "skinClass does not resolve to a class";
        ClassDefinition baseClassDef = (ClassDefinition)baseClass;

        Collection<Name> implementedInterfaces = new ImmutableList.Builder<Name>()
        .add(iBorderReference.getMName())
        .add(iFlexDisplayObjectReference.getMName())
        .add(iFlexAssetReference.getMName())
View Full Code Here

   
    /** common code used by all the constructors
     */
    private void finishInit(MXMLClassDirectiveProcessor host)
    {
        ClassDefinition classDef = host.getClassDefinition();
        ASScope classScope = classDef.getContainedScope();
        analyzeExpression(host.getProject(), classScope);
       
        // TODO: we should be able to assert that we make a dest string, becuase
        // in general the bindign manager needs one, even if we have a dest func.
        // HOWEVER - we don't always generate on now, and it seems OK.
View Full Code Here

        // for now contingent definitions are only ever class members, so the containing scope def must
        // be a ClassDefinition.  In future this rule can be changed, but code to search the class
        // hierarchy will become more complex, as the whole definition resolution code needs to be updated
        assert (containingScope.getDefinition() instanceof ClassDefinition) : "contingent definitions containing scope must be a Class";
        ClassDefinition containingType = (ClassDefinition)containingScope.getDefinition();

        String contingentName = definition.getBaseName();
        for (ITypeDefinition type : definition.isStatic() ? containingType.staticTypeIterable(project, false) : containingType.typeIteratable(project, false))
        {
            ASScope typeScope = (ASScope)type.getContainedScope();
            List<IDefinition> defs = new LinkedList<IDefinition>();
            typeScope.getLocalProperty(project, defs, contingentName, null, false);
            // found a non contingent definition, so this contingent def is
View Full Code Here

            scopeNode.getAllImports(list);
        }
        else
        {
            // MXML
            ClassDefinition cdefinition = (ClassDefinition) type;
            String[] implicitImports = cdefinition.getImplicitImports();
            for (String imp : implicitImports)
            {
                list.add(imp);
            }
        }
View Full Code Here

            scopeNode.getAllImports(list);
        }
        else
        {
            // MXML
            ClassDefinition cdefinition = (ClassDefinition) type;
            String[] implicitImports = cdefinition.getImplicitImports();
            for (String imp : implicitImports)
            {
                list.add(imp);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.definitions.ClassDefinition

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.