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

Unified Diff: lib/src/js/nodes.dart

Issue 1090613006: fix #155, numeric integer literals (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months 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 | test/codegen/expect/misc.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/js/nodes.dart
diff --git a/lib/src/js/nodes.dart b/lib/src/js/nodes.dart
index 808ff3cdbf7a9447ca1b9454512f78a1ee621b57..6e80fb2fc7c719dc899cb262eeea3129d4c3e8ba 100644
--- a/lib/src/js/nodes.dart
+++ b/lib/src/js/nodes.dart
@@ -1091,6 +1091,12 @@ class LiteralNumber extends Literal {
accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this);
LiteralNumber _clone() => new LiteralNumber(value);
+
+ /**
+ * Use a different precedence level depending on whether the value contains a
+ * dot to ensure we generate `(1).toString()` and `1.0.toString()`.
+ */
+ int get precedenceLevel => value.contains('.') ? PRIMARY : UNARY;
}
class ArrayInitializer extends Expression {
« no previous file with comments | « no previous file | test/codegen/expect/misc.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698