Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Unified Diff: pkg/js_ast/lib/src/nodes.dart

Issue 1438633002: js_ast: Avoid precedence issue with negative numbers as receivers at calls (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/js_ast/lib/src/nodes.dart
diff --git a/pkg/js_ast/lib/src/nodes.dart b/pkg/js_ast/lib/src/nodes.dart
index 95c8819f1c88e971b501c6685c347c74398fdfba..b6d11aa9988096635af8327233c25e91f0540cf7 100644
--- a/pkg/js_ast/lib/src/nodes.dart
+++ b/pkg/js_ast/lib/src/nodes.dart
@@ -985,7 +985,7 @@ abstract class DeferredNumber extends DeferredToken implements Literal {
int get value;
- int get precedenceLevel => PRIMARY;
+ int get precedenceLevel => value.isNegative ? UNARY : PRIMARY;
}
/// Interace for a deferred string value. An implementation has to provide
@@ -1074,6 +1074,8 @@ class LiteralNumber extends Literal {
LiteralNumber(this.value);
+ int get precedenceLevel => value.startsWith('-') ? UNARY : PRIMARY;
+
accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this);
LiteralNumber _clone() => new LiteralNumber(value);
}
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698