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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 22909056: Support general expressions as keys in literal maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 class JavaScriptItemCompilationContext extends ItemCompilationContext { 7 class JavaScriptItemCompilationContext extends ItemCompilationContext {
8 final Set<HInstruction> boundsChecked; 8 final Set<HInstruction> boundsChecked;
9 9
10 JavaScriptItemCompilationContext() 10 JavaScriptItemCompilationContext()
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 helpersUsed.add(cls.declaration); 1137 helpersUsed.add(cls.declaration);
1138 // Both declaration and implementation may declare fields, so we 1138 // Both declaration and implementation may declare fields, so we
1139 // add both to the list of helpers. 1139 // add both to the list of helpers.
1140 if (cls.declaration != cls.implementation) { 1140 if (cls.declaration != cls.implementation) {
1141 helpersUsed.add(cls.implementation); 1141 helpersUsed.add(cls.implementation);
1142 } 1142 }
1143 enqueuer.registerInstantiatedClass(cls, elements); 1143 enqueuer.registerInstantiatedClass(cls, elements);
1144 } 1144 }
1145 1145
1146 void registerConstantMap(TreeElements elements) { 1146 void registerConstantMap(TreeElements elements) {
1147 Element e = compiler.findHelper(const SourceString('ConstantMap')); 1147 void enqueue(SourceString name) {
1148 if (e != null) { 1148 Element e = compiler.findHelper(name);
1149 enqueueClass(compiler.enqueuer.resolution, e, elements); 1149 if (e != null) {
1150 enqueueClass(compiler.enqueuer.resolution, e, elements);
1151 }
1150 } 1152 }
1151 e = compiler.findHelper(const SourceString('ConstantProtoMap')); 1153
1152 if (e != null) { 1154 enqueue(MapConstant.DART_CLASS);
1153 enqueueClass(compiler.enqueuer.resolution, e, elements); 1155 enqueue(MapConstant.DART_PROTO_CLASS);
1154 } 1156 enqueue(MapConstant.DART_STRING_CLASS);
1157 enqueue(MapConstant.DART_GENERAL_CLASS);
1155 } 1158 }
1156 1159
1157 void codegen(CodegenWorkItem work) { 1160 void codegen(CodegenWorkItem work) {
1158 Element element = work.element; 1161 Element element = work.element;
1159 var kind = element.kind; 1162 var kind = element.kind;
1160 if (kind == ElementKind.TYPEDEF) return; 1163 if (kind == ElementKind.TYPEDEF) return;
1161 if (element.isConstructor() && element.getEnclosingClass() == jsNullClass) { 1164 if (element.isConstructor() && element.getEnclosingClass() == jsNullClass) {
1162 // Work around a problem compiling JSNull's constructor. 1165 // Work around a problem compiling JSNull's constructor.
1163 return; 1166 return;
1164 } 1167 }
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 copy(constant.values); 1785 copy(constant.values);
1783 copy(constant.protoValue); 1786 copy(constant.protoValue);
1784 copy(constant); 1787 copy(constant);
1785 } 1788 }
1786 1789
1787 void visitConstructed(ConstructedConstant constant) { 1790 void visitConstructed(ConstructedConstant constant) {
1788 copy(constant.fields); 1791 copy(constant.fields);
1789 copy(constant); 1792 copy(constant);
1790 } 1793 }
1791 } 1794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698