flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [09/18] git commit: [flex-falcon] [refs/heads/develop] - make sure backing vars have '_'
Date Wed, 08 Apr 2015 23:05:15 GMT
make sure backing vars have '_'


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

Branch: refs/heads/develop
Commit: 01fc34f430794b84152da117928a93dab8fd5ddf
Parents: 57161bd
Author: Alex Harui <aharui@apache.org>
Authored: Sat Mar 28 07:13:08 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Mar 28 07:13:08 2015 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 66 ++++++++++++--------
 1 file changed, 41 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/01fc34f4/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 71667b8..ef8ccfc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -447,7 +447,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             writeNewline(" */");
             write(ASEmitterTokens.THIS);
             write(ASEmitterTokens.MEMBER_ACCESS);
-            write(instance.id);
+            write(instance.id + "_");
             writeNewline(ASEmitterTokens.SEMICOLON);
         }
     }
@@ -835,46 +835,62 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
     protected void emitPropertyGetterSetters(String cname)
     {
+    	int n = 0;
+        for (MXMLDescriptorSpecifier instance : instances)
+        {
+            if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
+                    .getToken()))
+            {
+            	n++;
+            }
+        }
+    	if (n == 0)
+    		return;
+    	
+    	String formattedCName = formatQualifiedName(cname);
+    	
+    	write("Object.defineProperties(");
+    	write(formattedCName);
+    	writeNewline(".prototype, {");
+        indentPush();
+        int i = 0;
         for (MXMLDescriptorSpecifier instance : instances)
         {
             if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
                     .getToken()))
             {
-                writeNewline("/**");
-                writeNewline(" * @expose");
-                writeNewline(" * @return {" + instance.name + "}");
-                writeNewline(" */");
-                writeNewline(formatQualifiedName(cname)
-                        + ".prototype.get_" + instance.id + " = function()");
                 indentPush();
-                writeNewline("{");
+                writeNewline("'" + instance.id + "': {");
+                writeNewline("/** @this {" + formattedCName + "} */");
+                indentPush();
+                writeNewline("get: function() {");
                 indentPop();
-                writeNewline("return this." + instance.id + ";");
-                writeNewline("};");
-                writeNewline();
-                writeNewline();
-                writeNewline("/**");
-                writeNewline(" * @expose");
-                writeNewline(" * @param {" + instance.name + "} value");
-                writeNewline(" */");
-                writeNewline(formatQualifiedName(cname)
-                        + ".prototype.set_" + instance.id
-                        + " = function(value)");
+                writeNewline("return this." + instance.id + "_;");
+                writeNewline("},");
+                writeNewline("/** @this {" + formattedCName + "} */");
                 indentPush();
-                writeNewline("{");
+                writeNewline("set: function(value) {");
                 indentPush();
-                writeNewline("if (value != this." + instance.id + ") {");
-                writeNewline("this." + instance.id + " = value;");
+                writeNewline("if (value != this." + instance.id + "_) {");
+                writeNewline("this." + instance.id + "_ = value;");
                 write("this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this,
'");
                 indentPop();
                 writeNewline(instance.id + "', null, value));");
                 indentPop();
                 writeNewline("}");
-                writeNewline("};");
-                writeNewline();
-                writeNewline();
+                indentPop();
+                writeNewline("}");
+                if (i < n - 1)
+                	writeNewline("},");
+                else
+                {
+                    indentPop();
+                    writeNewline("}");
+                }
+                i++;
             }
         }
+        writeNewline("});");
     }
 
     //--------------------------------------------------------------------------    


Mime
View raw message