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

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

Issue 1483813002: Use const for const/final top-levels, types, symbols. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebased after vsm's regen 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 | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/DeltaBlue.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/js/builder.dart
diff --git a/lib/src/js/builder.dart b/lib/src/js/builder.dart
index 93d5c67711641631f5b5a4fbdcf9e1d675ca7c59..a01336ff88afe0499c01892f760a44c149c6d9b3 100644
--- a/lib/src/js/builder.dart
+++ b/lib/src/js/builder.dart
@@ -1176,7 +1176,7 @@ class MiniJsParser {
}
Expression parseVarDeclarationOrExpression() {
- var keyword = acceptVarOrLet();
+ var keyword = acceptVarLetOrConst();
if (keyword != null) {
return parseVariableDeclarationList(keyword);
} else {
@@ -1185,9 +1185,10 @@ class MiniJsParser {
}
/** Accepts a `var` or `let` keyword. If neither is found, returns null. */
- String acceptVarOrLet() {
+ String acceptVarLetOrConst() {
if (acceptString('var')) return 'var';
if (acceptString('let')) return 'let';
+ if (acceptString('const')) return 'const';
return null;
}
@@ -1246,7 +1247,7 @@ class MiniJsParser {
if (acceptString('try')) return parseTry();
- var keyword = acceptVarOrLet();
+ var keyword = acceptVarLetOrConst();
if (keyword != null) {
Expression declarations = parseVariableDeclarationList(keyword);
expectSemicolon();
@@ -1372,7 +1373,7 @@ class MiniJsParser {
return finishFor(null);
}
- var keyword = acceptVarOrLet();
+ var keyword = acceptVarLetOrConst();
if (keyword != null) {
String identifier = lastToken;
expectCategory(ALPHA);
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/DeltaBlue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698