flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/2] git commit: [flex-falcon] [refs/heads/develop] - changes needed to compile basictests in flex-asjs for SWF
Date Thu, 20 Mar 2014 14:33:54 GMT
changes needed to compile basictests in flex-asjs for SWF


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/13592ed2
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/13592ed2
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/13592ed2

Branch: refs/heads/develop
Commit: 13592ed21cb3ca24f1f33f50fdfa1c1605a3a898
Parents: c87817b
Author: Alex Harui <aharui@apache.org>
Authored: Thu Mar 20 07:24:00 2014 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Mar 20 07:24:52 2014 -0700

----------------------------------------------------------------------
 .../internal/targets/FlexAppSWFTarget.java      | 470 +++++++++++--------
 .../targets/FlexApplicationFrame1Info.java      |   7 +
 .../internal/targets/FlexLibrarySWFTarget.java  |   3 +-
 .../compiler/internal/targets/FlexTarget.java   | 134 +++---
 4 files changed, 354 insertions(+), 260 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/13592ed2/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
b/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
index 8a2afeb..87976bd 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
@@ -748,10 +748,13 @@ public class FlexAppSWFTarget extends AppSWFTarget
         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,
-                                getRootClassDefinition(),
+                                rootClassDefinition,
                                 delegate.getGenerateSystemManagerAndFlexInit(),
+                                delegate.isFlexInfo(rootClassDefinition),
                                 builtCompilationUnits);
             SWFFrame applicationSWFFrame = null;
             for (final SWFFrameInfo frameInfo : frameInfos)
@@ -780,8 +783,6 @@ public class FlexAppSWFTarget extends AppSWFTarget
             }
             else
             {
-                final ClassDefinition rootClassDefinition =
-                    getRootClassDefinition();
                 swf.setTopLevelClass(rootClassDefinition.getQualifiedName());
                 
                 // if we are not generating a system manager but have RSLs to load, generate
@@ -1172,7 +1173,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
             if (frame1Info != null)
                 return frame1Info;
             frame1Info = new FlexApplicationFrame1Info(flexProject,
-                    targetSettings, mainApplicationClassDefinition, getGenerateSystemManagerAndFlexInit(),
getBuiltCompilationUnitSet().compilationUnits);
+                    targetSettings, mainApplicationClassDefinition, getGenerateSystemManagerAndFlexInit(),

+                    isFlexInfo((ClassDefinition)mainApplicationClassDefinition), getBuiltCompilationUnitSet().compilationUnits);
             return frame1Info;
         }
         
