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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Identifiers, 10 Identifiers,
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 target: elements.getTargetDefinition(node), 1305 target: elements.getTargetDefinition(node),
1306 closureScope: getClosureScopeForNode(node)); 1306 closureScope: getClosureScopeForNode(node));
1307 } 1307 }
1308 1308
1309 /// If compiling with trusted type annotations, assumes that [value] is 1309 /// If compiling with trusted type annotations, assumes that [value] is
1310 /// now known to be `null` or an instance of [type]. 1310 /// now known to be `null` or an instance of [type].
1311 /// 1311 ///
1312 /// This is also where we should add type checks in checked mode, but this 1312 /// This is also where we should add type checks in checked mode, but this
1313 /// is not supported yet. 1313 /// is not supported yet.
1314 ir.Primitive checkType(ir.Primitive value, DartType dartType) { 1314 ir.Primitive checkType(ir.Primitive value, DartType dartType) {
1315 if (!compiler.trustTypeAnnotations) return value; 1315 if (!compiler.options.trustTypeAnnotations) return value;
1316 TypeMask type = typeMaskSystem.subtypesOf(dartType).nullable(); 1316 TypeMask type = typeMaskSystem.subtypesOf(dartType).nullable();
1317 return irBuilder.addPrimitive(new ir.Refinement(value, type)); 1317 return irBuilder.addPrimitive(new ir.Refinement(value, type));
1318 } 1318 }
1319 1319
1320 ir.Primitive checkTypeVsElement(ir.Primitive value, TypedElement element) { 1320 ir.Primitive checkTypeVsElement(ir.Primitive value, TypedElement element) {
1321 return checkType(value, element.type); 1321 return checkType(value, element.type);
1322 } 1322 }
1323 1323
1324 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { 1324 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) {
1325 assert(irBuilder.isOpen); 1325 assert(irBuilder.isOpen);
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 // Instead we return the result of visiting the CascadeReceiver. 1862 // Instead we return the result of visiting the CascadeReceiver.
1863 visit(node.expression); 1863 visit(node.expression);
1864 ir.Primitive receiver = _currentCascadeReceiver; 1864 ir.Primitive receiver = _currentCascadeReceiver;
1865 _currentCascadeReceiver = oldCascadeReceiver; 1865 _currentCascadeReceiver = oldCascadeReceiver;
1866 return receiver; 1866 return receiver;
1867 } 1867 }
1868 1868
1869 @override 1869 @override
1870 ir.Primitive visitAssert(ast.Assert node) { 1870 ir.Primitive visitAssert(ast.Assert node) {
1871 assert(irBuilder.isOpen); 1871 assert(irBuilder.isOpen);
1872 if (compiler.enableUserAssertions) { 1872 if (compiler.options.enableUserAssertions) {
1873 return giveup(node, 'assert in checked mode not implemented'); 1873 return giveup(node, 'assert in checked mode not implemented');
1874 } else { 1874 } else {
1875 // The call to assert and its argument expression must be ignored 1875 // The call to assert and its argument expression must be ignored
1876 // in production mode. 1876 // in production mode.
1877 // Assertions can only occur in expression statements, so no value needs 1877 // Assertions can only occur in expression statements, so no value needs
1878 // to be returned. 1878 // to be returned.
1879 return null; 1879 return null;
1880 } 1880 }
1881 } 1881 }
1882 1882
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 case 'JS_GET_FLAG': 3498 case 'JS_GET_FLAG':
3499 validateArgumentCount(exactly: 1); 3499 validateArgumentCount(exactly: 1);
3500 3500
3501 String name = expectStringConstant(argumentNodes.first); 3501 String name = expectStringConstant(argumentNodes.first);
3502 bool value = false; 3502 bool value = false;
3503 switch (name) { 3503 switch (name) {
3504 case 'MUST_RETAIN_METADATA': 3504 case 'MUST_RETAIN_METADATA':
3505 value = backend.mustRetainMetadata; 3505 value = backend.mustRetainMetadata;
3506 break; 3506 break;
3507 case 'USE_CONTENT_SECURITY_POLICY': 3507 case 'USE_CONTENT_SECURITY_POLICY':
3508 value = compiler.useContentSecurityPolicy; 3508 value = compiler.options.useContentSecurityPolicy;
3509 break; 3509 break;
3510 default: 3510 default:
3511 internalError(node, 'Unknown internal flag "$name".'); 3511 internalError(node, 'Unknown internal flag "$name".');
3512 } 3512 }
3513 return irBuilder.buildBooleanConstant(value); 3513 return irBuilder.buildBooleanConstant(value);
3514 3514
3515 case 'JS_STRING_CONCAT': 3515 case 'JS_STRING_CONCAT':
3516 validateArgumentCount(exactly: 2); 3516 validateArgumentCount(exactly: 2);
3517 List<ir.Primitive> arguments = argumentNodes.mapToList(visit); 3517 List<ir.Primitive> arguments = argumentNodes.mapToList(visit);
3518 return irBuilder.buildStringConcatenation(arguments, 3518 return irBuilder.buildStringConcatenation(arguments,
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
4240 4240
4241 Element get closureConverter { 4241 Element get closureConverter {
4242 return _backend.helpers.closureConverter; 4242 return _backend.helpers.closureConverter;
4243 } 4243 }
4244 4244
4245 void addNativeMethod(FunctionElement function) { 4245 void addNativeMethod(FunctionElement function) {
4246 _backend.emitter.nativeEmitter.nativeMethods.add(function); 4246 _backend.emitter.nativeEmitter.nativeMethods.add(function);
4247 } 4247 }
4248 4248
4249 bool get trustJSInteropTypeAnnotations => 4249 bool get trustJSInteropTypeAnnotations =>
4250 _compiler.trustJSInteropTypeAnnotations; 4250 _compiler.options.trustJSInteropTypeAnnotations;
4251 4251
4252 bool isNative(ClassElement element) => _backend.isNative(element); 4252 bool isNative(ClassElement element) => _backend.isNative(element);
4253 4253
4254 bool isJsInterop(FunctionElement element) => _backend.isJsInterop(element); 4254 bool isJsInterop(FunctionElement element) => _backend.isJsInterop(element);
4255 4255
4256 bool isJsInteropAnonymous(FunctionElement element) => 4256 bool isJsInteropAnonymous(FunctionElement element) =>
4257 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); 4257 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass);
4258 4258
4259 String getJsInteropTargetPath(FunctionElement element) { 4259 String getJsInteropTargetPath(FunctionElement element) {
4260 return '${_backend.namer.fixedBackendPath(element)}.' 4260 return '${_backend.namer.fixedBackendPath(element)}.'
4261 '${_backend.getFixedBackendName(element)}'; 4261 '${_backend.getFixedBackendName(element)}';
4262 } 4262 }
4263 4263
4264 DartType get jsJavascriptObjectType => 4264 DartType get jsJavascriptObjectType =>
4265 _backend.helpers.jsJavaScriptObjectClass.thisType; 4265 _backend.helpers.jsJavaScriptObjectClass.thisType;
4266 } 4266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698