Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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; | |
|
sigurdm
2015/09/14 12:36:43
Explain why this is ok
Johnni Winther
2015/09/14 13:51:56
Done.
| |
| 3906 } | |
| 3907 } | |
| 3908 | |
| 3896 if (isValidAsConstant && | 3909 if (isValidAsConstant && |
| 3897 constructor.isConst && | 3910 constructor.isConst && |
| 3898 argumentsResult.isValidAsConstant) { | 3911 argumentsResult.isValidAsConstant) { |
| 3899 CallStructure callStructure = argumentsResult.callStructure; | 3912 CallStructure callStructure = argumentsResult.callStructure; |
| 3900 List<ConstantExpression> arguments = argumentsResult.constantArguments; | 3913 List<ConstantExpression> arguments = argumentsResult.constantArguments; |
| 3901 ConstructedConstantExpression constant = | 3914 ConstructedConstantExpression constant = |
| 3902 new ConstructedConstantExpression( | 3915 new ConstructedConstantExpression( |
| 3903 type, | 3916 type, |
| 3904 constructor, | 3917 constructor, |
| 3905 callStructure, | 3918 callStructure, |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4649 } | 4662 } |
| 4650 return const NoneResult(); | 4663 return const NoneResult(); |
| 4651 } | 4664 } |
| 4652 } | 4665 } |
| 4653 | 4666 |
| 4654 /// Looks up [name] in [scope] and unwraps the result. | 4667 /// Looks up [name] in [scope] and unwraps the result. |
| 4655 Element lookupInScope(Compiler compiler, Node node, | 4668 Element lookupInScope(Compiler compiler, Node node, |
| 4656 Scope scope, String name) { | 4669 Scope scope, String name) { |
| 4657 return Elements.unwrap(scope.lookup(name), compiler, node); | 4670 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4658 } | 4671 } |
| OLD | NEW |