[dartdevc] fix js_ast comma expression not generating parentheses

This happened because for-of printed using EXPRESSION precedence
for the iteration expression, but it should be ASSIGNMENT per the spec
(https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements).

Change-Id: I869ad3f1181cfb33c57fe79aebfa3699f66a0712
Reviewed-on: https://dart-review.googlesource.com/c/84833
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jenny Messerly <jmesserly@google.com>
This commit is contained in:
Jenny Messerly
2018-11-20 22:56:35 +00:00
committed by commit-bot@chromium.org
parent c165ef8a37
commit 751d7ad2e2
3 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -402,7 +402,7 @@ class Printer implements NodeVisitor {
newInForInit: true, newAtStatementBegin: false);
out(" of");
pendingSpace = true;
visitNestedExpression(loop.iterable, EXPRESSION,
visitNestedExpression(loop.iterable, ASSIGNMENT,
newInForInit: false, newAtStatementBegin: false);
out(")");
blockBody(loop.body, needsSeparation: false, needsNewline: true);
+8
View File
@@ -29,6 +29,14 @@ main() {
Expect.equals(b, b.path1[2]);
Expect.equals(2, b.path2.length); // NPE.
// Regression test for dartdevc comma expressions (js_ast printer did not
// generate parentheses around the comma expression).
var expectedList = [3, 2, 1];
for (var actual in expectedList.toList()..sort()) {
Expect.equals(
expectedList.removeLast(), actual, "list items should be sorted");
}
}
class Element {
+1 -6
View File
@@ -9,10 +9,6 @@ html/xhr_test: Pass, Slow
[ $compiler == dartdevk ]
async/slow_consumer_test: CompileTimeError
convert/chunked_conversion_utf82_test: RuntimeError
convert/chunked_conversion_utf86_test: RuntimeError
convert/chunked_conversion_utf87_test: RuntimeError
convert/utf82_test: RuntimeError
html/debugger_test: CompileTimeError
[ $runtime == chrome && ($compiler == dartdevc || $compiler == dartdevk) ]
@@ -43,8 +39,7 @@ convert/base64_test/01: Fail, OK # Uses bit-wise operations to detect invalid va
convert/chunked_conversion_utf88_test: Slow, Pass
convert/json_utf8_chunk_test: Slow, Pass
convert/streamed_conversion_json_utf8_encode_test: Pass, Timeout # Issue 29922
convert/streamed_conversion_utf8_decode_test: Slow, Pass
convert/streamed_conversion_utf8_encode_test: Pass, Timeout # Issue 29922
convert/streamed_conversion_utf8_decode_test: Slow, Pass, Timeout # Issue 29922
convert/utf85_test: Slow, Pass
html/async_spawnuri_test: RuntimeError # Issue 29922
html/async_test: RuntimeError # Issue 29922