incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1415916 - in /incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal: css/codegen/CSSReducer.java targets/FlexAppSWFTarget.java targets/FlexTarget.java
Date Sat, 01 Dec 2012 04:54:17 GMT
Author: aharui
Date: Sat Dec  1 04:54:16 2012
New Revision: 1415916

URL: http://svn.apache.org/viewvc?rev=1415916&view=rev
Log:
Tweak CSS data output to be entirely data (more or less).  Apps with CSS styles will now require
the StyleManagerImpl.as in the flex develop branch so you cannot use older Flex SDKs with
Falcon, including Apache Flex 4.8.0-incubating.  If you really must use an older SDK, try
overlaying the StyleManagerImpl from the develop branch over the older one.

Modified:
    incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
    incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
    incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java

Modified: incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java?rev=1415916&r1=1415915&r2=1415916&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
(original)
+++ incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
Sat Dec  1 04:54:16 2012
@@ -224,7 +224,7 @@ public class CSSReducer implements ICSSC
         final String inheritingStylesText =
                 Joiner.on(",").skipNulls().join(session.inheritingStyles);
         initializeFactoryFunctions.addInstruction(ABCConstants.OP_getlocal0);
-        initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushstring, inheritingStylesText);
+        initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushnull);
         initializeFactoryFunctions.addInstruction(ABCConstants.OP_initproperty, NAME_INHERITING_STYLES);
     }
 
@@ -264,12 +264,12 @@ public class CSSReducer implements ICSSC
                 referenceArray.getMName(),
                 LexicalScope.noInitializer);
 
-        // Generate "public static var inheritingStyles:String"
+        // Generate "public static var inheritingStyles:Array"
         classTraitsVisitor.visitSlotTrait(
-                ABCConstants.TRAIT_Const,
+                ABCConstants.TRAIT_Var,
                 NAME_INHERITING_STYLES,
                 ITraitsVisitor.RUNTIME_SLOT,
-                referenceString.getMName(),
+                referenceArray.getMName(),
                 LexicalScope.noInitializer);
     }
 

Modified: incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java?rev=1415916&r1=1415915&r2=1415916&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
(original)
+++ incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexAppSWFTarget.java
Sat Dec  1 04:54:16 2012
@@ -928,12 +928,11 @@ public class FlexAppSWFTarget extends Ap
 
             ClassDefinition objectClassDef = (ClassDefinition)objectDef;
 
-            // Generates a Style's class that is a mixin class.
+            // Generates a Style's class
             // Generated class name will be of the form _MyApplication_Styles
             // Eg:
             // public class _MyApplication_Styles
             // {
-            //    public static init(fbs:IFlexModuleFactory) : void {}
             // }
 
             final InstructionList cinit = cssCodeGenResult.getClassInitializationInstructions();
@@ -952,27 +951,6 @@ public class FlexAppSWFTarget extends Ap
                         false);
             cssCodeGenResult.visitClassTraits(classGenerator.getCTraitsVisitor());
 
-            // public static function init(fbs:IFlexModuleFactory) : void
-            // {
-            //     flex.compiler.support.generateCSSStyleDeclarations(fbs, this.factoryFunctions,
this.data).initProtoChainRoots();
-            // }
-            InstructionList initMethod = new InstructionList();
-            initMethod.addInstruction(ABCConstants.OP_finddef, generateCSSStyleDeclarationsReference.getMName());
-            initMethod.addInstruction(ABCConstants.OP_getlocal1);
-            initMethod.addInstruction(ABCConstants.OP_getlocal0);
-            initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("factoryFunctions"));
-            initMethod.addInstruction(ABCConstants.OP_getlocal0);
-            initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("data"));
-            if (flexProject.getCSSManager().isFlex3CSS())
-                initMethod.addInstruction(ABCConstants.OP_pushtrue);
-            else
-                initMethod.addInstruction(ABCConstants.OP_pushfalse);
-            initMethod.addInstruction(ABCConstants.OP_callproperty, new Object[] {generateCSSStyleDeclarationsReference.getMName(),
4});
-            initMethod.addInstruction(ABCConstants.OP_callpropvoid, new Object[] {new Name("initProtoChainRoots"),
0});
-            initMethod.addInstruction(ABCConstants.OP_returnvoid);
-            classGenerator.addCTraitsMethod(new Name("init"), Collections.<Name> singleton(iModuleFactoryReference.getMName()),
-            new Name("void"), Collections.emptyList(), false, initMethod);
-
             classGenerator.finishScript();
 
             DoABCTag tag = new DoABCTag();
