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

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

Issue 2392943003: Handle const constructor invocation in kernel_impact. (Closed)
Patch Set: Updated cf. comments. 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(node.isConst
3892 ? new StaticUse.constConstructorInvoke(
3893 constructor.declaration, callStructure, type)
3894 : new StaticUse.typedConstructorInvoke(
3895 constructor.declaration, callStructure, type));
3894 InterfaceType interfaceType = type; 3896 InterfaceType interfaceType = type;
3895 if (interfaceType.typeArguments.any((DartType type) => !type.isDynamic)) { 3897 if (interfaceType.typeArguments.any((DartType type) => !type.isDynamic)) {
3896 registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); 3898 registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
3897 } 3899 }
3898 } 3900 }
3899 3901
3900 ResolutionResult resolutionResult = const NoneResult(); 3902 ResolutionResult resolutionResult = const NoneResult();
3901 if (node.isConst) { 3903 if (node.isConst) {
3902 bool isValidAsConstant = !isInvalid && constructor.isConst; 3904 bool isValidAsConstant = !isInvalid && constructor.isConst;
3903 3905
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 } 4742 }
4741 return const NoneResult(); 4743 return const NoneResult();
4742 } 4744 }
4743 } 4745 }
4744 4746
4745 /// Looks up [name] in [scope] and unwraps the result. 4747 /// Looks up [name] in [scope] and unwraps the result.
4746 Element lookupInScope( 4748 Element lookupInScope(
4747 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4749 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4748 return Elements.unwrap(scope.lookup(name), reporter, node); 4750 return Elements.unwrap(scope.lookup(name), reporter, node);
4749 } 4751 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/serialization/impact_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698