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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/secret_tree_element.dart

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * Encapsulates the field [TreeElementMixin._element].
7 *
8 * This library is an implementation detail of dart2js, and should not
9 * be imported except by resolution and tree node libraries, or for
10 * testing.
11 *
12 * We have taken great care to ensure AST nodes can be cached between
13 * compiler instances. Part of this requires that we always access
14 * resolution results through TreeElements.
15 *
16 * So please, do not add additional elements to this library, and do
17 * not import it.
18 */
19 library secret_tree_element;
20
21 import '../dart2jslib.dart' show invariant, Spannable;
22
23 /// Interface for associating
24 abstract class TreeElementMixin {
25 Object get _element;
26 void set _element(Object value);
27 }
28
29 /// Null implementation of [TreeElementMixin] which does not allow association
30 /// of elements.
31 ///
32 /// This class is the superclass of all AST nodes.
33 abstract class NullTreeElementMixin implements TreeElementMixin, Spannable {
34
35 // Deliberately using [Object] here to thwart code completion.
36 // You're not really supposed to access this field anyways.
37 Object get _element => null;
38 set _element(_) {
39 assert(invariant(this, false,
40 message: "Elements cannot be associated with ${runtimeType}."));
41 }
42 }
43
44 /// Actual implementation of [TreeElementMixin] which stores the associated
45 /// element in the private field [_element].
46 ///
47 /// This class is mixed into the node classes that are actually associated with
48 /// elements.
49 abstract class StoredTreeElementMixin implements TreeElementMixin {
50 Object _element;
51 }
52
53 /**
54 * Do not call this method directly. Instead, use an instance of
55 * TreeElements.
56 *
57 * Using [Object] as return type to thwart code completion.
58 */
59 Object getTreeElement(TreeElementMixin node) => node._element;
60
61 /**
62 * Do not call this method directly. Instead, use an instance of
63 * TreeElements.
64 */
65 void setTreeElement(TreeElementMixin node, Object value) {
66 node._element = value;
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698