| 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 Element get currentElement; | 8 Element get currentElement; |
| 9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (elements != null) { | 446 if (elements != null) { |
| 447 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] | 447 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] |
| 448 // should never be non-null, not even for constructors. | 448 // should never be non-null, not even for constructors. |
| 449 assert(invariant(element, element.isConstructor(), | 449 assert(invariant(element, element.isConstructor(), |
| 450 message: 'Non-constructor element $element ' | 450 message: 'Non-constructor element $element ' |
| 451 'has already been analyzed.')); | 451 'has already been analyzed.')); |
| 452 return elements; | 452 return elements; |
| 453 } | 453 } |
| 454 if (element.isSynthesized) { | 454 if (element.isSynthesized) { |
| 455 if (isConstructor) { | 455 if (isConstructor) { |
| 456 TreeElements elements = _ensureTreeElements(element); |
| 456 Element target = element.targetConstructor; | 457 Element target = element.targetConstructor; |
| 457 // Ensure the signature of the synthesized element is | 458 // Ensure the signature of the synthesized element is |
| 458 // resolved. This is the only place where the resolver is | 459 // resolved. This is the only place where the resolver is |
| 459 // seeing this element. | 460 // seeing this element. |
| 460 element.computeSignature(compiler); | 461 element.computeSignature(compiler); |
| 461 if (!target.isErroneous()) { | 462 if (!target.isErroneous()) { |
| 462 compiler.enqueuer.resolution.registerStaticUse(target); | 463 compiler.enqueuer.resolution.registerStaticUse(target); |
| 464 compiler.resolverWorld.registerImplicitSuperCall(elements, target); |
| 463 } | 465 } |
| 466 return elements; |
| 464 } else { | 467 } else { |
| 465 assert(element.isDeferredLoaderGetter()); | 468 assert(element.isDeferredLoaderGetter()); |
| 469 return _ensureTreeElements(element); |
| 466 } | 470 } |
| 467 return _ensureTreeElements(element); | |
| 468 } | 471 } |
| 469 element.parseNode(compiler); | 472 element.parseNode(compiler); |
| 470 element.computeSignature(compiler); | 473 element.computeSignature(compiler); |
| 471 if (element.isPatched) { | 474 if (element.isPatched) { |
| 472 FunctionElementX patch = element.patch; | 475 FunctionElementX patch = element.patch; |
| 473 compiler.withCurrentElement(patch, () { | 476 compiler.withCurrentElement(patch, () { |
| 474 patch.parseNode(compiler); | 477 patch.parseNode(compiler); |
| 475 patch.computeSignature(compiler); | 478 patch.computeSignature(compiler); |
| 476 }); | 479 }); |
| 477 checkMatchingPatchSignatures(element, patch); | 480 checkMatchingPatchSignatures(element, patch); |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 | 1373 |
| 1371 final String className = lookupTarget.name; | 1374 final String className = lookupTarget.name; |
| 1372 final bool isImplicitSuperCall = true; | 1375 final bool isImplicitSuperCall = true; |
| 1373 verifyThatConstructorMatchesCall(constructor, | 1376 verifyThatConstructorMatchesCall(constructor, |
| 1374 calledConstructor, | 1377 calledConstructor, |
| 1375 callToMatch, | 1378 callToMatch, |
| 1376 isImplicitSuperCall, | 1379 isImplicitSuperCall, |
| 1377 functionNode, | 1380 functionNode, |
| 1378 className, | 1381 className, |
| 1379 constructorSelector); | 1382 constructorSelector); |
| 1380 | 1383 visitor.compiler.resolverWorld |
| 1384 .registerImplicitSuperCall(visitor.mapping, calledConstructor); |
| 1381 visitor.world.registerStaticUse(calledConstructor); | 1385 visitor.world.registerStaticUse(calledConstructor); |
| 1382 } | 1386 } |
| 1383 } | 1387 } |
| 1384 | 1388 |
| 1385 void verifyThatConstructorMatchesCall( | 1389 void verifyThatConstructorMatchesCall( |
| 1386 FunctionElement caller, | 1390 FunctionElement caller, |
| 1387 FunctionElement lookedupConstructor, | 1391 FunctionElement lookedupConstructor, |
| 1388 Selector call, | 1392 Selector call, |
| 1389 bool isImplicitSuperCall, | 1393 bool isImplicitSuperCall, |
| 1390 Node diagnosticNode, | 1394 Node diagnosticNode, |
| (...skipping 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4658 TreeElements _treeElements; | 4662 TreeElements _treeElements; |
| 4659 | 4663 |
| 4660 bool get hasTreeElements => _treeElements != null; | 4664 bool get hasTreeElements => _treeElements != null; |
| 4661 | 4665 |
| 4662 TreeElements get treeElements { | 4666 TreeElements get treeElements { |
| 4663 assert(invariant(this, _treeElements !=null, | 4667 assert(invariant(this, _treeElements !=null, |
| 4664 message: "TreeElements have not been computed for $this.")); | 4668 message: "TreeElements have not been computed for $this.")); |
| 4665 return _treeElements; | 4669 return _treeElements; |
| 4666 } | 4670 } |
| 4667 } | 4671 } |
| OLD | NEW |