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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart

Issue 1121233002: Add ConstantExpression.evaluate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 5 years, 7 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// [ConstantCompilerTask] for compilation of constants for the JavaScript 7 /// [ConstantCompilerTask] for compilation of constants for the JavaScript
8 /// backend. 8 /// backend.
9 /// 9 ///
10 /// Since this task needs to distinguish between frontend and backend constants 10 /// Since this task needs to distinguish between frontend and backend constants
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 ConstantExpression compileMetadata(MetadataAnnotation metadata, 197 ConstantExpression compileMetadata(MetadataAnnotation metadata,
198 Node node, 198 Node node,
199 TreeElements elements) { 199 TreeElements elements) {
200 ConstantExpression constant = 200 ConstantExpression constant =
201 super.compileMetadata(metadata, node, elements); 201 super.compileMetadata(metadata, node, elements);
202 metadataConstantMap[metadata] = constant; 202 metadataConstantMap[metadata] = constant;
203 return constant; 203 return constant;
204 } 204 }
205 205
206 ConstantExpression createTypeConstant(TypeDeclarationElement element) {
207 DartType elementType = element.rawType;
208 DartType constantType =
209 compiler.backend.typeImplementation.computeType(compiler);
210 return new TypeConstantExpression(
211 new TypeConstantValue(elementType, constantType), elementType);
212 }
213
214 void forgetElement(Element element) { 206 void forgetElement(Element element) {
215 super.forgetElement(element); 207 super.forgetElement(element);
216 const ForgetConstantElementVisitor().visit(element, this); 208 const ForgetConstantElementVisitor().visit(element, this);
217 if (element is AstElement && element.hasNode) { 209 if (element is AstElement && element.hasNode) {
218 element.node.accept(new ForgetConstantNodeVisitor(this)); 210 element.node.accept(new ForgetConstantNodeVisitor(this));
219 } 211 }
220 } 212 }
221 } 213 }
222 214
223 class ForgetConstantElementVisitor 215 class ForgetConstantElementVisitor
(...skipping 30 matching lines...) Expand all
254 // TODO(ahe): This doesn't belong here. Rename this class and generalize. 246 // TODO(ahe): This doesn't belong here. Rename this class and generalize.
255 var closureClassMap = 247 var closureClassMap =
256 constants.compiler.closureToClassMapper.closureMappingCache 248 constants.compiler.closureToClassMapper.closureMappingCache
257 .remove(node); 249 .remove(node);
258 if (closureClassMap != null) { 250 if (closureClassMap != null) {
259 closureClassMap.removeMyselfFrom( 251 closureClassMap.removeMyselfFrom(
260 constants.compiler.enqueuer.codegen.universe); 252 constants.compiler.enqueuer.codegen.universe);
261 } 253 }
262 } 254 }
263 } 255 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/core_types.dart ('k') | pkg/compiler/lib/src/js_backend/constant_system_javascript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698