@@ -1347,6 +1325,8 @@ public class FlexAppSWFTarget extends Ap
             
             Name flexInitClassName = new Name(flexInitClassNameString);
             
+            Name stylesClassName = new Name(getStylesClassName());
+
             IDefinition objectDef = objectReference.resolve(flexProject);
             if ((objectDef == null) || (!(objectDef instanceof ClassDefinition)))
                 return false;
@@ -1592,6 +1572,7 @@ public class FlexAppSWFTarget extends Ap
             // register inheriting styles
             if (!inheritingStyleMap.isEmpty())
             {
+                initMethod.addInstruction(ABCConstants.OP_getlex, stylesClassName);
                 int count = 0;
                 for (Map.Entry<String, Boolean> styleEntry : inheritingStyleMap.entrySet())
                 {
@@ -1603,30 +1584,8 @@ public class FlexAppSWFTarget extends Ap
                 }
                 
                 initMethod.addInstruction(ABCConstants.OP_newarray, count);
-                initMethod.addInstruction(ABCConstants.OP_setlocal3);
-                
-                // has to be an int or verification of hasnext will fail.
-                initMethod.addInstruction(ABCConstants.OP_pushint, Integer.valueOf(0));
-                initMethod.addInstruction(ABCConstants.OP_setlocal0);
-                
-                Label loopTop = new Label();
-                initMethod.labelNext(loopTop);
-                initMethod.addInstruction(ABCConstants.OP_label);
-                initMethod.addInstruction(ABCConstants.OP_getlocal3);
-                initMethod.addInstruction(ABCConstants.OP_getlocal0);
-                initMethod.addInstruction(ABCConstants.OP_hasnext);
-                initMethod.addInstruction(ABCConstants.OP_setlocal0);
-                initMethod.addInstruction(ABCConstants.OP_getlocal0);
-                Label loopEnd = new Label();
-                initMethod.addInstruction(ABCConstants.OP_iffalse, loopEnd);
-                initMethod.addInstruction(ABCConstants.OP_getlocal2); // style manager
-                initMethod.addInstruction(ABCConstants.OP_getlocal3); // inheriting styles
array
-                initMethod.addInstruction(ABCConstants.OP_getlocal0); // index
-                initMethod.addInstruction(ABCConstants.OP_nextvalue); // next inheriting
style
-                Name registerInheritingStyle = new Name("registerInheritingStyle");
-                initMethod.addInstruction(ABCConstants.OP_callpropvoid, new Object[] { registerInheritingStyle,
1 });
-                initMethod.addInstruction(ABCConstants.OP_jump, loopTop);
-                initMethod.labelNext(loopEnd); 
+                initMethod.addInstruction(ABCConstants.OP_setproperty, new Name("inheritingStyles"));
+
             }
 
             initMethod.addInstruction(ABCConstants.OP_returnvoid);

Modified: incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java?rev=1415916&r1=1415915&r2=1415916&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
(original)
+++ incubator/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/targets/FlexTarget.java
Sat Dec  1 04:54:16 2012
@@ -374,13 +374,20 @@ public abstract class FlexTarget
             infoEntries++;            
         }
                
+        // styleDataClassName
+        if (stylesClassName != null)
+        {
+            info.addInstruction(ABCConstants.OP_pushstring, "styleDataClassName");
+            info.addInstruction(ABCConstants.OP_pushstring, stylesClassName);           

+            infoEntries++;            
+        }
+        
         // mixins:
-        if (flexInitClassName != null && stylesClassName != null)
+        if (flexInitClassName != null)
         {
             info.addInstruction(ABCConstants.OP_pushstring, "mixins");
             info.addInstruction(ABCConstants.OP_pushstring, flexInitClassName);
-            info.addInstruction(ABCConstants.OP_pushstring, stylesClassName);
-            int mixinEntries = 2;
+            int mixinEntries = 1;
             final Set<String> mixinClassNames = frame1Info.getMixins();
             for (String className : frame1Info.getMixins())
                 info.addInstruction(ABCConstants.OP_pushstring, className);



Mime
View raw message