@@ -1203,7 +1205,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
                 Set<ICompilationUnit> emittedCompilationUnits,
                 Collection<ICompilerProblem> problems) throws InterruptedException
         {
-            if (getGenerateSystemManagerAndFlexInit() || isFlexInfo((ClassDefinition)mainApplicationClassDefinition))
+            boolean isAppFlexInfo = isFlexInfo((ClassDefinition)mainApplicationClassDefinition);
+            if (getGenerateSystemManagerAndFlexInit() || isAppFlexInfo)
             {
                 try
                 {
@@ -1215,7 +1218,9 @@ public class FlexAppSWFTarget extends AppSWFTarget
                     final CSSCodeGenProblem problem = new CSSCodeGenProblem(e);
                     problems.add(problem);
                 }
-                addGeneratedFlexInitToFrame(problems, mainApplicationFrame, emittedCompilationUnits);
+                FlexRSLInfo rslInfo = getDelegate().getRSLInfo();
+                addGeneratedFlexInitToFrame(problems, mainApplicationFrame, emittedCompilationUnits,

+                        isAppFlexInfo, frame1Info, rslInfo);
             }
             else
             {
@@ -1334,7 +1339,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
          * added to the speciifed {@link SWFFrame}.
          * @throws InterruptedException
          */
-        private boolean addGeneratedFlexInitToFrame(final Collection<ICompilerProblem>
problems, SWFFrame frame, Set<ICompilationUnit> emittedCompilationUnits) throws InterruptedException
+        private boolean addGeneratedFlexInitToFrame(final Collection<ICompilerProblem>
problems, SWFFrame frame, Set<ICompilationUnit> emittedCompilationUnits, 
+                boolean isAppFlexInfo, FlexApplicationFrame1Info frame1Info, FlexRSLInfo
rslInfo) throws InterruptedException
         {
             ABCEmitter emitter = new ABCEmitter();
             emitter.visit(ABCConstants.VERSION_ABC_MAJOR_FP10, ABCConstants.VERSION_ABC_MINOR_FP10);
@@ -1393,230 +1399,281 @@ public class FlexAppSWFTarget extends AppSWFTarget
             //        local2.registerInheritingStyle(local0);  // local2 is the style manager.
             //    }
             // }
-            MethodInfo initMethodInfo = new MethodInfo();
-            initMethodInfo.setMethodName("FlexInit init method");
-            initMethodInfo.setParamTypes(new Vector<Name>(Collections.singleton(iModuleFactoryReference.getMName())));
-            initMethodInfo.setReturnType(new Name(IASLanguageConstants.void_));
-            IMethodVisitor initMethodVisitor = emitter.visitMethod(initMethodInfo);
-            initMethodVisitor.visit();
-            MethodBodyInfo initMethodBodyInfo = new MethodBodyInfo();
-            initMethodBodyInfo.setMethodInfo(initMethodInfo);
-            IMethodBodyVisitor initMethodBodyVisitor = initMethodVisitor.visitBody(initMethodBodyInfo);
-            initMethodBodyVisitor.visit();
-            
-            // local0 = temp
-            // local1 = module factory argument
-            // local2 = style manager
-            // local3 = inherited styles array
-            InstructionList initMethod = new InstructionList();
-            
-            // Since we don't need "this", we can kill local0, we'll use it later for something
else.
-            initMethod.addInstruction(ABCConstants.OP_kill, 0);
-            initMethod.addInstruction(ABCConstants.OP_finddef, childManagerReference.getMName());
-            initMethod.addInstruction(ABCConstants.OP_getlocal1);
-            initMethod.addInstruction(ABCConstants.OP_constructprop, new Object[] { childManagerReference.getMName(),
1 });
-            initMethod.addInstruction(ABCConstants.OP_pop);
-            initMethod.addInstruction(ABCConstants.OP_finddef, styleManagerImplReference.getMName());
-            initMethod.addInstruction(ABCConstants.OP_getlocal1);
-            initMethod.addInstruction(ABCConstants.OP_constructprop, new Object[] { styleManagerImplReference.getMName(),
1 });
-            initMethod.addInstruction(ABCConstants.OP_setlocal2);
-            
-            Map<String, String> effectNameToTriggerMap = new TreeMap<String, String>();
-            Map<String, Boolean> inheritingStyleMap = new TreeMap<String, Boolean>();
-            Map<ClassDefinition, String> remoteClassAliasMap =
-                new TreeMap<ClassDefinition, String>(new Comparator<ClassDefinition>()
-                {
-                    @Override
-                    public int compare(ClassDefinition o1, ClassDefinition o2)
+            if (isAppFlexInfo)
+            {
+                MethodInfo initMethodInfo = new MethodInfo();
+                initMethodInfo.setMethodName("FlexInit init method");
+                initMethodInfo.setParamTypes(new Vector<Name>(Collections.singleton(new
Name("Object"))));
+                initMethodInfo.setReturnType(new Name(IASLanguageConstants.void_));
+                IMethodVisitor initMethodVisitor = emitter.visitMethod(initMethodInfo);
+                initMethodVisitor.visit();
+                MethodBodyInfo initMethodBodyInfo = new MethodBodyInfo();
+                initMethodBodyInfo.setMethodInfo(initMethodInfo);
+                IMethodBodyVisitor initMethodBodyVisitor = initMethodVisitor.visitBody(initMethodBodyInfo);
+                initMethodBodyVisitor.visit();
+                
+                // local0 = temp
+                // local1 = module factory argument
+                // local2 = style manager
+                // local3 = inherited styles array
+                InstructionList initMethod = new InstructionList();
+                initMethod.addInstruction(ABCConstants.OP_returnvoid);
+                
+                initMethodBodyVisitor.visitInstructionList(initMethod);
+                initMethodBodyVisitor.visitEnd();
+                initMethodVisitor.visitEnd();
+                
+                ITraitVisitor initMethodTraitVisitor = 
+                    classGen.getCTraitsVisitor().visitMethodTrait(ABCConstants.TRAIT_Method,
new Name("init"), 0, initMethodInfo);
+                initMethodTraitVisitor.visitStart();
+                initMethodTraitVisitor.visitEnd();
+
+                codegenInfoMethod(classGen, 
+                        flexProject.getCompatibilityVersion(),
+                        getMainClassQName(),
+                        getPreloaderClassReference(),
+                        getRuntimeDPIProviderClassReference(),
+                        splashScreenImage,
+                        getRootNode(),
+                        getTargetAttributes(),
+                        flexProject.getLocales(),
+                        frame1Info,
+                        accessibleClassNames,
+                        getFlexInitClassName(),
+                        getStylesClassName(),
+                        targetSettings.getRuntimeSharedLibraries(),
+                        rslInfo,
+                        problems,
+                        isAppFlexInfo);
+                
+            }
+            else
+            {
+                MethodInfo initMethodInfo = new MethodInfo();
+                initMethodInfo.setMethodName("FlexInit init method");
+                initMethodInfo.setParamTypes(new Vector<Name>(Collections.singleton(iModuleFactoryReference.getMName())));
+                initMethodInfo.setReturnType(new Name(IASLanguageConstants.void_));
+                IMethodVisitor initMethodVisitor = emitter.visitMethod(initMethodInfo);
+                initMethodVisitor.visit();
+                MethodBodyInfo initMethodBodyInfo = new MethodBodyInfo();
+                initMethodBodyInfo.setMethodInfo(initMethodInfo);
+                IMethodBodyVisitor initMethodBodyVisitor = initMethodVisitor.visitBody(initMethodBodyInfo);
+                initMethodBodyVisitor.visit();
+                
+                // local0 = temp
+                // local1 = module factory argument
+                // local2 = style manager
+                // local3 = inherited styles array
+                InstructionList initMethod = new InstructionList();
+                
+                // Since we don't need "this", we can kill local0, we'll use it later for
something else.
+                initMethod.addInstruction(ABCConstants.OP_kill, 0);
+                initMethod.addInstruction(ABCConstants.OP_finddef, childManagerReference.getMName());
+                initMethod.addInstruction(ABCConstants.OP_getlocal1);
+                initMethod.addInstruction(ABCConstants.OP_constructprop, new Object[] { childManagerReference.getMName(),
1 });
+                initMethod.addInstruction(ABCConstants.OP_pop);
+                initMethod.addInstruction(ABCConstants.OP_finddef, styleManagerImplReference.getMName());
+                initMethod.addInstruction(ABCConstants.OP_getlocal1);
+                initMethod.addInstruction(ABCConstants.OP_constructprop, new Object[] { styleManagerImplReference.getMName(),
1 });
+                initMethod.addInstruction(ABCConstants.OP_setlocal2);
+                
+                Map<String, String> effectNameToTriggerMap = new TreeMap<String,
String>();
+                Map<String, Boolean> inheritingStyleMap = new TreeMap<String, Boolean>();
+                Map<ClassDefinition, String> remoteClassAliasMap =
+                    new TreeMap<ClassDefinition, String>(new Comparator<ClassDefinition>()
                     {
-                        return o1.getQualifiedName().compareTo(o2.getQualifiedName());
-                    } 
-                })
-                {
-                    private static final long serialVersionUID = 1L;
-
-                    /**
-                     *  Override so warning messages can be logged. 
-                     */
-                    @Override
-                    public String put(ClassDefinition key, String value)
+                        @Override
+                        public int compare(ClassDefinition o1, ClassDefinition o2)
+                        {
+                            return o1.getQualifiedName().compareTo(o2.getQualifiedName());
+                        } 
+                    })
                     {
-                        // check for duplicate values and log a warning if any remote 
-                        // classes try to use the same alias.
-                        if (containsValue(value))
+                        private static final long serialVersionUID = 1L;
+    
+                        /**
+                         *  Override so warning messages can be logged. 
+                         */
+                        @Override
+                        public String put(ClassDefinition key, String value)
                         {
-                           for (Map.Entry<ClassDefinition,String> entry  : entrySet())
-                           {
-                               if (value != null && value.equals(entry.getValue()))
+                            // check for duplicate values and log a warning if any remote

+                            // classes try to use the same alias.
+                            if (containsValue(value))
+                            {
+                               for (Map.Entry<ClassDefinition,String> entry  : entrySet())
                                {
-                                   problems.add(new ClassesMappedToSameRemoteAliasProblem(key.getQualifiedName(),
-                                           entry.getKey().getQualifiedName(), value));
-                                   break;
+                                   if (value != null && value.equals(entry.getValue()))
+                                   {
+                                       problems.add(new ClassesMappedToSameRemoteAliasProblem(key.getQualifiedName(),
+                                               entry.getKey().getQualifiedName(), value));
+                                       break;
+                                   }
                                }
-                           }
+                            }
+                            return super.put(key, value);
                         }
-                        return super.put(key, value);
-                    }
-                };
-                
-            for (ICompilationUnit cu : emittedCompilationUnits)
-            {
-                Collection<IDefinition> visibleDefs = cu.getFileScopeRequest().get().getExternallyVisibleDefinitions();
-                for (IDefinition visibleDef : visibleDefs)
+                    };
+                    
+                for (ICompilationUnit cu : emittedCompilationUnits)
                 {
-                    if (visibleDef instanceof ClassDefinition)
+                    Collection<IDefinition> visibleDefs = cu.getFileScopeRequest().get().getExternallyVisibleDefinitions();
+                    for (IDefinition visibleDef : visibleDefs)
                     {
-                        ClassDefinition visibleClass = (ClassDefinition) visibleDef;
-                        IEffectDefinition[] effectDefinitions = visibleClass.getEffectDefinitions(flexProject.getWorkspace());
-                        for (IEffectDefinition effectDefinition : effectDefinitions)
-                        {
-                            // TODO create compiler problem if effect already has a trigger.
-                            effectNameToTriggerMap.put(effectDefinition.getBaseName(), effectDefinition.getEvent());
-                        }
-                        
-                        IStyleDefinition[] styleDefinitions = visibleClass.getStyleDefinitions(flexProject.getWorkspace());
-                        for (IStyleDefinition styleDefinition : styleDefinitions)
+                        if (visibleDef instanceof ClassDefinition)
                         {
-                            boolean isInheriting = styleDefinition.isInheriting();
-                            // TODO create compiler problem if style definitions conflict
-                            inheritingStyleMap.put(styleDefinition.getBaseName(), isInheriting);
+                            ClassDefinition visibleClass = (ClassDefinition) visibleDef;
+                            IEffectDefinition[] effectDefinitions = visibleClass.getEffectDefinitions(flexProject.getWorkspace());
+                            for (IEffectDefinition effectDefinition : effectDefinitions)
+                            {
+                                // TODO create compiler problem if effect already has a trigger.
+                                effectNameToTriggerMap.put(effectDefinition.getBaseName(),
effectDefinition.getEvent());
+                            }
+                            
+                            IStyleDefinition[] styleDefinitions = visibleClass.getStyleDefinitions(flexProject.getWorkspace());
+                            for (IStyleDefinition styleDefinition : styleDefinitions)
+                            {
+                                boolean isInheriting = styleDefinition.isInheriting();
+                                // TODO create compiler problem if style definitions conflict
+                                inheritingStyleMap.put(styleDefinition.getBaseName(), isInheriting);
+                            }
+                            
+                            String remoteClassAlias = visibleClass.getRemoteClassAlias();
+                            if (remoteClassAlias != null)
+                                remoteClassAliasMap.put(visibleClass, remoteClassAlias);
                         }
-                        
-                        String remoteClassAlias = visibleClass.getRemoteClassAlias();
-                        if (remoteClassAlias != null)
-                            remoteClassAliasMap.put(visibleClass, remoteClassAlias);
                     }
                 }
-            }
-            
-            // register effects
-            if (!effectNameToTriggerMap.isEmpty())
-            {
-                IDefinition mxInternalDef = mxInternalReference.resolve(flexProject);
-                if (!(mxInternalDef instanceof NamespaceDefinition))
-                    return false;
-                
-                
-                IResolvedQualifiersReference registerEffectTriggerRef =
-                    ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(),
(INamespaceDefinition)mxInternalDef, 
-                            "registerEffectTrigger");
-                Name registerEffectTriggerName = registerEffectTriggerRef.getMName();
                 
-                initMethod.addInstruction(ABCConstants.OP_getlex, effectManagerReference.getMName());
-                
-                for (Map.Entry<String, String> effectEntry : effectNameToTriggerMap.entrySet())
+                // register effects
+                if (!effectNameToTriggerMap.isEmpty())
                 {
-                    initMethod.addInstruction(ABCConstants.OP_dup);  // copy the effectManager
class closure
-                    initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getKey());
-                    initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getValue());
-                    initMethod.addInstruction(ABCConstants.OP_callpropvoid, new Object[]
{ registerEffectTriggerName, 2 });
+                    IDefinition mxInternalDef = mxInternalReference.resolve(flexProject);
+                    if (!(mxInternalDef instanceof NamespaceDefinition))
+                        return false;
+                    
+                    
+                    IResolvedQualifiersReference registerEffectTriggerRef =
+                        ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(),
(INamespaceDefinition)mxInternalDef, 
+                                "registerEffectTrigger");
+                    Name registerEffectTriggerName = registerEffectTriggerRef.getMName();
+                    
+                    initMethod.addInstruction(ABCConstants.OP_getlex, effectManagerReference.getMName());
+                    
+                    for (Map.Entry<String, String> effectEntry : effectNameToTriggerMap.entrySet())
+                    {
+                        initMethod.addInstruction(ABCConstants.OP_dup);  // copy the effectManager
class closure
+                        initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getKey());
+                        initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getValue());
+                        initMethod.addInstruction(ABCConstants.OP_callpropvoid, new Object[]
{ registerEffectTriggerName, 2 });
+                    }
+                    initMethod.addInstruction(ABCConstants.OP_pop);
+                    
                 }
