| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'elements.dart'; | 7 import 'elements.dart'; |
| 8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
| 9 import '../util/util.dart'; | 9 import '../util/util.dart'; |
| 10 import '../resolution/resolution.dart'; | 10 import '../resolution/resolution.dart'; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 get node => unsupported(); | 339 get node => unsupported(); |
| 340 get type => unsupported(); | 340 get type => unsupported(); |
| 341 get cachedNode => unsupported(); | 341 get cachedNode => unsupported(); |
| 342 get functionSignature => unsupported(); | 342 get functionSignature => unsupported(); |
| 343 get patch => null; | 343 get patch => null; |
| 344 get origin => this; | 344 get origin => this; |
| 345 get defaultImplementation => unsupported(); | 345 get defaultImplementation => unsupported(); |
| 346 get nestedClosures => unsupported(); | 346 get nestedClosures => unsupported(); |
| 347 | 347 |
| 348 bool get isRedirectingFactory => unsupported(); | 348 bool get isRedirectingFactory => unsupported(); |
| 349 bool get mightBePassedToFunctionApply => unsupported(); |
| 350 set mightBePassedToFunctionApply(bool value) => unsupported(); |
| 349 | 351 |
| 350 setPatch(patch) => unsupported(); | 352 setPatch(patch) => unsupported(); |
| 351 computeSignature(compiler) => unsupported(); | 353 computeSignature(compiler) => unsupported(); |
| 352 requiredParameterCount(compiler) => unsupported(); | 354 requiredParameterCount(compiler) => unsupported(); |
| 353 optionalParameterCount(compiler) => unsupported(); | 355 optionalParameterCount(compiler) => unsupported(); |
| 354 parameterCount(compiler) => unsupported(); | 356 parameterCount(compiler) => unsupported(); |
| 355 | 357 |
| 356 // TODO(kasperl): These seem unnecessary. | 358 // TODO(kasperl): These seem unnecessary. |
| 357 set patch(value) => unsupported(); | 359 set patch(value) => unsupported(); |
| 358 set origin(value) => unsupported(); | 360 set origin(value) => unsupported(); |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 /** | 1494 /** |
| 1493 * A function declaration that should be parsed instead of the current one. | 1495 * A function declaration that should be parsed instead of the current one. |
| 1494 * The patch should be parsed as if it was in the current scope. Its | 1496 * The patch should be parsed as if it was in the current scope. Its |
| 1495 * signature must match this function's signature. | 1497 * signature must match this function's signature. |
| 1496 */ | 1498 */ |
| 1497 FunctionElement patch = null; | 1499 FunctionElement patch = null; |
| 1498 FunctionElement origin = null; | 1500 FunctionElement origin = null; |
| 1499 | 1501 |
| 1500 final bool _hasNoBody; | 1502 final bool _hasNoBody; |
| 1501 | 1503 |
| 1504 bool mightBePassedToFunctionApply = false; |
| 1505 |
| 1502 /** | 1506 /** |
| 1503 * If this is a redirecting factory, [defaultImplementation] will be | 1507 * If this is a redirecting factory, [defaultImplementation] will be |
| 1504 * changed by the resolver to point to the redirection target. | 1508 * changed by the resolver to point to the redirection target. |
| 1505 * Otherwise, [:identical(defaultImplementation, this):]. | 1509 * Otherwise, [:identical(defaultImplementation, this):]. |
| 1506 */ | 1510 */ |
| 1507 // TODO(ahe): Rename this field to redirectionTarget. | 1511 // TODO(ahe): Rename this field to redirectionTarget. |
| 1508 FunctionElement defaultImplementation; | 1512 FunctionElement defaultImplementation; |
| 1509 | 1513 |
| 1510 FunctionElementX(String name, | 1514 FunctionElementX(String name, |
| 1511 ElementKind kind, | 1515 ElementKind kind, |
| 1512 Modifiers modifiers, | 1516 Modifiers modifiers, |
| 1513 Element enclosing, | 1517 Element enclosing, |
| 1514 bool hasNoBody) | 1518 bool hasNoBody) |
| 1515 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null, | 1519 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null, |
| 1516 hasNoBody); | 1520 hasNoBody); |
| 1517 | 1521 |
| 1518 FunctionElementX.fromNode(String name, | 1522 FunctionElementX.fromNode(String name, |
| 1519 FunctionExpression node, | 1523 FunctionExpression node, |
| 1520 ElementKind kind, | 1524 ElementKind kind, |
| 1521 Modifiers modifiers, | 1525 Modifiers modifiers, |
| 1522 Element enclosing) | 1526 Element enclosing) |
| 1523 : this.tooMuchOverloading(name, node, kind, modifiers, enclosing, null, | 1527 : this.tooMuchOverloading(name, node, kind, modifiers, enclosing, null, |
| 1524 false); | 1528 false); |
| 1525 | 1529 |
| 1526 FunctionElementX.from(String name, | |
| 1527 FunctionElement other, | |
| 1528 Element enclosing) | |
| 1529 : this.tooMuchOverloading(name, other.node, other.kind, | |
| 1530 other.modifiers, enclosing, | |
| 1531 other.functionSignature, | |
| 1532 false); | |
| 1533 | |
| 1534 FunctionElementX.tooMuchOverloading(String name, | 1530 FunctionElementX.tooMuchOverloading(String name, |
| 1535 FunctionExpression this.cachedNode, | 1531 FunctionExpression this.cachedNode, |
| 1536 ElementKind kind, | 1532 ElementKind kind, |
| 1537 this.modifiers, | 1533 this.modifiers, |
| 1538 Element enclosing, | 1534 Element enclosing, |
| 1539 this.functionSignatureCache, | 1535 this.functionSignatureCache, |
| 1540 bool hasNoBody) | 1536 bool hasNoBody) |
| 1541 : super(name, kind, enclosing), | 1537 : super(name, kind, enclosing), |
| 1542 _hasNoBody = hasNoBody { | 1538 _hasNoBody = hasNoBody { |
| 1543 assert(modifiers != null); | 1539 assert(modifiers != null); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 | 1653 |
| 1658 bool get isAbstract { | 1654 bool get isAbstract { |
| 1659 return !modifiers.isExternal() && | 1655 return !modifiers.isExternal() && |
| 1660 (isFunction() || isAccessor()) && | 1656 (isFunction() || isAccessor()) && |
| 1661 _hasNoBody; | 1657 _hasNoBody; |
| 1662 } | 1658 } |
| 1663 | 1659 |
| 1664 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 1660 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| 1665 } | 1661 } |
| 1666 | 1662 |
| 1663 class SynthesizedCallMethodElementX extends FunctionElementX { |
| 1664 final FunctionElement expression; |
| 1665 |
| 1666 SynthesizedCallMethodElementX(String name, |
| 1667 FunctionElement other, |
| 1668 Element enclosing) |
| 1669 : expression = other, |
| 1670 super.tooMuchOverloading(name, other.node, other.kind, |
| 1671 other.modifiers, enclosing, |
| 1672 other.functionSignature, |
| 1673 false); |
| 1674 |
| 1675 bool get mightBePassedToFunctionApply => |
| 1676 expression.mightBePassedToFunctionApply; |
| 1677 void set mightBePassedToFunctionApply(_) => |
| 1678 throw new UnsupportedError("Cannot set mightBePassedToFunctionApply for " |
| 1679 "synthezised call method"); |
| 1680 } |
| 1681 |
| 1667 class DeferredLoaderGetterElementX extends FunctionElementX { | 1682 class DeferredLoaderGetterElementX extends FunctionElementX { |
| 1668 | 1683 |
| 1669 final PrefixElement prefix; | 1684 final PrefixElement prefix; |
| 1670 | 1685 |
| 1671 DeferredLoaderGetterElementX(PrefixElement prefix) | 1686 DeferredLoaderGetterElementX(PrefixElement prefix) |
| 1672 : this.prefix = prefix, | 1687 : this.prefix = prefix, |
| 1673 super("loadLibrary", | 1688 super("loadLibrary", |
| 1674 ElementKind.FUNCTION, | 1689 ElementKind.FUNCTION, |
| 1675 Modifiers.EMPTY, | 1690 Modifiers.EMPTY, |
| 1676 prefix, true); | 1691 prefix, true); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 | 2633 |
| 2619 ParameterMetadataAnnotation(Metadata this.metadata); | 2634 ParameterMetadataAnnotation(Metadata this.metadata); |
| 2620 | 2635 |
| 2621 Node parseNode(DiagnosticListener listener) => metadata.expression; | 2636 Node parseNode(DiagnosticListener listener) => metadata.expression; |
| 2622 | 2637 |
| 2623 Token get beginToken => metadata.getBeginToken(); | 2638 Token get beginToken => metadata.getBeginToken(); |
| 2624 | 2639 |
| 2625 Token get endToken => metadata.getEndToken(); | 2640 Token get endToken => metadata.getEndToken(); |
| 2626 } | 2641 } |
| 2627 | 2642 |
| OLD | NEW |