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.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 4139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4150 conditionResult.constant, thenResult.constant, elseResult.constant); | 4150 conditionResult.constant, thenResult.constant, elseResult.constant); |
4151 registry.setConstant(node, constant); | 4151 registry.setConstant(node, constant); |
4152 return new ConstantResult(node, constant); | 4152 return new ConstantResult(node, constant); |
4153 } | 4153 } |
4154 return const NoneResult(); | 4154 return const NoneResult(); |
4155 } | 4155 } |
4156 | 4156 |
4157 ResolutionResult visitStringInterpolation(StringInterpolation node) { | 4157 ResolutionResult visitStringInterpolation(StringInterpolation node) { |
4158 // TODO(johnniwinther): This should be a consequence of the registration | 4158 // TODO(johnniwinther): This should be a consequence of the registration |
4159 // of [registerStringInterpolation]. | 4159 // of [registerStringInterpolation]. |
4160 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.stringType)); | |
4161 registry.registerFeature(Feature.STRING_INTERPOLATION); | 4160 registry.registerFeature(Feature.STRING_INTERPOLATION); |
4162 registerImplicitInvocation(Selectors.toString_); | |
4163 | 4161 |
4164 bool isValidAsConstant = true; | 4162 bool isValidAsConstant = true; |
4165 List<ConstantExpression> parts = <ConstantExpression>[]; | 4163 List<ConstantExpression> parts = <ConstantExpression>[]; |
4166 | 4164 |
4167 void resolvePart(Node subnode) { | 4165 void resolvePart(Node subnode) { |
4168 ResolutionResult result = visit(subnode); | 4166 ResolutionResult result = visit(subnode); |
4169 if (isValidAsConstant && result.isConstant) { | 4167 if (isValidAsConstant && result.isConstant) { |
4170 parts.add(result.constant); | 4168 parts.add(result.constant); |
4171 } else { | 4169 } else { |
4172 isValidAsConstant = false; | 4170 isValidAsConstant = false; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4237 if (!target.statement.isValidContinueTarget()) { | 4235 if (!target.statement.isValidContinueTarget()) { |
4238 reporter.reportErrorMessage(node.target, MessageKind.INVALID_CONTINUE); | 4236 reporter.reportErrorMessage(node.target, MessageKind.INVALID_CONTINUE); |
4239 } | 4237 } |
4240 label.setContinueTarget(); | 4238 label.setContinueTarget(); |
4241 registry.useLabel(node, label); | 4239 registry.useLabel(node, label); |
4242 } | 4240 } |
4243 registry.registerTargetOf(node, target); | 4241 registry.registerTargetOf(node, target); |
4244 return const NoneResult(); | 4242 return const NoneResult(); |
4245 } | 4243 } |
4246 | 4244 |
4247 registerImplicitInvocation(Selector selector) { | |
4248 registry.registerDynamicUse(new DynamicUse(selector, null)); | |
4249 } | |
4250 | |
4251 ResolutionResult visitAsyncForIn(AsyncForIn node) { | 4245 ResolutionResult visitAsyncForIn(AsyncForIn node) { |
4252 if (!resolution.target.supportsAsyncAwait) { | 4246 if (!resolution.target.supportsAsyncAwait) { |
4253 reporter.reportErrorMessage( | 4247 reporter.reportErrorMessage( |
4254 node.awaitToken, MessageKind.ASYNC_AWAIT_NOT_SUPPORTED); | 4248 node.awaitToken, MessageKind.ASYNC_AWAIT_NOT_SUPPORTED); |
4255 } else { | 4249 } else { |
4256 if (!currentAsyncMarker.isAsync) { | 4250 if (!currentAsyncMarker.isAsync) { |
4257 reporter.reportErrorMessage( | 4251 reporter.reportErrorMessage( |
4258 node.awaitToken, MessageKind.INVALID_AWAIT_FOR_IN); | 4252 node.awaitToken, MessageKind.INVALID_AWAIT_FOR_IN); |
4259 } | 4253 } |
4260 registry.registerFeature(Feature.ASYNC_FOR_IN); | 4254 registry.registerFeature(Feature.ASYNC_FOR_IN); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 } | 4724 } |
4731 return const NoneResult(); | 4725 return const NoneResult(); |
4732 } | 4726 } |
4733 } | 4727 } |
4734 | 4728 |
4735 /// Looks up [name] in [scope] and unwraps the result. | 4729 /// Looks up [name] in [scope] and unwraps the result. |
4736 Element lookupInScope( | 4730 Element lookupInScope( |
4737 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4731 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
4738 return Elements.unwrap(scope.lookup(name), reporter, node); | 4732 return Elements.unwrap(scope.lookup(name), reporter, node); |
4739 } | 4733 } |
OLD | NEW |