You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/03/19 13:04:46 UTC
[4/8] git commit: [flex-falcon] [refs/heads/feature/maven-migration]
- apparently, parseInt in JS should always specify the radix
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/feature/maven-migration
Commit: 46d54f829d026f55359e652038d5135dd08378e4
Parents: aa6de08
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 15 10:22:29 2016 -0700
Committer: Alex Harui <ah...@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");
+ }
+ }
+ }
}
}