OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 containing identifier, names, and selectors commonly used through | 5 /// Library containing identifier, names, and selectors commonly used through |
6 /// the compiler. | 6 /// the compiler. |
7 library dart2js.common.names; | 7 library dart2js.common.names; |
8 | 8 |
9 import '../elements/elements.dart' show | 9 import '../elements/elements.dart' show Name, PublicName; |
10 Name, | 10 import '../universe/call_structure.dart' show CallStructure; |
11 PublicName; | 11 import '../universe/selector.dart' show Selector; |
12 import '../universe/call_structure.dart' show | |
13 CallStructure; | |
14 import '../universe/selector.dart' show | |
15 Selector; | |
16 | 12 |
17 /// [String]s commonly used. | 13 /// [String]s commonly used. |
18 class Identifiers { | 14 class Identifiers { |
19 /// The name of the call operator. | 15 /// The name of the call operator. |
20 static const String call = 'call'; | 16 static const String call = 'call'; |
21 | 17 |
22 /// The name of the current element property used on iterators in for-each | 18 /// The name of the current element property used on iterators in for-each |
23 /// loops. | 19 /// loops. |
24 static const String current = 'current'; | 20 static const String current = 'current'; |
25 | 21 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 95 |
100 /// The selector for tearing off noSuchMethod. | 96 /// The selector for tearing off noSuchMethod. |
101 static final Selector noSuchMethodGetter = | 97 static final Selector noSuchMethodGetter = |
102 new Selector.getter(Names.noSuchMethod_); | 98 new Selector.getter(Names.noSuchMethod_); |
103 | 99 |
104 /// The selector for calling the to-string method on 'Object'. | 100 /// The selector for calling the to-string method on 'Object'. |
105 static final Selector toString_ = | 101 static final Selector toString_ = |
106 new Selector.call(Names.toString_, CallStructure.NO_ARGS); | 102 new Selector.call(Names.toString_, CallStructure.NO_ARGS); |
107 | 103 |
108 /// The selector for tearing off toString. | 104 /// The selector for tearing off toString. |
109 static final Selector toStringGetter = | 105 static final Selector toStringGetter = new Selector.getter(Names.toString_); |
110 new Selector.getter(Names.toString_); | |
111 | 106 |
112 static final Selector hashCode_ = | 107 static final Selector hashCode_ = |
113 new Selector.getter(const PublicName('hashCode')); | 108 new Selector.getter(const PublicName('hashCode')); |
114 | 109 |
115 static final Selector compareTo = | 110 static final Selector compareTo = |
116 new Selector.call(const PublicName("compareTo"), CallStructure.ONE_ARG); | 111 new Selector.call(const PublicName("compareTo"), CallStructure.ONE_ARG); |
117 | 112 |
118 static final Selector equals = new Selector.binaryOperator('=='); | 113 static final Selector equals = new Selector.binaryOperator('=='); |
119 | 114 |
120 static final Selector length = new Selector.getter(Names.length); | 115 static final Selector length = new Selector.getter(Names.length); |
121 | 116 |
122 static final Selector codeUnitAt = | 117 static final Selector codeUnitAt = |
123 new Selector.call(const PublicName('codeUnitAt'), CallStructure.ONE_ARG); | 118 new Selector.call(const PublicName('codeUnitAt'), CallStructure.ONE_ARG); |
124 | 119 |
125 static final Selector index = new Selector.index(); | 120 static final Selector index = new Selector.index(); |
126 | 121 |
127 static final Selector runtimeType_ = new Selector.getter(Names.runtimeType_); | 122 static final Selector runtimeType_ = new Selector.getter(Names.runtimeType_); |
128 | 123 |
129 /// List of all the selectors held in static fields. | 124 /// List of all the selectors held in static fields. |
130 /// | 125 /// |
131 /// These objects are shared between different runs in batch-mode and must | 126 /// These objects are shared between different runs in batch-mode and must |
132 /// thus remain in the [Selector.canonicalizedValues] map. | 127 /// thus remain in the [Selector.canonicalizedValues] map. |
133 static final List<Selector> ALL = <Selector>[ | 128 static final List<Selector> ALL = <Selector>[ |
134 cancel, current, iterator, moveNext, noSuchMethod_, noSuchMethodGetter, | 129 cancel, |
135 toString_, toStringGetter, hashCode_, compareTo, equals, length, | 130 current, |
136 codeUnitAt, index, runtimeType_]; | 131 iterator, |
| 132 moveNext, |
| 133 noSuchMethod_, |
| 134 noSuchMethodGetter, |
| 135 toString_, |
| 136 toStringGetter, |
| 137 hashCode_, |
| 138 compareTo, |
| 139 equals, |
| 140 length, |
| 141 codeUnitAt, |
| 142 index, |
| 143 runtimeType_ |
| 144 ]; |
137 } | 145 } |
138 | 146 |
139 /// [Uri]s commonly used. | 147 /// [Uri]s commonly used. |
140 class Uris { | 148 class Uris { |
141 /// The URI for 'dart:async'. | 149 /// The URI for 'dart:async'. |
142 static final Uri dart_async = new Uri(scheme: 'dart', path: 'async'); | 150 static final Uri dart_async = new Uri(scheme: 'dart', path: 'async'); |
143 | 151 |
144 /// The URI for 'dart:core'. | 152 /// The URI for 'dart:core'. |
145 static final Uri dart_core = new Uri(scheme: 'dart', path: 'core'); | 153 static final Uri dart_core = new Uri(scheme: 'dart', path: 'core'); |
146 | 154 |
147 /// The URI for 'dart:html'. | 155 /// The URI for 'dart:html'. |
148 static final Uri dart_html = new Uri(scheme: 'dart', path: 'html'); | 156 static final Uri dart_html = new Uri(scheme: 'dart', path: 'html'); |
149 | 157 |
150 /// The URI for 'dart:mirrors'. | 158 /// The URI for 'dart:mirrors'. |
151 static final Uri dart_mirrors = new Uri(scheme: 'dart', path: 'mirrors'); | 159 static final Uri dart_mirrors = new Uri(scheme: 'dart', path: 'mirrors'); |
152 | 160 |
153 /// The URI for 'dart:_internal'. | 161 /// The URI for 'dart:_internal'. |
154 static final Uri dart__internal = new Uri(scheme: 'dart', path: '_internal'); | 162 static final Uri dart__internal = new Uri(scheme: 'dart', path: '_internal'); |
155 | 163 |
156 /// The URI for 'dart:_native_typed_data'. | 164 /// The URI for 'dart:_native_typed_data'. |
157 static final Uri dart__native_typed_data = | 165 static final Uri dart__native_typed_data = |
158 new Uri(scheme: 'dart', path: '_native_typed_data'); | 166 new Uri(scheme: 'dart', path: '_native_typed_data'); |
159 } | 167 } |
OLD | NEW |