We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile this to js
void main() { testValue([]); testValue(null); } List rslt = []; void testValue(List list) { if (list == null){ rslt.add(1); } if (list == null || list.contains("2")){ rslt.add(2); } if (list == null || list.contains("3")){ rslt.add(3); } }
dart2js result:
main: function() { G.testValue([]); G.testValue(null); }, testValue: function(list) { var t1 = list == null; if (t1) $.get$rslt().push(1); t1 = !t1; if (t1 || J.contains$1$as(list, "2")) $.get$rslt().push(2); if (t1 || J.contains$1$as(list, "3")) $.get$rslt().push(3); }
in the js code it adds a weird line: t1 = !t1, which cause run time error of calling a method of null
after removing that line in js code everything works correctly.
The text was updated successfully, but these errors were encountered:
Added Area-Dart2JS, Triaged labels.
Sorry, something went wrong.
Set owner to @floitschG. Removed Priority-Unassigned label. Added Priority-High label.
While trying to minimize I stumbled upon another (probably related) issue. The following code executes foo twice.
foo(x) { if (x != 0) return foo(x - 1); if (x == -1) return 499; print("foo"); return null; }
main() { var x = foo(9999); if (x == null || foo(4) == null) return 1; if (x == null || foo(5) == null) return 2; }
Removed Priority-High label. Added Priority-Critical label.
https://codereview.chromium.org/175403002/
Added Started label.
Fixed in r32951.
Added Fixed label.
floitschG
No branches or pull requests
compile this to js
void main() {
testValue([]);
testValue(null);
}
List rslt = [];
void testValue(List list) {
if (list == null){
rslt.add(1);
}
if (list == null || list.contains("2")){
rslt.add(2);
}
if (list == null || list.contains("3")){
rslt.add(3);
}
}
dart2js result:
main: function() {
G.testValue([]);
G.testValue(null);
},
testValue: function(list) {
var t1 = list == null;
if (t1)
$.get$rslt().push(1);
t1 = !t1;
if (t1 || J.contains$1$as(list, "2"))
$.get$rslt().push(2);
if (t1 || J.contains$1$as(list, "3"))
$.get$rslt().push(3);
}
in the js code it adds a weird line: t1 = !t1, which cause run time error of calling a method of null
after removing that line in js code everything works correctly.
The text was updated successfully, but these errors were encountered: