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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2392943003: Handle const constructor invocation in kernel_impact. (Closed)
Patch Set: Created 4 years, 2 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 library dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compile_time_constants.dart'; 10 import '../compile_time_constants.dart';
(...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after
3879 ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, 3879 ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR,
3880 constructor, 3880 constructor,
3881 type), 3881 type),
3882 selector)); 3882 selector));
3883 return new ResolutionResult.forElement(constructor); 3883 return new ResolutionResult.forElement(constructor);
3884 } 3884 }
3885 3885
3886 if (!isInvalid) { 3886 if (!isInvalid) {
3887 // [constructor] might be the implementation element 3887 // [constructor] might be the implementation element
3888 // and only declaration elements may be registered. 3888 // and only declaration elements may be registered.
3889 registry.registerStaticUse(new StaticUse.constructorInvoke(
3890 constructor.declaration, callStructure));
3891 // TODO(johniwinther): Avoid registration of `type` in face of redirecting 3889 // TODO(johniwinther): Avoid registration of `type` in face of redirecting
3892 // factory constructors. 3890 // factory constructors.
3893 registry.registerTypeUse(new TypeUse.instantiation(type)); 3891 registry.registerStaticUse(
3892 node.isConst
3893 ? new StaticUse.constConstructorInvoke(
Harry Terkelsen 2016/10/07 15:53:21 this is the output of dartfmt? looks weird
Johnni Winther 2016/10/10 09:58:12 No. Forgot to dartfmt this CL.
3894 constructor.declaration, callStructure, type)
3895 : new StaticUse.typedConstructorInvoke(
3896 constructor.declaration, callStructure, type));
3894 InterfaceType interfaceType = type; 3897 InterfaceType interfaceType = type;
3895 if (interfaceType.typeArguments.any((DartType type) => !type.isDynamic)) { 3898 if (interfaceType.typeArguments.any((DartType type) => !type.isDynamic)) {
3896 registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); 3899 registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
3897 } 3900 }
3898 } 3901 }
3899 3902
3900 ResolutionResult resolutionResult = const NoneResult(); 3903 ResolutionResult resolutionResult = const NoneResult();
3901 if (node.isConst) { 3904 if (node.isConst) {
3902 bool isValidAsConstant = !isInvalid && constructor.isConst; 3905 bool isValidAsConstant = !isInvalid && constructor.isConst;
3903 3906
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 } 4743 }
4741 return const NoneResult(); 4744 return const NoneResult();
4742 } 4745 }
4743 } 4746 }
4744 4747
4745 /// Looks up [name] in [scope] and unwraps the result. 4748 /// Looks up [name] in [scope] and unwraps the result.
4746 Element lookupInScope( 4749 Element lookupInScope(
4747 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4750 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4748 return Elements.unwrap(scope.lookup(name), reporter, node); 4751 return Elements.unwrap(scope.lookup(name), reporter, node);
4749 } 4752 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698