-                initMethod.addInstruction(ABCConstants.OP_pop);
                 
-            }
-            
-            // Initialize AccessibilityClasses. Below is example code. Each
-            // accessibility class found by the compiler will have its
-            // enableAccessibility() method called.
-            // 
-            // if (Capabilities.hasAccessibility) {
-            //    spark.accessibility.TextBaseAccImpl.enableAccessibility();
-            //    mx.accessibility.UIComponentAccProps.enableAccessibility();
-            //    spark.accessibility.ButtonBaseAccImpl.enableAccessibility();
-            // }
-            if (targetSettings.isAccessible())
-            {
-                Name capabilitiesSlotName = capabilitiesReference.getMName();
-                initMethod.addInstruction(ABCConstants.OP_findpropstrict, capabilitiesSlotName);
-                initMethod.addInstruction(ABCConstants.OP_getproperty, capabilitiesSlotName);
-                initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("hasAccessibility"));
-                Label accessibilityEnd = new Label();
-                initMethod.addInstruction(ABCConstants.OP_iffalse, accessibilityEnd);
-
-                IResolvedQualifiersReference enableAccessibilityReference = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
-                        "enableAccessibility");            
-                Name enableAccessibilityName = enableAccessibilityReference.getMName();
-                Object[] enableAccessibilityCallPropOperands = new Object[] { enableAccessibilityName,
0 };
-                for (String accessibilityClassName : accessibleClassNames)
+                // Initialize AccessibilityClasses. Below is example code. Each
+                // accessibility class found by the compiler will have its
+                // enableAccessibility() method called.
+                // 
+                // if (Capabilities.hasAccessibility) {
+                //    spark.accessibility.TextBaseAccImpl.enableAccessibility();
+                //    mx.accessibility.UIComponentAccProps.enableAccessibility();
+                //    spark.accessibility.ButtonBaseAccImpl.enableAccessibility();
+                // }
+                if (targetSettings.isAccessible())
                 {
-                    IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
-                            accessibilityClassName);
-                    Name accName = ref.getMName();
-                    initMethod.addInstruction(ABCConstants.OP_getlex, accName);
-                    initMethod.addInstruction(ABCConstants.OP_callproperty, enableAccessibilityCallPropOperands);
-                    initMethod.addInstruction(ABCConstants.OP_pop);
+                    Name capabilitiesSlotName = capabilitiesReference.getMName();
+                    initMethod.addInstruction(ABCConstants.OP_findpropstrict, capabilitiesSlotName);
+                    initMethod.addInstruction(ABCConstants.OP_getproperty, capabilitiesSlotName);
+                    initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("hasAccessibility"));
+                    Label accessibilityEnd = new Label();
+                    initMethod.addInstruction(ABCConstants.OP_iffalse, accessibilityEnd);
+    
+                    IResolvedQualifiersReference enableAccessibilityReference = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
+                            "enableAccessibility");            
+                    Name enableAccessibilityName = enableAccessibilityReference.getMName();
+                    Object[] enableAccessibilityCallPropOperands = new Object[] { enableAccessibilityName,
0 };
+                    for (String accessibilityClassName : accessibleClassNames)
+                    {
+                        IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
+                                accessibilityClassName);
+                        Name accName = ref.getMName();
+                        initMethod.addInstruction(ABCConstants.OP_getlex, accName);
+                        initMethod.addInstruction(ABCConstants.OP_callproperty, enableAccessibilityCallPropOperands);
+                        initMethod.addInstruction(ABCConstants.OP_pop);
+                    }
+    
+                    initMethod.labelNext(accessibilityEnd);
                 }
