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

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

Issue 750323003: Remove js.ArrayElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 6 years 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/compiler/lib/src/js/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/builder.dart
diff --git a/pkg/compiler/lib/src/js/builder.dart b/pkg/compiler/lib/src/js/builder.dart
index ac63a56dd30cdf74f26fadf269aae7b7c73d3b4a..cb002da453ec3ba6f5df7faa7887cc8e5bbe5c30 100644
--- a/pkg/compiler/lib/src/js/builder.dart
+++ b/pkg/compiler/lib/src/js/builder.dart
@@ -328,10 +328,10 @@ class JsBuilder {
LiteralNumber number(num value) => new LiteralNumber('$value');
ArrayInitializer numArray(Iterable<int> list) =>
- new ArrayInitializer.from(list.map(number));
+ new ArrayInitializer(list.map(number).toList());
ArrayInitializer stringArray(Iterable<String> list) =>
- new ArrayInitializer.from(list.map(string));
+ new ArrayInitializer(list.map(string).toList());
Comment comment(String text) => new Comment(text);
@@ -727,14 +727,19 @@ class MiniJsParser {
} else if (acceptCategory(LBRACE)) {
return parseObjectInitializer();
} else if (acceptCategory(LSQUARE)) {
- var values = <ArrayElement>[];
- if (!acceptCategory(RSQUARE)) {
- do {
- values.add(new ArrayElement(values.length, parseAssignment()));
- } while (acceptCategory(COMMA));
- expectCategory(RSQUARE);
+ var values = <Expression>[];
+
+ while (true) {
+ if (acceptCategory(COMMA)) {
+ values.add(new ArrayHole());
+ continue;
+ }
+ if (acceptCategory(RSQUARE)) break;
+ values.add(parseAssignment());
+ if (acceptCategory(RSQUARE)) break;
+ expectCategory(COMMA);
}
- return new ArrayInitializer(values.length, values);
+ return new ArrayInitializer(values);
} else if (last != null && last.startsWith("/")) {
String regexp = getDelimited(lastPosition);
getToken();
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698