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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1642993003: Resynthesize untyped List / Map. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 6552face67c2e83941958b5171d1c9bb59beefe3..774393668bb071d631613c149270666e556332ac 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -263,6 +263,7 @@ class _ConstExprBuilder {
Expression get expr => stack.single;
Expression build() {
+ // TODO(scheglov) complete implementation
for (UnlinkedConstOperation operation in uc.operations) {
switch (operation) {
case UnlinkedConstOperation.pushNull:
@@ -392,10 +393,26 @@ class _ConstExprBuilder {
_push(AstFactory.methodInvocation(
null, 'identical', <Expression>[first, second]));
break;
- // TODO(scheglov) complete implementation
+ // untyped containers
case UnlinkedConstOperation.makeUntypedList:
- case UnlinkedConstOperation.makeTypedList:
+ int count = uc.ints[intPtr++];
+ List<Expression> elements = <Expression>[];
+ for (int i= 0; i < count; i++) {
+ elements.insert(0, _pop());
+ }
+ _push(AstFactory.listLiteral2(Keyword.CONST, null, elements));
+ break;
case UnlinkedConstOperation.makeUntypedMap:
+ int count = uc.ints[intPtr++];
+ List<MapLiteralEntry> entries = <MapLiteralEntry>[];
+ for (int i= 0; i < count; i++) {
+ Expression value = _pop();
+ Expression key = _pop();
+ entries.insert(0, AstFactory.mapLiteralEntry2(key, value));
+ }
+ _push(AstFactory.mapLiteral(Keyword.CONST, null, entries));
+ break;
+ case UnlinkedConstOperation.makeTypedList:
case UnlinkedConstOperation.makeTypedMap:
case UnlinkedConstOperation.pushReference:
case UnlinkedConstOperation.invokeConstructor:

Powered by Google App Engine
This is Rietveld 408576698