Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 elements; 5 library elements;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution; 8 import '../common/resolution.dart' show Resolution;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constructors.dart'; 10 import '../constants/constructors.dart';
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 Node get node; 1619 Node get node;
1620 1620
1621 /// `true` if [resolvedAst] is available. 1621 /// `true` if [resolvedAst] is available.
1622 bool get hasResolvedAst; 1622 bool get hasResolvedAst;
1623 1623
1624 /// The defining AST node of this element with is corresponding 1624 /// The defining AST node of this element with is corresponding
1625 /// [TreeElements]. This is not available if [hasResolvedAst] is `false`. 1625 /// [TreeElements]. This is not available if [hasResolvedAst] is `false`.
1626 ResolvedAst get resolvedAst; 1626 ResolvedAst get resolvedAst;
1627 } 1627 }
1628 1628
1629 class ResolvedAst { 1629 /// Enum values for different ways of defining semantics for an element.
1630 enum ResolvedAstKind {
1631 /// The semantics of the element is defined in terms of an AST with resolved
1632 /// data mapped in [TreeElements].
1633 PARSED,
1634
1635 /// The element is an implicit default constructor. No AST or [TreeElements]
1636 /// are provided.
1637 DEFAULT_CONSTRUCTOR,
1638
1639 /// The element is an implicit forwarding constructor on a mixin application.
1640 /// No AST or [TreeElements] are provided.
1641 FORWARDING_CONSTRUCTOR,
1642 }
1643
1644 /// [ResolvedAst] contains info that define the semantics of an element.
1645 abstract class ResolvedAst {
1646 /// The element whose semantics is defined.
1647 Element get element;
1648
1649 /// The kind of semantics definition used for this object.
1650 ResolvedAstKind get kind;
1651
1652 /// The AST node for [element]. This only available of [kind] is
1653 /// `ResolvedAstKind.PARSED`.
1654 Node get node;
1655
1656 /// The [TreeElements] containing the resolution data for [node]. This only
1657 /// available of [kind] is `ResolvedAstKind.PARSED`.
1658 TreeElements get elements;
1659 }
1660
1661 /// [ResolvedAst] implementation used for elements whose semantics is defined in
1662 /// terms an AST and a [TreeElements].
1663 class ParsedResolvedAst implements ResolvedAst {
1630 final Element element; 1664 final Element element;
1631 final Node node; 1665 final Node node;
1632 final TreeElements elements; 1666 final TreeElements elements;
1633 1667
1634 ResolvedAst(this.element, this.node, this.elements); 1668 ParsedResolvedAst(this.element, this.node, this.elements);
1635 1669
1636 String toString() => '$element:$node'; 1670 ResolvedAstKind get kind => ResolvedAstKind.PARSED;
1671
1672 String toString() => '$kind:$element:$node';
1673 }
1674
1675 /// [ResolvedAst] implementation used for synthesized elements whose semantics
1676 /// is not defined in terms an AST and a [TreeElements].
1677 class SynthesizedResolvedAst implements ResolvedAst {
1678 final Element element;
1679 final ResolvedAstKind kind;
1680
1681 SynthesizedResolvedAst(this.element, this.kind);
1682
1683 @override
1684 TreeElements get elements {
1685 throw new UnsupportedError('$this does not provide a TreeElements');
1686 }
1687
1688 @override
1689 Node get node {
1690 throw new UnsupportedError('$this does not have an AST');
1691 }
1692
1693 String toString() => '$kind:$element';
1637 } 1694 }
1638 1695
1639 /// A [MemberSignature] is a member of an interface. 1696 /// A [MemberSignature] is a member of an interface.
1640 /// 1697 ///
1641 /// A signature is either a method or a getter or setter, possibly implicitly 1698 /// A signature is either a method or a getter or setter, possibly implicitly
1642 /// defined by a field declarations. Fields themselves are not members of an 1699 /// defined by a field declarations. Fields themselves are not members of an
1643 /// interface. 1700 /// interface.
1644 /// 1701 ///
1645 /// A [MemberSignature] may be defined by a member declaration or may be 1702 /// A [MemberSignature] may be defined by a member declaration or may be
1646 /// synthetized from a set of declarations. 1703 /// synthetized from a set of declarations.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 /// by a field. 1765 /// by a field.
1709 bool get isDeclaredByField; 1766 bool get isDeclaredByField;
1710 1767
1711 /// Returns `true` if this member is abstract. 1768 /// Returns `true` if this member is abstract.
1712 bool get isAbstract; 1769 bool get isAbstract;
1713 1770
1714 /// If abstract, [implementation] points to the overridden concrete member, 1771 /// If abstract, [implementation] points to the overridden concrete member,
1715 /// if any. Otherwise [implementation] points to the member itself. 1772 /// if any. Otherwise [implementation] points to the member itself.
1716 Member get implementation; 1773 Member get implementation;
1717 } 1774 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698