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

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

Issue 1892093003: Support deserialized compilation of the empty program. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments 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
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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1192
1193 const AsyncMarker._({this.isAsync: false, this.isYielding: false}); 1193 const AsyncMarker._({this.isAsync: false, this.isYielding: false});
1194 1194
1195 String toString() { 1195 String toString() {
1196 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; 1196 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}';
1197 } 1197 }
1198 1198
1199 /// Canonical list of marker values. 1199 /// Canonical list of marker values.
1200 /// 1200 ///
1201 /// Added to make [AsyncMarker] enum-like. 1201 /// Added to make [AsyncMarker] enum-like.
1202 static const List<AsyncMarker> values = 1202 static const List<AsyncMarker> values = const <AsyncMarker>[
1203 const <AsyncMarker>[SYNC, SYNC_STAR, ASYNC, ASYNC_STAR]; 1203 SYNC,
1204 1204 SYNC_STAR,
1205 ASYNC,
1206 ASYNC_STAR
1207 ];
1205 1208
1206 /// Index to this marker within [values]. 1209 /// Index to this marker within [values].
1207 /// 1210 ///
1208 /// Added to make [AsyncMarker] enum-like. 1211 /// Added to make [AsyncMarker] enum-like.
1209 int get index => values.indexOf(this); 1212 int get index => values.indexOf(this);
1210 } 1213 }
1211 1214
1212 /// A top level, static or instance function. 1215 /// A top level, static or instance function.
1213 abstract class MethodElement extends FunctionElement implements MemberElement {} 1216 abstract class MethodElement extends FunctionElement implements MemberElement {}
1214 1217
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 } 1656 }
1654 1657
1655 /// [ResolvedAst] contains info that define the semantics of an element. 1658 /// [ResolvedAst] contains info that define the semantics of an element.
1656 abstract class ResolvedAst { 1659 abstract class ResolvedAst {
1657 /// The element whose semantics is defined. 1660 /// The element whose semantics is defined.
1658 Element get element; 1661 Element get element;
1659 1662
1660 /// The kind of semantics definition used for this object. 1663 /// The kind of semantics definition used for this object.
1661 ResolvedAstKind get kind; 1664 ResolvedAstKind get kind;
1662 1665
1663 /// The AST node for [element]. This only available of [kind] is 1666 /// The root AST node for the declaration of [element]. This only available if
1664 /// `ResolvedAstKind.PARSED`. 1667 /// [kind] is `ResolvedAstKind.PARSED`.
1665 Node get node; 1668 Node get node;
1666 1669
1670 /// The AST node for the 'body' of [element].
1671 ///
1672 /// For functions and constructors this is the root AST node of the method
1673 /// body, and for variables this is the root AST node of the initializer, if
1674 /// available.
1675 ///
1676 /// This only available if [kind] is `ResolvedAstKind.PARSED`.
1677 Node get body;
1678
1667 /// The [TreeElements] containing the resolution data for [node]. This only 1679 /// The [TreeElements] containing the resolution data for [node]. This only
1668 /// available of [kind] is `ResolvedAstKind.PARSED`. 1680 /// available of [kind] is `ResolvedAstKind.PARSED`.
1669 TreeElements get elements; 1681 TreeElements get elements;
1670 } 1682 }
1671 1683
1672 /// [ResolvedAst] implementation used for elements whose semantics is defined in 1684 /// [ResolvedAst] implementation used for elements whose semantics is defined in
1673 /// terms an AST and a [TreeElements]. 1685 /// terms an AST and a [TreeElements].
1674 class ParsedResolvedAst implements ResolvedAst { 1686 class ParsedResolvedAst implements ResolvedAst {
1675 final Element element; 1687 final Element element;
1676 final Node node; 1688 final Node node;
1689 final Node body;
1677 final TreeElements elements; 1690 final TreeElements elements;
1678 1691
1679 ParsedResolvedAst(this.element, this.node, this.elements); 1692 ParsedResolvedAst(this.element, this.node, this.body, this.elements);
1680 1693
1681 ResolvedAstKind get kind => ResolvedAstKind.PARSED; 1694 ResolvedAstKind get kind => ResolvedAstKind.PARSED;
1682 1695
1683 String toString() => '$kind:$element:$node'; 1696 String toString() => '$kind:$element:$node';
1684 } 1697 }
1685 1698
1686 /// [ResolvedAst] implementation used for synthesized elements whose semantics 1699 /// [ResolvedAst] implementation used for synthesized elements whose semantics
1687 /// is not defined in terms an AST and a [TreeElements]. 1700 /// is not defined in terms an AST and a [TreeElements].
1688 class SynthesizedResolvedAst implements ResolvedAst { 1701 class SynthesizedResolvedAst implements ResolvedAst {
1689 final Element element; 1702 final Element element;
1690 final ResolvedAstKind kind; 1703 final ResolvedAstKind kind;
1691 1704
1692 SynthesizedResolvedAst(this.element, this.kind); 1705 SynthesizedResolvedAst(this.element, this.kind);
1693 1706
1694 @override 1707 @override
1695 TreeElements get elements { 1708 TreeElements get elements {
1696 throw new UnsupportedError('$this does not provide a TreeElements'); 1709 throw new UnsupportedError('$this does not provide a TreeElements');
1697 } 1710 }
1698 1711
1699 @override 1712 @override
1700 Node get node { 1713 Node get node {
1701 throw new UnsupportedError('$this does not have an AST'); 1714 throw new UnsupportedError('$this does not have a root AST node');
1715 }
1716
1717 @override
1718 Node get body {
1719 throw new UnsupportedError('$this does not have a body AST node');
1702 } 1720 }
1703 1721
1704 String toString() => '$kind:$element'; 1722 String toString() => '$kind:$element';
1705 } 1723 }
1706 1724
1707 /// A [MemberSignature] is a member of an interface. 1725 /// A [MemberSignature] is a member of an interface.
1708 /// 1726 ///
1709 /// A signature is either a method or a getter or setter, possibly implicitly 1727 /// A signature is either a method or a getter or setter, possibly implicitly
1710 /// defined by a field declarations. Fields themselves are not members of an 1728 /// defined by a field declarations. Fields themselves are not members of an
1711 /// interface. 1729 /// interface.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 /// by a field. 1794 /// by a field.
1777 bool get isDeclaredByField; 1795 bool get isDeclaredByField;
1778 1796
1779 /// Returns `true` if this member is abstract. 1797 /// Returns `true` if this member is abstract.
1780 bool get isAbstract; 1798 bool get isAbstract;
1781 1799
1782 /// If abstract, [implementation] points to the overridden concrete member, 1800 /// If abstract, [implementation] points to the overridden concrete member,
1783 /// if any. Otherwise [implementation] points to the member itself. 1801 /// if any. Otherwise [implementation] points to the member itself.
1784 Member get implementation; 1802 Member get implementation;
1785 } 1803 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698