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

Side by Side Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « pkg/compiler/lib/src/common/tasks.dart ('k') | pkg/compiler/lib/src/compiler.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) 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 library dart2js.compile_time_constant_evaluator; 5 library dart2js.compile_time_constant_evaluator;
6 6
7 import 'common.dart'; 7 import 'common.dart';
8 import 'common/resolution.dart' show 8 import 'common/resolution.dart' show
9 Resolution; 9 Resolution;
10 import 'common/tasks.dart' show 10 import 'common/tasks.dart' show
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 Expression initializer = element.initializer; 237 Expression initializer = element.initializer;
238 ConstantExpression expression; 238 ConstantExpression expression;
239 if (initializer == null) { 239 if (initializer == null) {
240 // No initial value. 240 // No initial value.
241 expression = new NullConstantExpression(); 241 expression = new NullConstantExpression();
242 constantValueMap[expression] = constantSystem.createNull(); 242 constantValueMap[expression] = constantSystem.createNull();
243 } else { 243 } else {
244 expression = compileNodeWithDefinitions(initializer, definitions, 244 expression = compileNodeWithDefinitions(initializer, definitions,
245 isConst: isConst); 245 isConst: isConst);
246 if (compiler.enableTypeAssertions && 246 if (compiler.options.enableTypeAssertions &&
247 checkType && 247 checkType &&
248 expression != null && 248 expression != null &&
249 element.isField) { 249 element.isField) {
250 DartType elementType = element.type; 250 DartType elementType = element.type;
251 ConstantValue value = getConstantValue(expression); 251 ConstantValue value = getConstantValue(expression);
252 if (elementType.isMalformed && !value.isNull) { 252 if (elementType.isMalformed && !value.isNull) {
253 if (isConst) { 253 if (isConst) {
254 ErroneousElement element = elementType.element; 254 ErroneousElement element = elementType.element;
255 reporter.reportErrorMessage( 255 reporter.reportErrorMessage(
256 node, element.messageKind, element.messageArguments); 256 node, element.messageKind, element.messageArguments);
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 AstConstant constant = definitions[element]; 1072 AstConstant constant = definitions[element];
1073 if (constant == null) { 1073 if (constant == null) {
1074 reporter.internalError(send, "Local variable without value."); 1074 reporter.internalError(send, "Local variable without value.");
1075 } 1075 }
1076 return constant; 1076 return constant;
1077 } 1077 }
1078 return super.visitSend(send); 1078 return super.visitSend(send);
1079 } 1079 }
1080 1080
1081 void potentiallyCheckType(TypedElement element, AstConstant constant) { 1081 void potentiallyCheckType(TypedElement element, AstConstant constant) {
1082 if (compiler.enableTypeAssertions) { 1082 if (compiler.options.enableTypeAssertions) {
1083 DartType elementType = element.type.substByContext(constructedType); 1083 DartType elementType = element.type.substByContext(constructedType);
1084 DartType constantType = constant.value.getType(coreTypes); 1084 DartType constantType = constant.value.getType(coreTypes);
1085 if (!constantSystem.isSubtype( 1085 if (!constantSystem.isSubtype(
1086 compiler.types, constantType, elementType)) { 1086 compiler.types, constantType, elementType)) {
1087 reporter.withCurrentElement(constant.element, () { 1087 reporter.withCurrentElement(constant.element, () {
1088 reporter.reportErrorMessage( 1088 reporter.reportErrorMessage(
1089 constant.node, 1089 constant.node,
1090 MessageKind.NOT_ASSIGNABLE, 1090 MessageKind.NOT_ASSIGNABLE,
1091 {'fromType': constantType, 1091 {'fromType': constantType,
1092 'toType': elementType}); 1092 'toType': elementType});
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 class _CompilerEnvironment implements Environment { 1292 class _CompilerEnvironment implements Environment {
1293 final Compiler compiler; 1293 final Compiler compiler;
1294 1294
1295 _CompilerEnvironment(this.compiler); 1295 _CompilerEnvironment(this.compiler);
1296 1296
1297 @override 1297 @override
1298 String readFromEnvironment(String name) { 1298 String readFromEnvironment(String name) {
1299 return compiler.fromEnvironment(name); 1299 return compiler.fromEnvironment(name);
1300 } 1300 }
1301 } 1301 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/tasks.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698