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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: turn warning into a hint Created 3 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) 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 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 if (globalInferenceResults.isFixedArrayCheckedForGrowable(send)) { 3490 if (globalInferenceResults.isFixedArrayCheckedForGrowable(send)) {
3491 js.Template code = js.js.parseForeignJS(r'#.fixed$length = Array'); 3491 js.Template code = js.js.parseForeignJS(r'#.fixed$length = Array');
3492 // We set the instruction as [canThrow] to avoid it being dead code. 3492 // We set the instruction as [canThrow] to avoid it being dead code.
3493 // We need a finer grained side effect. 3493 // We need a finer grained side effect.
3494 add(new HForeignCode(code, commonMasks.nullType, [stack.last], 3494 add(new HForeignCode(code, commonMasks.nullType, [stack.last],
3495 throwBehavior: native.NativeThrowBehavior.MAY)); 3495 throwBehavior: native.NativeThrowBehavior.MAY));
3496 } 3496 }
3497 } else if (isGrowableListConstructorCall) { 3497 } else if (isGrowableListConstructorCall) {
3498 push(buildLiteralList(<HInstruction>[])); 3498 push(buildLiteralList(<HInstruction>[]));
3499 stack.last.instructionType = elementType; 3499 stack.last.instructionType = elementType;
3500 } else if (constructor.isExternal &&
3501 constructor.isFromEnvironmentConstructor) {
3502 generateUnsupportedError(
3503 node,
3504 '${cls.name}.${constructor.name} '
3505 'can only be used as a const constructor');
3500 } else { 3506 } else {
3501 SourceInformation sourceInformation = 3507 SourceInformation sourceInformation =
3502 sourceInformationBuilder.buildNew(send); 3508 sourceInformationBuilder.buildNew(send);
3503 potentiallyAddTypeArguments(inputs, cls, expectedType); 3509 potentiallyAddTypeArguments(inputs, cls, expectedType);
3504 addInlinedInstantiation(expectedType); 3510 addInlinedInstantiation(expectedType);
3505 pushInvokeStatic(node, constructor.declaration, inputs, 3511 pushInvokeStatic(node, constructor.declaration, inputs,
3506 typeMask: elementType, 3512 typeMask: elementType,
3507 instanceType: expectedType, 3513 instanceType: expectedType,
3508 sourceInformation: sourceInformation); 3514 sourceInformation: sourceInformation);
3509 removeInlinedInstantiation(expectedType); 3515 removeInlinedInstantiation(expectedType);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 void generateError(ast.Node node, String message, Element helper) { 3861 void generateError(ast.Node node, String message, Element helper) {
3856 HInstruction errorMessage = addConstantString(message); 3862 HInstruction errorMessage = addConstantString(message);
3857 pushInvokeStatic(node, helper, [errorMessage]); 3863 pushInvokeStatic(node, helper, [errorMessage]);
3858 } 3864 }
3859 3865
3860 void generateRuntimeError(ast.Node node, String message) { 3866 void generateRuntimeError(ast.Node node, String message) {
3861 MethodElement helper = commonElements.throwRuntimeError; 3867 MethodElement helper = commonElements.throwRuntimeError;
3862 generateError(node, message, helper); 3868 generateError(node, message, helper);
3863 } 3869 }
3864 3870
3871 void generateUnsupportedError(ast.Node node, String message) {
3872 MethodElement helper = commonElements.throwUnsupportedError;
3873 generateError(node, message, helper);
3874 }
3875
3865 void generateTypeError(ast.Node node, String message) { 3876 void generateTypeError(ast.Node node, String message) {
3866 MethodElement helper = commonElements.throwTypeError; 3877 MethodElement helper = commonElements.throwTypeError;
3867 generateError(node, message, helper); 3878 generateError(node, message, helper);
3868 } 3879 }
3869 3880
3870 void generateAbstractClassInstantiationError(ast.Node node, String message) { 3881 void generateAbstractClassInstantiationError(ast.Node node, String message) {
3871 MethodElement helper = commonElements.throwAbstractClassInstantiationError; 3882 MethodElement helper = commonElements.throwAbstractClassInstantiationError;
3872 generateError(node, message, helper); 3883 generateError(node, message, helper);
3873 } 3884 }
3874 3885
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after
6803 this.oldReturnLocal, 6814 this.oldReturnLocal,
6804 this.oldReturnType, 6815 this.oldReturnType,
6805 this.oldResolvedAst, 6816 this.oldResolvedAst,
6806 this.oldStack, 6817 this.oldStack,
6807 this.oldLocalsHandler, 6818 this.oldLocalsHandler,
6808 this.inTryStatement, 6819 this.inTryStatement,
6809 this.allFunctionsCalledOnce, 6820 this.allFunctionsCalledOnce,
6810 this.oldElementInferenceResults) 6821 this.oldElementInferenceResults)
6811 : super(function); 6822 : super(function);
6812 } 6823 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698