| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
| 9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
| 10 | 10 |
| (...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 void resolveFieldInitializer(FunctionElement constructor, SendSet init) { | 1403 void resolveFieldInitializer(FunctionElement constructor, SendSet init) { |
| 1404 // init is of the form [this.]field = value. | 1404 // init is of the form [this.]field = value. |
| 1405 final Node selector = init.selector; | 1405 final Node selector = init.selector; |
| 1406 final String name = selector.asIdentifier().source; | 1406 final String name = selector.asIdentifier().source; |
| 1407 // Lookup target field. | 1407 // Lookup target field. |
| 1408 Element target; | 1408 Element target; |
| 1409 if (isFieldInitializer(init)) { | 1409 if (isFieldInitializer(init)) { |
| 1410 target = constructor.enclosingClass.lookupLocalMember(name); | 1410 target = constructor.enclosingClass.lookupLocalMember(name); |
| 1411 if (target == null) { | 1411 if (target == null) { |
| 1412 error(selector, MessageKind.CANNOT_RESOLVE, {'name': name}); | 1412 error(selector, MessageKind.CANNOT_RESOLVE, {'name': name}); |
| 1413 // TODO(ahe): Don't throw, recover from error. |
| 1414 throw new CompilerCancelledException(null); |
| 1413 } else if (target.kind != ElementKind.FIELD) { | 1415 } else if (target.kind != ElementKind.FIELD) { |
| 1414 error(selector, MessageKind.NOT_A_FIELD, {'fieldName': name}); | 1416 error(selector, MessageKind.NOT_A_FIELD, {'fieldName': name}); |
| 1415 // TODO(ahe): Don't throw, recover from error. | 1417 // TODO(ahe): Don't throw, recover from error. |
| 1416 throw new CompilerCancelledException(null); | 1418 throw new CompilerCancelledException(null); |
| 1417 } else if (!target.isInstanceMember) { | 1419 } else if (!target.isInstanceMember) { |
| 1418 error(selector, MessageKind.INIT_STATIC_FIELD, {'fieldName': name}); | 1420 error(selector, MessageKind.INIT_STATIC_FIELD, {'fieldName': name}); |
| 1419 } | 1421 } |
| 1420 } else { | 1422 } else { |
| 1421 error(init, MessageKind.INVALID_RECEIVER_IN_INITIALIZER); | 1423 error(init, MessageKind.INVALID_RECEIVER_IN_INITIALIZER); |
| 1422 } | 1424 } |
| (...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5008 } | 5010 } |
| 5009 | 5011 |
| 5010 /// The result for the resolution of the `assert` method. | 5012 /// The result for the resolution of the `assert` method. |
| 5011 class AssertResult implements ResolutionResult { | 5013 class AssertResult implements ResolutionResult { |
| 5012 const AssertResult(); | 5014 const AssertResult(); |
| 5013 | 5015 |
| 5014 Element get element => null; | 5016 Element get element => null; |
| 5015 | 5017 |
| 5016 String toString() => 'AssertResult()'; | 5018 String toString() => 'AssertResult()'; |
| 5017 } | 5019 } |
| OLD | NEW |