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

Side by Side Diff: pkg/compiler/lib/src/kernel/kernel_visitor.dart

Issue 2335203005: kernel -> ssa: implement literal maps (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 import 'package:kernel/frontend/accessors.dart' 6 import 'package:kernel/frontend/accessors.dart'
7 show 7 show
8 Accessor, 8 Accessor,
9 IndexAccessor, 9 IndexAccessor,
10 NullAwarePropertyAccessor, 10 NullAwarePropertyAccessor,
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 @override 872 @override
873 ir.MapLiteral visitLiteralMap(LiteralMap node) { 873 ir.MapLiteral visitLiteralMap(LiteralMap node) {
874 // TODO(ahe): Type arguments. 874 // TODO(ahe): Type arguments.
875 List<ir.MapEntry> entries = <ir.MapEntry>[]; 875 List<ir.MapEntry> entries = <ir.MapEntry>[];
876 for (LiteralMapEntry entry in node.entries.nodes) { 876 for (LiteralMapEntry entry in node.entries.nodes) {
877 entries.add(new ir.MapEntry( 877 entries.add(new ir.MapEntry(
878 visitForValue(entry.key), visitForValue(entry.value))); 878 visitForValue(entry.key), visitForValue(entry.value)));
879 } 879 }
880 List<ir.DartType> typeArguments = 880 List<ir.DartType> typeArguments =
881 computeTypesFromTypes(node.typeArguments, expected: 2); 881 computeTypesFromTypes(node.typeArguments, expected: 2);
882 return new ir.MapLiteral(entries, 882 return associateNode(
883 keyType: typeArguments.first, 883 new ir.MapLiteral(entries,
884 valueType: typeArguments.last, 884 keyType: typeArguments.first,
885 // TODO(ahe): Should Constness be validated? 885 valueType: typeArguments.last,
886 isConst: node.isConst); 886 // TODO(ahe): Should Constness be validated?
887 isConst: node.isConst),
888 node);
887 } 889 }
888 890
889 @override 891 @override
890 visitLiteralMapEntry(LiteralMapEntry node) { 892 visitLiteralMapEntry(LiteralMapEntry node) {
891 // Shouldn't be called. Handled by [visitLiteralMap]. 893 // Shouldn't be called. Handled by [visitLiteralMap].
892 return internalError(node, "LiteralMapEntry"); 894 return internalError(node, "LiteralMapEntry");
893 } 895 }
894 896
895 @override 897 @override
896 ir.NullLiteral visitLiteralNull(LiteralNull node) { 898 ir.NullLiteral visitLiteralNull(LiteralNull node) {
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 : this(null, true, node, initializers); 2752 : this(null, true, node, initializers);
2751 2753
2752 accept(ir.Visitor v) => throw "unsupported"; 2754 accept(ir.Visitor v) => throw "unsupported";
2753 2755
2754 visitChildren(ir.Visitor v) => throw "unsupported"; 2756 visitChildren(ir.Visitor v) => throw "unsupported";
2755 2757
2756 String toString() { 2758 String toString() {
2757 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 2759 return "IrFunction($kind, $isConstructor, $node, $initializers)";
2758 } 2760 }
2759 } 2761 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698