[AC-4704] Strange issue when using "const" and conditional code
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2017-01-10T18:25:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Jérémy Tonneau |
Assignee | Shak Hossain |
Created | 2017-01-02T21:27:59.000+0000 |
Updated | 2017-01-10T18:25:36.000+0000 |
Description
Hello,
When I do something like that on an Android (note that this code shouldn't exists at all in "builded code") :
if(OS_IOS){
const test = 'my string';
}
I have this error:
[ERROR] : TiExceptionHandler: (main) [128,128] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [1,129] - In /app.js:60,10
[ERROR] : TiExceptionHandler: (main) [0,129] - Message: Uncaught SyntaxError: Missing initializer in const declaration
[ERROR] : TiExceptionHandler: (main) [0,129] - Source: const test;
[ERROR] : V8Exception: Exception occurred at /app.js:60: Uncaught SyntaxError: Missing initializer in const declaration
And when I go the the "builded" file I have something like that :
const test;
Which is not good because "const" need to been initialized ... And also not good because const is block scoped !
Hello, I can't reproduce the issue with the below code. In Android I don't run into any error.
Can you provide a full sample code to reproduce. I am testing on SDK 6.0.1.GA. Thanks.