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

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

Issue 1182663008: Typecheck const classes in the context of the constructor call. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Constants computed for metadata. 112 // Constants computed for metadata.
113 final Map<MetadataAnnotation, ConstantExpression> metadataConstantMap = 113 final Map<MetadataAnnotation, ConstantExpression> metadataConstantMap =
114 new Map<MetadataAnnotation, ConstantExpression>(); 114 new Map<MetadataAnnotation, ConstantExpression>();
115 115
116 JavaScriptConstantCompiler(Compiler compiler) 116 JavaScriptConstantCompiler(Compiler compiler)
117 : super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM); 117 : super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM);
118 118
119 ConstantExpression compileVariableWithDefinitions(VariableElement element, 119 ConstantExpression compileVariableWithDefinitions(VariableElement element,
120 TreeElements definitions, 120 TreeElements definitions,
121 {bool isConst: false}) { 121 {bool isConst: false,
122 bool checkType: true}) {
122 if (!isConst && lazyStatics.contains(element)) { 123 if (!isConst && lazyStatics.contains(element)) {
123 return null; 124 return null;
124 } 125 }
125 ConstantExpression value = super.compileVariableWithDefinitions( 126 ConstantExpression value = super.compileVariableWithDefinitions(
126 element, definitions, isConst: isConst); 127 element, definitions, isConst: isConst, checkType: checkType);
127 if (!isConst && value == null) { 128 if (!isConst && value == null) {
128 lazyStatics.add(element); 129 lazyStatics.add(element);
129 } 130 }
130 return value; 131 return value;
131 } 132 }
132 133
133 void addCompileTimeConstantForEmission(ConstantValue constant) { 134 void addCompileTimeConstantForEmission(ConstantValue constant) {
134 compiledConstants.add(constant); 135 compiledConstants.add(constant);
135 } 136 }
136 137
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // TODO(ahe): This doesn't belong here. Rename this class and generalize. 281 // TODO(ahe): This doesn't belong here. Rename this class and generalize.
281 var closureClassMap = 282 var closureClassMap =
282 constants.compiler.closureToClassMapper.closureMappingCache 283 constants.compiler.closureToClassMapper.closureMappingCache
283 .remove(node); 284 .remove(node);
284 if (closureClassMap != null) { 285 if (closureClassMap != null) {
285 closureClassMap.removeMyselfFrom( 286 closureClassMap.removeMyselfFrom(
286 constants.compiler.enqueuer.codegen.universe); 287 constants.compiler.enqueuer.codegen.universe);
287 } 288 }
288 } 289 }
289 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698