-
-                initMethod.labelNext(accessibilityEnd);
-            }
-            
-            // register class aliases
-            if (!remoteClassAliasMap.isEmpty())
-            {
-                Name getClassByAliasName = getClassByAliasReference.getMName();
-                Name registerClassAliasName = registerClassAliasReference.getMName();
-                Object[] getClassByAliasCallPropOperands = new Object[] { getClassByAliasName,
1 };
-                Object [] registerClassAliasCallPropOperands = new Object[] { registerClassAliasName,
2 };
-                for (Map.Entry<ClassDefinition, String> classAliasEntry : remoteClassAliasMap.entrySet())
+                
+                // register class aliases
+                if (!remoteClassAliasMap.isEmpty())
                 {
-                    Label tryLabel = new Label();
-                    initMethod.labelNext(tryLabel);
-                    initMethod.addInstruction(ABCConstants.OP_finddef, getClassByAliasName);
-                    initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
-                    initMethod.addInstruction(ABCConstants.OP_callproperty, getClassByAliasCallPropOperands);
-                    Name classMName = classAliasEntry.getKey().getMName(flexProject);
-                    initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
-                    Label endTryLabel = new Label();
-                    initMethod.addInstruction(ABCConstants.OP_ifeq, endTryLabel);
-                    initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
-                    initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
-                    initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
-                    initMethod.addInstruction(ABCConstants.OP_callpropvoid, registerClassAliasCallPropOperands);
-                    initMethod.labelNext(endTryLabel);
-                    Label afterCatch = new Label();
-                    initMethod.addInstruction(ABCConstants.OP_jump, afterCatch);
-                    Label catchLabel = new Label();
-                    initMethod.labelNext(catchLabel);
-                    initMethod.addInstruction(ABCConstants.OP_pop);
-                    initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
-                    initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
-                    initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
-                    initMethod.addInstruction(ABCConstants.OP_callpropvoid, registerClassAliasCallPropOperands);
-                    initMethod.labelNext(afterCatch);
-                    initMethodBodyVisitor.visitException(tryLabel, endTryLabel, catchLabel,

-                            new Name(IASLanguageConstants.Error), null);
+                    Name getClassByAliasName = getClassByAliasReference.getMName();
+                    Name registerClassAliasName = registerClassAliasReference.getMName();
+                    Object[] getClassByAliasCallPropOperands = new Object[] { getClassByAliasName,
1 };
+                    Object [] registerClassAliasCallPropOperands = new Object[] { registerClassAliasName,
2 };
+                    for (Map.Entry<ClassDefinition, String> classAliasEntry : remoteClassAliasMap.entrySet())
+                    {
+                        Label tryLabel = new Label();
+                        initMethod.labelNext(tryLabel);
+                        initMethod.addInstruction(ABCConstants.OP_finddef, getClassByAliasName);
+                        initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
+                        initMethod.addInstruction(ABCConstants.OP_callproperty, getClassByAliasCallPropOperands);
+                        Name classMName = classAliasEntry.getKey().getMName(flexProject);
+                        initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
+                        Label endTryLabel = new Label();
+                        initMethod.addInstruction(ABCConstants.OP_ifeq, endTryLabel);
+                        initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
+                        initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
+                        initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
+                        initMethod.addInstruction(ABCConstants.OP_callpropvoid, registerClassAliasCallPropOperands);
+                        initMethod.labelNext(endTryLabel);
+                        Label afterCatch = new Label();
+                        initMethod.addInstruction(ABCConstants.OP_jump, afterCatch);
+                        Label catchLabel = new Label();
+                        initMethod.labelNext(catchLabel);
+                        initMethod.addInstruction(ABCConstants.OP_pop);
+                        initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
+                        initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
+                        initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
+                        initMethod.addInstruction(ABCConstants.OP_callpropvoid, registerClassAliasCallPropOperands);
+                        initMethod.labelNext(afterCatch);
+                        initMethodBodyVisitor.visitException(tryLabel, endTryLabel, catchLabel,

+                                new Name(IASLanguageConstants.Error), null);
+                    }
                 }
-            }
-            
-            // register inheriting styles
-            if (!inheritingStyleMap.isEmpty())
-            {
-                initMethod.addInstruction(ABCConstants.OP_getlex, stylesClassName);
-                int count = 0;
-                for (Map.Entry<String, Boolean> styleEntry : inheritingStyleMap.entrySet())
+                
+                // register inheriting styles
+                if (!inheritingStyleMap.isEmpty())
                 {
-                    if (styleEntry.getValue().booleanValue())
+                    initMethod.addInstruction(ABCConstants.OP_getlex, stylesClassName);
+                    int count = 0;
+                    for (Map.Entry<String, Boolean> styleEntry : inheritingStyleMap.entrySet())
                     {
-                        ++count;
-                        initMethod.addInstruction(ABCConstants.OP_pushstring, styleEntry.getKey());
+                        if (styleEntry.getValue().booleanValue())
+                        {
+                            ++count;
+                            initMethod.addInstruction(ABCConstants.OP_pushstring, styleEntry.getKey());
+                        }
                     }
+                    
+                    initMethod.addInstruction(ABCConstants.OP_newarray, count);
+                    initMethod.addInstruction(ABCConstants.OP_setproperty, new Name("inheritingStyles"));
+    
                 }
+    
+                initMethod.addInstruction(ABCConstants.OP_returnvoid);
                 
-                initMethod.addInstruction(ABCConstants.OP_newarray, count);
-                initMethod.addInstruction(ABCConstants.OP_setproperty, new Name("inheritingStyles"));
-
+                initMethodBodyVisitor.visitInstructionList(initMethod);
+                initMethodBodyVisitor.visitEnd();
+                initMethodVisitor.visitEnd();
+                
+                ITraitVisitor initMethodTraitVisitor = 
+                    classGen.getCTraitsVisitor().visitMethodTrait(ABCConstants.TRAIT_Method,
new Name("init"), 0, initMethodInfo);
+                initMethodTraitVisitor.visitStart();
+                initMethodTraitVisitor.visitEnd();
             }
