| 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 Feature; | 9 import '../common/resolution.dart' show Feature; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 Name getRedirectingThisOrSuperConstructorName(Send node) { | 381 Name getRedirectingThisOrSuperConstructorName(Send node) { |
| 382 if (isNamedConstructor(node)) { | 382 if (isNamedConstructor(node)) { |
| 383 String constructorName = node.selector.asIdentifier().source; | 383 String constructorName = node.selector.asIdentifier().source; |
| 384 return new Name(constructorName, enclosingElement.library); | 384 return new Name(constructorName, enclosingElement.library); |
| 385 } else { | 385 } else { |
| 386 return const PublicName(''); | 386 return const PublicName(''); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 FunctionElement resolveConstructorRedirection(FunctionElementX constructor) { | 390 FunctionElement resolveConstructorRedirection(FunctionElementX constructor) { |
| 391 FunctionExpression node = constructor.parseNode(resolution.parsing); | 391 FunctionExpression node = constructor.parseNode(resolution.parsingContext); |
| 392 | 392 |
| 393 // A synthetic constructor does not have a node. | 393 // A synthetic constructor does not have a node. |
| 394 if (node == null) return null; | 394 if (node == null) return null; |
| 395 if (node.initializers == null) return null; | 395 if (node.initializers == null) return null; |
| 396 Link<Node> initializers = node.initializers.nodes; | 396 Link<Node> initializers = node.initializers.nodes; |
| 397 if (!initializers.isEmpty && | 397 if (!initializers.isEmpty && |
| 398 Initializers.isConstructorRedirect(initializers.head)) { | 398 Initializers.isConstructorRedirect(initializers.head)) { |
| 399 Name name = getRedirectingThisOrSuperConstructorName(initializers.head); | 399 Name name = getRedirectingThisOrSuperConstructorName(initializers.head); |
| 400 final ClassElement classElement = constructor.enclosingClass; | 400 final ClassElement classElement = constructor.enclosingClass; |
| 401 return classElement.lookupConstructor(name.text); | 401 return classElement.lookupConstructor(name.text); |
| (...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4671 } | 4671 } |
| 4672 return const NoneResult(); | 4672 return const NoneResult(); |
| 4673 } | 4673 } |
| 4674 } | 4674 } |
| 4675 | 4675 |
| 4676 /// Looks up [name] in [scope] and unwraps the result. | 4676 /// Looks up [name] in [scope] and unwraps the result. |
| 4677 Element lookupInScope( | 4677 Element lookupInScope( |
| 4678 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4678 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
| 4679 return Elements.unwrap(scope.lookup(name), reporter, node); | 4679 return Elements.unwrap(scope.lookup(name), reporter, node); |
| 4680 } | 4680 } |
| OLD | NEW |