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] - apparently, parseInt in JS should always specify the radix
Date Tue, 15 Mar 2016 17:22:48 GMT
apparently, parseInt in JS should always specify the radix


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

Branch: refs/heads/develop
Commit: 46d54f829d026f55359e652038d5135dd08378e4
Parents: aa6de08
Author: Alex Harui <aharui@apache.org>
Authored: Tue Mar 15 10:22:29 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Mar 15 10:22:29 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSGlobalFunctions.java | 15 +++++++++++++++
 .../internal/codegen/js/flexjs/JSFlexJSEmitter.java  | 11 +++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/46d54f82/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
index aaa9c92..f1be070 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
@@ -90,6 +90,21 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
         assertOut("var /** @type {Array} */ a = Array(['Hello', 'World'])");
     }
 
+    @Test
+    public void testParseInt()
+    {
+        IVariableNode node = getVariable("var a:int = parseInt('1.8');");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ a = parseInt('1.8', 10)");
+    }
+
+    @Test
+    public void testParseIntTwoArgs()
+    {
+        IVariableNode node = getVariable("var a:int = parseInt('1.8', 16);");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ a = parseInt('1.8', 16)");
+    }
 
     @Override
     @Test

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/46d54f82/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index d4325a7..c4c72da 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -573,6 +573,17 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             		}
     			}
     		}
+        	else if (def != null && def.getBaseName().equals("parseInt"))
+        	{
+        		IDefinition parentDef = def.getParent();
+        		if (parentDef == null)
+        		{
+            		if (nameNode instanceof IdentifierNode)
+            		{
+            			write(", 10");
+            		}
+    			}
+    		}
     	}
     }
 


Mime
View raw message