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 'package:front_end/src/fasta/scanner.dart' show isUserDefinableOperator; | 7 import 'package:front_end/src/fasta/scanner.dart' show isUserDefinableOperator; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Selectors; | 10 import '../common/names.dart' show Selectors; |
(...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3844 ConstructorResult result = resolveConstructor(node); | 3844 ConstructorResult result = resolveConstructor(node); |
3845 ConstructorElement constructor = result.element; | 3845 ConstructorElement constructor = result.element; |
3846 if (resolution.commonElements.isSymbolConstructor(constructor)) { | 3846 if (resolution.commonElements.isSymbolConstructor(constructor)) { |
3847 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR); | 3847 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR); |
3848 } | 3848 } |
3849 ArgumentsResult argumentsResult; | 3849 ArgumentsResult argumentsResult; |
3850 if (node.isConst) { | 3850 if (node.isConst) { |
3851 argumentsResult = | 3851 argumentsResult = |
3852 inConstantContext(() => resolveArguments(node.send.argumentsNode)); | 3852 inConstantContext(() => resolveArguments(node.send.argumentsNode)); |
3853 } else { | 3853 } else { |
| 3854 if (!node.isConst && constructor.isFromEnvironmentConstructor) { |
| 3855 // TODO(sigmund): consider turning this into a compile-time-error. |
| 3856 reporter.reportHintMessage( |
| 3857 node, |
| 3858 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST, |
| 3859 {'className': constructor.enclosingClass.name}); |
| 3860 registry.registerFeature(Feature.THROW_UNSUPPORTED_ERROR); |
| 3861 } |
3854 argumentsResult = resolveArguments(node.send.argumentsNode); | 3862 argumentsResult = resolveArguments(node.send.argumentsNode); |
3855 } | 3863 } |
3856 // TODO(johnniwinther): Avoid the need for a [Selector]. | 3864 // TODO(johnniwinther): Avoid the need for a [Selector]. |
3857 Selector selector = resolveSelector(node.send, constructor); | 3865 Selector selector = resolveSelector(node.send, constructor); |
3858 CallStructure callStructure = selector.callStructure; | 3866 CallStructure callStructure = selector.callStructure; |
3859 registry.useElement(node.send, constructor); | 3867 registry.useElement(node.send, constructor); |
3860 | 3868 |
3861 ResolutionDartType type = result.type; | 3869 ResolutionDartType type = result.type; |
3862 ConstructorAccessKind kind; | 3870 ConstructorAccessKind kind; |
3863 bool isInvalid = false; | 3871 bool isInvalid = false; |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4803 } | 4811 } |
4804 return const NoneResult(); | 4812 return const NoneResult(); |
4805 } | 4813 } |
4806 } | 4814 } |
4807 | 4815 |
4808 /// Looks up [name] in [scope] and unwraps the result. | 4816 /// Looks up [name] in [scope] and unwraps the result. |
4809 Element lookupInScope( | 4817 Element lookupInScope( |
4810 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4818 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
4811 return Elements.unwrap(scope.lookup(name), reporter, node); | 4819 return Elements.unwrap(scope.lookup(name), reporter, node); |
4812 } | 4820 } |
OLD | NEW |