-
-            initMethod.addInstruction(ABCConstants.OP_returnvoid);
-            
-            initMethodBodyVisitor.visitInstructionList(initMethod);
-            initMethodBodyVisitor.visitEnd();
-            initMethodVisitor.visitEnd();
-            
-            ITraitVisitor initMethodTraitVisitor = 
-                classGen.getCTraitsVisitor().visitMethodTrait(ABCConstants.TRAIT_Method,
new Name("init"), 0, initMethodInfo);
-            initMethodTraitVisitor.visitStart();
-            initMethodTraitVisitor.visitEnd();
             classGen.finishScript();
             
             DoABCTag doABC = new DoABCTag();
@@ -1753,7 +1810,8 @@ public class FlexAppSWFTarget extends AppSWFTarget
                     getStylesClassName(),
                     targetSettings.getRuntimeSharedLibraries(),
                     rslInfo,
-                    problemCollection);
+                    problemCollection,
+                    false);
             
             classGen.finishScript();
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/13592ed2/compiler/src/org/apache/flex/compiler/internal/targets/FlexApplicationFrame1Info.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/FlexApplicationFrame1Info.java
b/compiler/src/org/apache/flex/compiler/internal/targets/FlexApplicationFrame1Info.java
index 382298e..792e3fd 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/FlexApplicationFrame1Info.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/FlexApplicationFrame1Info.java
@@ -57,12 +57,14 @@ final class FlexApplicationFrame1Info extends FlexFrame1Info
             ITargetSettings targetSettings,
             IClassDefinition mainApplicationClassDefinition,
             boolean generateSystemManagerAndFlexInit,
