| 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; |
| 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 Loading... |
| 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 } |
| OLD | NEW |