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

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

Issue 1336303002: Avoid creating ConstructedConstantExpression for deferred constant. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 5 years, 3 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 | « no previous file | no next file » | 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.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common/names.dart' show 7 import '../common/names.dart' show
8 Selectors; 8 Selectors;
9 import '../compiler.dart' show 9 import '../compiler.dart' show
10 Compiler; 10 Compiler;
(...skipping 3875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 node.newToken, MessageKind.NON_CONST_BLOAT, 3886 node.newToken, MessageKind.NON_CONST_BLOAT,
3887 {'name': compiler.symbolClass.name}); 3887 {'name': compiler.symbolClass.name});
3888 } 3888 }
3889 registry.registerNewSymbol(); 3889 registry.registerNewSymbol();
3890 } 3890 }
3891 } else if (isMirrorsUsedConstant) { 3891 } else if (isMirrorsUsedConstant) {
3892 compiler.mirrorUsageAnalyzerTask.validate(node, registry.mapping); 3892 compiler.mirrorUsageAnalyzerTask.validate(node, registry.mapping);
3893 } 3893 }
3894 if (node.isConst) { 3894 if (node.isConst) {
3895 analyzeConstantDeferred(node); 3895 analyzeConstantDeferred(node);
3896
3897 // TODO(johnniwinther): Compute this in the [ConstructorResolver].
3898 // Check that the constructor is not deferred.
3899 Send send = node.send.selector.asSend();
3900 if (send != null) {
3901 // Of the form `const a.b(...)`.
3902 if (compiler.deferredLoadTask.deferredPrefixElement(
3903 send, registry.mapping) != null) {
3904 // `a` is a deferred prefix.
3905 isValidAsConstant = false;
3906 // TODO(johnniwinther): Create an [ErroneousConstantExpression] here
3907 // when constants are only created during resolution.
3908 }
3909 }
3910
3896 if (isValidAsConstant && 3911 if (isValidAsConstant &&
3897 constructor.isConst && 3912 constructor.isConst &&
3898 argumentsResult.isValidAsConstant) { 3913 argumentsResult.isValidAsConstant) {
3899 CallStructure callStructure = argumentsResult.callStructure; 3914 CallStructure callStructure = argumentsResult.callStructure;
3900 List<ConstantExpression> arguments = argumentsResult.constantArguments; 3915 List<ConstantExpression> arguments = argumentsResult.constantArguments;
3901 ConstructedConstantExpression constant = 3916 ConstructedConstantExpression constant =
3902 new ConstructedConstantExpression( 3917 new ConstructedConstantExpression(
3903 type, 3918 type,
3904 constructor, 3919 constructor,
3905 callStructure, 3920 callStructure,
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 } 4664 }
4650 return const NoneResult(); 4665 return const NoneResult();
4651 } 4666 }
4652 } 4667 }
4653 4668
4654 /// Looks up [name] in [scope] and unwraps the result. 4669 /// Looks up [name] in [scope] and unwraps the result.
4655 Element lookupInScope(Compiler compiler, Node node, 4670 Element lookupInScope(Compiler compiler, Node node,
4656 Scope scope, String name) { 4671 Scope scope, String name) {
4657 return Elements.unwrap(scope.lookup(name), compiler, node); 4672 return Elements.unwrap(scope.lookup(name), compiler, node);
4658 } 4673 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698