+            boolean isFlexInfo,
             ImmutableSet<ICompilationUnit> builtCompilationUnits) throws InterruptedException
     {
         super(flexProject);
         this.targetSettings = targetSettings;
         this.mainApplicationClassDefinition = mainApplicationClassDefinition;
         this.generateSystemManagerAndFlexInit = generateSystemManagerAndFlexInit;
+        this.isFlexInfo = isFlexInfo;
         
         // sorted set of mixin classes
         mixinClassNames = new TreeSet<String>();
@@ -77,6 +79,7 @@ final class FlexApplicationFrame1Info extends FlexFrame1Info
     private final ITargetSettings targetSettings;
     private final IClassDefinition mainApplicationClassDefinition;
     private final boolean generateSystemManagerAndFlexInit;
+    private final boolean isFlexInfo;
     private final ApplicationAndModuleDefinitions appAndModuleDefs;
     
     /**
@@ -107,6 +110,10 @@ final class FlexApplicationFrame1Info extends FlexFrame1Info
             collectContributingSWCs(contributingSWCs, cu);
             checkForCompiledAsAComponentProblem(appAndModuleDefs, problems, cu);
         }
+        else if (isFlexInfo)
+        {
+            collectMixinMetaData(mixinClassNames, cu);            
+        }
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/13592ed2/compiler/src/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
b/compiler/src/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
index 2dfb8a1..2f9a996 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
@@ -460,7 +460,8 @@ public final class FlexLibrarySWFTarget extends LibrarySWFTarget
                     null, // styles class name
                     null, // rsls
                     null, // rslinof
-                    problemCollection);
+                    problemCollection,
+                    false);
             
         }
         

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/13592ed2/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java b/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
index f9a9e60..52348fb 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
@@ -270,14 +270,25 @@ public abstract class FlexTarget
             String stylesClassName,
             List<String> rsls,
             FlexRSLInfo rslInfo,
-            Collection<ICompilerProblem> problemCollection) 
+            Collection<ICompilerProblem> problemCollection,
+            boolean isAppFlexInfo) 
             throws InterruptedException
     {
         IResolvedQualifiersReference applicationDomainRef = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
                 IASLanguageConstants.ApplicationDomain);
-        NamespaceDefinition.IPrivateNamespaceDefinition privateNSDef = NamespaceDefinition.createPrivateNamespaceDefinition("");
-        IResolvedQualifiersReference infoSlotReference = ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(),
-                privateNSDef, "info");
+        IResolvedQualifiersReference infoSlotReference;
+        if (isAppFlexInfo)
+        {
+            NamespaceDefinition.IStaticProtectedNamespaceDefinition staticNSDef = NamespaceDefinition.createStaticProtectedNamespaceDefinition("");
+            infoSlotReference = ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(),
+                    staticNSDef, "_info");            
+        }
+        else
+        {
+            NamespaceDefinition.IPrivateNamespaceDefinition privateNSDef = NamespaceDefinition.createPrivateNamespaceDefinition("");
+            infoSlotReference = ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(),
+                    privateNSDef, "info");
+        }
         Name infoSlotName = infoSlotReference.getMName();
 
         InstructionList info = new InstructionList();
@@ -332,53 +343,56 @@ public abstract class FlexTarget
             infoEntries++;
         }
 
-        // preloader:
-        if (preloaderReference != null)
+        if (!isAppFlexInfo)
         {
-            info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_PRELOADER);
-            info.addInstruction(ABCConstants.OP_getlex, preloaderReference.getMName());
-            infoEntries++;            
-        }
-        
-        // runtimeDPIProvider:
-        if (runtimeDPIProviderReference != null)
-        {
-            info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_RUNTIME_DPI_PROVIDER);
-            info.addInstruction(ABCConstants.OP_getlex, runtimeDPIProviderReference.getMName());
-            infoEntries++;            
-        }
-        
-        // splashScreenImage:
-        if (splashScreen.generatedEmbedClassReference != null)
-        {
-            info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_SPLASH_SCREEN_IMAGE);
-            info.addInstruction(ABCConstants.OP_getlex, splashScreen.generatedEmbedClassReference.getMName());
-            infoEntries++;            
+            // preloader:
+            if (preloaderReference != null)
+            {
+                info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_PRELOADER);
+                info.addInstruction(ABCConstants.OP_getlex, preloaderReference.getMName());
+                infoEntries++;            
+            }
+            
+            // runtimeDPIProvider:
+            if (runtimeDPIProviderReference != null)
+            {
+                info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_RUNTIME_DPI_PROVIDER);
+                info.addInstruction(ABCConstants.OP_getlex, runtimeDPIProviderReference.getMName());
+                infoEntries++;            
+            }
+            
+            // splashScreenImage:
+            if (splashScreen.generatedEmbedClassReference != null)
+            {
+                info.addInstruction(ABCConstants.OP_pushstring, ATTRIBUTE_SPLASH_SCREEN_IMAGE);
+                info.addInstruction(ABCConstants.OP_getlex, splashScreen.generatedEmbedClassReference.getMName());
+                infoEntries++;            
+            }
+            
+            // Add various root node attributes:
+            infoEntries += codegenRootNodeAttributes(targetAttributes, info, rootNode, problemCollection);
+            
+            // compiledLocales:
+            if (compiledLocales != null)
+            {
+                info.addInstruction(ABCConstants.OP_pushstring, "compiledLocales");
+                for(String locale : compiledLocales)
+                    info.addInstruction(ABCConstants.OP_pushstring, locale);
+                info.addInstruction(ABCConstants.OP_newarray, compiledLocales.size());
+                infoEntries++;            
+            }
+    
+            // compiledResourceBundleNames:
+            if (!frame1Info.compiledResourceBundleNames.isEmpty())
+            {
+                info.addInstruction(ABCConstants.OP_pushstring, "compiledResourceBundleNames");
+                for(String bundleName : frame1Info.compiledResourceBundleNames)
+                    info.addInstruction(ABCConstants.OP_pushstring, bundleName);
+                info.addInstruction(ABCConstants.OP_newarray, frame1Info.compiledResourceBundleNames.size());
+                infoEntries++;            
+            }
         }
         
-        // Add various root node attributes:
-        infoEntries += codegenRootNodeAttributes(targetAttributes, info, rootNode, problemCollection);
-        
-        // compiledLocales:
-        if (compiledLocales != null)
-        {
-            info.addInstruction(ABCConstants.OP_pushstring, "compiledLocales");
-            for(String locale : compiledLocales)
-                info.addInstruction(ABCConstants.OP_pushstring, locale);
-            info.addInstruction(ABCConstants.OP_newarray, compiledLocales.size());
-            infoEntries++;            
-        }
-
-        // compiledResourceBundleNames:
-        if (!frame1Info.compiledResourceBundleNames.isEmpty())
-        {
-            info.addInstruction(ABCConstants.OP_pushstring, "compiledResourceBundleNames");
-            for(String bundleName : frame1Info.compiledResourceBundleNames)
-                info.addInstruction(ABCConstants.OP_pushstring, bundleName);
-            info.addInstruction(ABCConstants.OP_newarray, frame1Info.compiledResourceBundleNames.size());
-            infoEntries++;            
-        }
-               
         // styleDataClassName
         if (stylesClassName != null)
         {
@@ -461,12 +475,26 @@ public abstract class FlexTarget
         info.addInstruction(ABCConstants.OP_setproperty, infoSlotName);
         info.labelNext(infoL1);
         info.addInstruction(ABCConstants.OP_returnvalue);
-        classGen.addITraitsMethod(new Name("info"), Collections.<Name> emptyList(),

-                new Name("Object"), Collections.emptyList(), false, true, true, info);
 
-        ITraitsVisitor itraitsVisitor = classGen.getITraitsVisitor();
-        ITraitVisitor infoSlotVisitor = itraitsVisitor.visitSlotTrait(ABCConstants.TRAIT_Var,
infoSlotName,
-                ITraitsVisitor.RUNTIME_SLOT, new Name(IASLanguageConstants.Object), LexicalScope.noInitializer);
+        ITraitsVisitor itraitsVisitor;
+        ITraitVisitor infoSlotVisitor;
+        if (isAppFlexInfo)
+        {
+            classGen.addCTraitsMethod(new Name("info"), Collections.<Name> emptyList(),

+                new Name("Object"), Collections.emptyList(), false, info);
+            itraitsVisitor = classGen.getCTraitsVisitor();
+            infoSlotVisitor = itraitsVisitor.visitSlotTrait(ABCConstants.TRAIT_Var, infoSlotName,
+                    ITraitsVisitor.RUNTIME_SLOT, new Name(IASLanguageConstants.Object), LexicalScope.noInitializer);
+        }
+        else
+        {
+            classGen.addITraitsMethod(new Name("info"), Collections.<Name> emptyList(),

+                    new Name("Object"), Collections.emptyList(), false, true, true, info);
+            itraitsVisitor = classGen.getITraitsVisitor();
+            infoSlotVisitor = itraitsVisitor.visitSlotTrait(ABCConstants.TRAIT_Var, infoSlotName,
+                    ITraitsVisitor.RUNTIME_SLOT, new Name(IASLanguageConstants.Object), LexicalScope.noInitializer);
+        }
+        
         infoSlotVisitor.visitStart();
         infoSlotVisitor.visitEnd();
  


Mime
View raw message