> > apparently, parseInt in JS should always specify the radix
I don't think that is the case. ParseInt does this by default [1] : If the radix parameter is omitted, JavaScript assumes the following: - If the string begins with "0x", the radix is 16 (hexadecimal) - If the string begins with "0", the radix is 8 (octal). This feature is deprecated - If the string begins with any other value, the radix is 10 (decimal) [1] http://www.w3schools.com/jsref/jsref_parseint.asp On Tue, Mar 15, 2016 at 10:22 AM, <aha...@apache.org> wrote: > 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 <aha...@apache.org> > Authored: Tue Mar 15 10:22:29 2016 -0700 > Committer: Alex Harui <aha...@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"); > + } > + } > + } > } > } > > >