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

Side by Side Diff: pkg/compiler/lib/src/resolution/tree_elements.dart

Issue 1896843002: Store and serialize NativeBehavior in TreeElements. (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) 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 dart2js.resolution.tree_elements; 5 library dart2js.resolution.tree_elements;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../diagnostics/source_span.dart'; 10 import '../diagnostics/source_span.dart';
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 JumpTarget getTargetOf(GotoStatement node); 93 JumpTarget getTargetOf(GotoStatement node);
94 94
95 /// Returns the label defined by [node]. 95 /// Returns the label defined by [node].
96 LabelDefinition getLabelDefinition(Label node); 96 LabelDefinition getLabelDefinition(Label node);
97 97
98 /// Returns the label that [node] targets. 98 /// Returns the label that [node] targets.
99 LabelDefinition getTargetLabel(GotoStatement node); 99 LabelDefinition getTargetLabel(GotoStatement node);
100 100
101 /// `true` if the [analyzedElement]'s source code contains a [TryStatement]. 101 /// `true` if the [analyzedElement]'s source code contains a [TryStatement].
102 bool get containsTryStatement; 102 bool get containsTryStatement;
103
104 /// Returns native data stored with [node].
105 getNativeData(Node node);
103 } 106 }
104 107
105 class TreeElementMapping extends TreeElements { 108 class TreeElementMapping extends TreeElements {
106 final AnalyzableElement analyzedElement; 109 final AnalyzableElement analyzedElement;
107 Map<Spannable, Selector> _selectors; 110 Map<Spannable, Selector> _selectors;
108 Map<Spannable, TypeMask> _typeMasks; 111 Map<Spannable, TypeMask> _typeMasks;
109 Map<Node, DartType> _types; 112 Map<Node, DartType> _types;
110 113
111 Map<Node, DartType> _typesCache; 114 Map<Node, DartType> _typesCache;
112 Map<Node, DartType> get typesCache => _typesCache ??= <Node, DartType>{}; 115 Map<Node, DartType> get typesCache => _typesCache ??= <Node, DartType>{};
(...skipping 13 matching lines...) Expand all
126 129
127 /// Map from goto statements to their targets. 130 /// Map from goto statements to their targets.
128 Map<GotoStatement, JumpTarget> _usedTargets; 131 Map<GotoStatement, JumpTarget> _usedTargets;
129 132
130 /// Map from labels to their label definition. 133 /// Map from labels to their label definition.
131 Map<Label, LabelDefinition> _definedLabels; 134 Map<Label, LabelDefinition> _definedLabels;
132 135
133 /// Map from labeled goto statements to the labels they target. 136 /// Map from labeled goto statements to the labels they target.
134 Map<GotoStatement, LabelDefinition> _targetLabels; 137 Map<GotoStatement, LabelDefinition> _targetLabels;
135 138
139 /// Map from nodes to native data.
140 Map<Node, dynamic> _nativeData;
141
136 final int hashCode = ++_hashCodeCounter; 142 final int hashCode = ++_hashCodeCounter;
137 static int _hashCodeCounter = 0; 143 static int _hashCodeCounter = 0;
138 144
139 TreeElementMapping(this.analyzedElement); 145 TreeElementMapping(this.analyzedElement);
140 146
141 operator []=(Node node, Element element) { 147 operator []=(Node node, Element element) {
142 // TODO(johnniwinther): Simplify this invariant to use only declarations in 148 // TODO(johnniwinther): Simplify this invariant to use only declarations in
143 // [TreeElements]. 149 // [TreeElements].
144 assert(invariant(node, () { 150 assert(invariant(node, () {
145 if (!element.isMalformed && analyzedElement != null && element.isPatch) { 151 if (!element.isMalformed && analyzedElement != null && element.isPatch) {
146 return analyzedElement.implementationLibrary.isPatch; 152 return analyzedElement.implementationLibrary.isPatch;
147 } 153 }
148 return true; 154 return true;
149 })); 155 }));
150 // TODO(ahe): Investigate why the invariant below doesn't hold. 156 // TODO(ahe): Investigate why the invariant below doesn't hold.
151 // assert(invariant(node, 157 // assert(invariant(node,
152 // getTreeElement(node) == element || 158 // getTreeElement(node) == element ||
153 // getTreeElement(node) == null, 159 // getTreeElement(node) == null,
154 // message: '${getTreeElement(node)}; $element')); 160 // message: '${getTreeElement(node)}; $element'));
155 161
156 setTreeElement(node, element); 162 setTreeElement(node, element);
157 } 163 }
158 164
165 @override
159 operator [](Node node) => getTreeElement(node); 166 operator [](Node node) => getTreeElement(node);
160 167
168 @override
161 SendStructure getSendStructure(Send node) { 169 SendStructure getSendStructure(Send node) {
162 if (_sendStructureMap == null) return null; 170 if (_sendStructureMap == null) return null;
163 return _sendStructureMap[node]; 171 return _sendStructureMap[node];
164 } 172 }
165 173
166 void setSendStructure(Send node, SendStructure sendStructure) { 174 void setSendStructure(Send node, SendStructure sendStructure) {
167 if (_sendStructureMap == null) { 175 if (_sendStructureMap == null) {
168 _sendStructureMap = new Maplet<Send, SendStructure>(); 176 _sendStructureMap = new Maplet<Send, SendStructure>();
169 } 177 }
170 _sendStructureMap[node] = sendStructure; 178 _sendStructureMap[node] = sendStructure;
171 } 179 }
172 180
181 @override
173 NewStructure getNewStructure(NewExpression node) { 182 NewStructure getNewStructure(NewExpression node) {
174 if (_newStructureMap == null) return null; 183 if (_newStructureMap == null) return null;
175 return _newStructureMap[node]; 184 return _newStructureMap[node];
176 } 185 }
177 186
178 void setNewStructure(NewExpression node, NewStructure newStructure) { 187 void setNewStructure(NewExpression node, NewStructure newStructure) {
179 if (_newStructureMap == null) { 188 if (_newStructureMap == null) {
180 _newStructureMap = new Maplet<NewExpression, NewStructure>(); 189 _newStructureMap = new Maplet<NewExpression, NewStructure>();
181 } 190 }
182 _newStructureMap[node] = newStructure; 191 _newStructureMap[node] = newStructure;
183 } 192 }
184 193
185 void setType(Node node, DartType type) { 194 void setType(Node node, DartType type) {
186 if (_types == null) { 195 if (_types == null) {
187 _types = new Maplet<Node, DartType>(); 196 _types = new Maplet<Node, DartType>();
188 } 197 }
189 _types[node] = type; 198 _types[node] = type;
190 } 199 }
191 200
201 @override
192 DartType getType(Node node) => _types != null ? _types[node] : null; 202 DartType getType(Node node) => _types != null ? _types[node] : null;
193 203
204 @override
194 Iterable<SourceSpan> get superUses { 205 Iterable<SourceSpan> get superUses {
195 return _superUses != null ? _superUses : const <SourceSpan>[]; 206 return _superUses != null ? _superUses : const <SourceSpan>[];
196 } 207 }
197 208
198 void addSuperUse(SourceSpan span) { 209 void addSuperUse(SourceSpan span) {
199 if (_superUses == null) { 210 if (_superUses == null) {
200 _superUses = new Setlet<SourceSpan>(); 211 _superUses = new Setlet<SourceSpan>();
201 } 212 }
202 _superUses.add(span); 213 _superUses.add(span);
203 } 214 }
204 215
205 Selector _getSelector(Spannable node) { 216 Selector _getSelector(Spannable node) {
206 return _selectors != null ? _selectors[node] : null; 217 return _selectors != null ? _selectors[node] : null;
207 } 218 }
208 219
209 void _setSelector(Spannable node, Selector selector) { 220 void _setSelector(Spannable node, Selector selector) {
210 if (_selectors == null) { 221 if (_selectors == null) {
211 _selectors = new Maplet<Spannable, Selector>(); 222 _selectors = new Maplet<Spannable, Selector>();
212 } 223 }
213 _selectors[node] = selector; 224 _selectors[node] = selector;
214 } 225 }
215 226
216 void setSelector(Node node, Selector selector) { 227 void setSelector(Node node, Selector selector) {
217 _setSelector(node, selector); 228 _setSelector(node, selector);
218 } 229 }
219 230
231 @override
220 Selector getSelector(Node node) => _getSelector(node); 232 Selector getSelector(Node node) => _getSelector(node);
221 233
222 int getSelectorCount() => _selectors == null ? 0 : _selectors.length; 234 int getSelectorCount() => _selectors == null ? 0 : _selectors.length;
223 235
224 void setGetterSelectorInComplexSendSet(SendSet node, Selector selector) { 236 void setGetterSelectorInComplexSendSet(SendSet node, Selector selector) {
225 _setSelector(node.selector, selector); 237 _setSelector(node.selector, selector);
226 } 238 }
227 239
240 @override
228 Selector getGetterSelectorInComplexSendSet(SendSet node) { 241 Selector getGetterSelectorInComplexSendSet(SendSet node) {
229 return _getSelector(node.selector); 242 return _getSelector(node.selector);
230 } 243 }
231 244
232 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) { 245 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) {
233 _setSelector(node.assignmentOperator, selector); 246 _setSelector(node.assignmentOperator, selector);
234 } 247 }
235 248
249 @override
236 Selector getOperatorSelectorInComplexSendSet(SendSet node) { 250 Selector getOperatorSelectorInComplexSendSet(SendSet node) {
237 return _getSelector(node.assignmentOperator); 251 return _getSelector(node.assignmentOperator);
238 } 252 }
239 253
254 @override
240 Element getForInVariable(ForIn node) { 255 Element getForInVariable(ForIn node) {
241 return this[node]; 256 return this[node];
242 } 257 }
243 258
259 @override
244 void setConstant(Node node, ConstantExpression constant) { 260 void setConstant(Node node, ConstantExpression constant) {
245 if (_constants == null) { 261 if (_constants == null) {
246 _constants = new Maplet<Node, ConstantExpression>(); 262 _constants = new Maplet<Node, ConstantExpression>();
247 } 263 }
248 _constants[node] = constant; 264 _constants[node] = constant;
249 } 265 }
250 266
267 @override
251 ConstantExpression getConstant(Node node) { 268 ConstantExpression getConstant(Node node) {
252 return _constants != null ? _constants[node] : null; 269 return _constants != null ? _constants[node] : null;
253 } 270 }
254 271
272 @override
255 bool isTypeLiteral(Send node) { 273 bool isTypeLiteral(Send node) {
256 return getType(node) != null; 274 return getType(node) != null;
257 } 275 }
258 276
277 @override
259 DartType getTypeLiteralType(Send node) { 278 DartType getTypeLiteralType(Send node) {
260 return getType(node); 279 return getType(node);
261 } 280 }
262 281
282 @override
263 List<Node> getPotentialMutations(VariableElement element) { 283 List<Node> getPotentialMutations(VariableElement element) {
264 if (_potentiallyMutated == null) return const <Node>[]; 284 if (_potentiallyMutated == null) return const <Node>[];
265 List<Node> mutations = _potentiallyMutated[element]; 285 List<Node> mutations = _potentiallyMutated[element];
266 if (mutations == null) return const <Node>[]; 286 if (mutations == null) return const <Node>[];
267 return mutations; 287 return mutations;
268 } 288 }
269 289
270 void registerPotentialMutation(VariableElement element, Node mutationNode) { 290 void registerPotentialMutation(VariableElement element, Node mutationNode) {
271 if (_potentiallyMutated == null) { 291 if (_potentiallyMutated == null) {
272 _potentiallyMutated = new Maplet<VariableElement, List<Node>>(); 292 _potentiallyMutated = new Maplet<VariableElement, List<Node>>();
273 } 293 }
274 _potentiallyMutated.putIfAbsent(element, () => <Node>[]).add(mutationNode); 294 _potentiallyMutated.putIfAbsent(element, () => <Node>[]).add(mutationNode);
275 } 295 }
276 296
297 @override
277 List<Node> getPotentialMutationsIn(Node node, VariableElement element) { 298 List<Node> getPotentialMutationsIn(Node node, VariableElement element) {
278 if (_potentiallyMutatedIn == null) return const <Node>[]; 299 if (_potentiallyMutatedIn == null) return const <Node>[];
279 Map<VariableElement, List<Node>> mutationsIn = _potentiallyMutatedIn[node]; 300 Map<VariableElement, List<Node>> mutationsIn = _potentiallyMutatedIn[node];
280 if (mutationsIn == null) return const <Node>[]; 301 if (mutationsIn == null) return const <Node>[];
281 List<Node> mutations = mutationsIn[element]; 302 List<Node> mutations = mutationsIn[element];
282 if (mutations == null) return const <Node>[]; 303 if (mutations == null) return const <Node>[];
283 return mutations; 304 return mutations;
284 } 305 }
285 306
286 void registerPotentialMutationIn( 307 void registerPotentialMutationIn(
287 Node contextNode, VariableElement element, Node mutationNode) { 308 Node contextNode, VariableElement element, Node mutationNode) {
288 if (_potentiallyMutatedIn == null) { 309 if (_potentiallyMutatedIn == null) {
289 _potentiallyMutatedIn = 310 _potentiallyMutatedIn =
290 new Maplet<Node, Map<VariableElement, List<Node>>>(); 311 new Maplet<Node, Map<VariableElement, List<Node>>>();
291 } 312 }
292 Map<VariableElement, List<Node>> mutationMap = 313 Map<VariableElement, List<Node>> mutationMap =
293 _potentiallyMutatedIn.putIfAbsent( 314 _potentiallyMutatedIn.putIfAbsent(
294 contextNode, () => new Maplet<VariableElement, List<Node>>()); 315 contextNode, () => new Maplet<VariableElement, List<Node>>());
295 mutationMap.putIfAbsent(element, () => <Node>[]).add(mutationNode); 316 mutationMap.putIfAbsent(element, () => <Node>[]).add(mutationNode);
296 } 317 }
297 318
319 @override
298 List<Node> getPotentialMutationsInClosure(VariableElement element) { 320 List<Node> getPotentialMutationsInClosure(VariableElement element) {
299 if (_potentiallyMutatedInClosure == null) return const <Node>[]; 321 if (_potentiallyMutatedInClosure == null) return const <Node>[];
300 List<Node> mutations = _potentiallyMutatedInClosure[element]; 322 List<Node> mutations = _potentiallyMutatedInClosure[element];
301 if (mutations == null) return const <Node>[]; 323 if (mutations == null) return const <Node>[];
302 return mutations; 324 return mutations;
303 } 325 }
304 326
305 void registerPotentialMutationInClosure( 327 void registerPotentialMutationInClosure(
306 VariableElement element, Node mutationNode) { 328 VariableElement element, Node mutationNode) {
307 if (_potentiallyMutatedInClosure == null) { 329 if (_potentiallyMutatedInClosure == null) {
308 _potentiallyMutatedInClosure = new Maplet<VariableElement, List<Node>>(); 330 _potentiallyMutatedInClosure = new Maplet<VariableElement, List<Node>>();
309 } 331 }
310 _potentiallyMutatedInClosure 332 _potentiallyMutatedInClosure
311 .putIfAbsent(element, () => <Node>[]) 333 .putIfAbsent(element, () => <Node>[])
312 .add(mutationNode); 334 .add(mutationNode);
313 } 335 }
314 336
337 @override
315 List<Node> getAccessesByClosureIn(Node node, VariableElement element) { 338 List<Node> getAccessesByClosureIn(Node node, VariableElement element) {
316 if (_accessedByClosureIn == null) return const <Node>[]; 339 if (_accessedByClosureIn == null) return const <Node>[];
317 Map<VariableElement, List<Node>> accessesIn = _accessedByClosureIn[node]; 340 Map<VariableElement, List<Node>> accessesIn = _accessedByClosureIn[node];
318 if (accessesIn == null) return const <Node>[]; 341 if (accessesIn == null) return const <Node>[];
319 List<Node> accesses = accessesIn[element]; 342 List<Node> accesses = accessesIn[element];
320 if (accesses == null) return const <Node>[]; 343 if (accesses == null) return const <Node>[];
321 return accesses; 344 return accesses;
322 } 345 }
323 346
324 void setAccessedByClosureIn( 347 void setAccessedByClosureIn(
325 Node contextNode, VariableElement element, Node accessNode) { 348 Node contextNode, VariableElement element, Node accessNode) {
326 if (_accessedByClosureIn == null) { 349 if (_accessedByClosureIn == null) {
327 _accessedByClosureIn = new Map<Node, Map<VariableElement, List<Node>>>(); 350 _accessedByClosureIn = new Map<Node, Map<VariableElement, List<Node>>>();
328 } 351 }
329 Map<VariableElement, List<Node>> accessMap = 352 Map<VariableElement, List<Node>> accessMap =
330 _accessedByClosureIn.putIfAbsent( 353 _accessedByClosureIn.putIfAbsent(
331 contextNode, () => new Maplet<VariableElement, List<Node>>()); 354 contextNode, () => new Maplet<VariableElement, List<Node>>());
332 accessMap.putIfAbsent(element, () => <Node>[]).add(accessNode); 355 accessMap.putIfAbsent(element, () => <Node>[]).add(accessNode);
333 } 356 }
334 357
335 String toString() => 'TreeElementMapping($analyzedElement)'; 358 String toString() => 'TreeElementMapping($analyzedElement)';
336 359
360 @override
337 void forEachConstantNode(f(Node n, ConstantExpression c)) { 361 void forEachConstantNode(f(Node n, ConstantExpression c)) {
338 if (_constants != null) { 362 if (_constants != null) {
339 _constants.forEach(f); 363 _constants.forEach(f);
340 } 364 }
341 } 365 }
342 366
367 @override
343 FunctionElement getFunctionDefinition(FunctionExpression node) { 368 FunctionElement getFunctionDefinition(FunctionExpression node) {
344 return this[node]; 369 return this[node];
345 } 370 }
346 371
372 @override
347 ConstructorElement getRedirectingTargetConstructor( 373 ConstructorElement getRedirectingTargetConstructor(
348 RedirectingFactoryBody node) { 374 RedirectingFactoryBody node) {
349 return this[node]; 375 return this[node];
350 } 376 }
351 377
352 void defineTarget(Node node, JumpTarget target) { 378 void defineTarget(Node node, JumpTarget target) {
353 if (_definedTargets == null) { 379 if (_definedTargets == null) {
354 _definedTargets = new Maplet<Node, JumpTarget>(); 380 _definedTargets = new Maplet<Node, JumpTarget>();
355 } 381 }
356 _definedTargets[node] = target; 382 _definedTargets[node] = target;
357 } 383 }
358 384
359 void undefineTarget(Node node) { 385 void undefineTarget(Node node) {
360 if (_definedTargets != null) { 386 if (_definedTargets != null) {
361 _definedTargets.remove(node); 387 _definedTargets.remove(node);
362 if (_definedTargets.isEmpty) { 388 if (_definedTargets.isEmpty) {
363 _definedTargets = null; 389 _definedTargets = null;
364 } 390 }
365 } 391 }
366 } 392 }
367 393
394 @override
368 JumpTarget getTargetDefinition(Node node) { 395 JumpTarget getTargetDefinition(Node node) {
369 return _definedTargets != null ? _definedTargets[node] : null; 396 return _definedTargets != null ? _definedTargets[node] : null;
370 } 397 }
371 398
372 void registerTargetOf(GotoStatement node, JumpTarget target) { 399 void registerTargetOf(GotoStatement node, JumpTarget target) {
373 if (_usedTargets == null) { 400 if (_usedTargets == null) {
374 _usedTargets = new Maplet<GotoStatement, JumpTarget>(); 401 _usedTargets = new Maplet<GotoStatement, JumpTarget>();
375 } 402 }
376 _usedTargets[node] = target; 403 _usedTargets[node] = target;
377 } 404 }
378 405
406 @override
379 JumpTarget getTargetOf(GotoStatement node) { 407 JumpTarget getTargetOf(GotoStatement node) {
380 return _usedTargets != null ? _usedTargets[node] : null; 408 return _usedTargets != null ? _usedTargets[node] : null;
381 } 409 }
382 410
383 void defineLabel(Label label, LabelDefinition target) { 411 void defineLabel(Label label, LabelDefinition target) {
384 if (_definedLabels == null) { 412 if (_definedLabels == null) {
385 _definedLabels = new Maplet<Label, LabelDefinition>(); 413 _definedLabels = new Maplet<Label, LabelDefinition>();
386 } 414 }
387 _definedLabels[label] = target; 415 _definedLabels[label] = target;
388 } 416 }
389 417
390 void undefineLabel(Label label) { 418 void undefineLabel(Label label) {
391 if (_definedLabels != null) { 419 if (_definedLabels != null) {
392 _definedLabels.remove(label); 420 _definedLabels.remove(label);
393 if (_definedLabels.isEmpty) { 421 if (_definedLabels.isEmpty) {
394 _definedLabels = null; 422 _definedLabels = null;
395 } 423 }
396 } 424 }
397 } 425 }
398 426
427 @override
399 LabelDefinition getLabelDefinition(Label label) { 428 LabelDefinition getLabelDefinition(Label label) {
400 return _definedLabels != null ? _definedLabels[label] : null; 429 return _definedLabels != null ? _definedLabels[label] : null;
401 } 430 }
402 431
403 void registerTargetLabel(GotoStatement node, LabelDefinition label) { 432 void registerTargetLabel(GotoStatement node, LabelDefinition label) {
404 assert(node.target != null); 433 assert(node.target != null);
405 if (_targetLabels == null) { 434 if (_targetLabels == null) {
406 _targetLabels = new Maplet<GotoStatement, LabelDefinition>(); 435 _targetLabels = new Maplet<GotoStatement, LabelDefinition>();
407 } 436 }
408 _targetLabels[node] = label; 437 _targetLabels[node] = label;
409 } 438 }
410 439
440 @override
411 LabelDefinition getTargetLabel(GotoStatement node) { 441 LabelDefinition getTargetLabel(GotoStatement node) {
412 assert(node.target != null); 442 assert(node.target != null);
413 return _targetLabels != null ? _targetLabels[node] : null; 443 return _targetLabels != null ? _targetLabels[node] : null;
414 } 444 }
415 445
416 TypeMask _getTypeMask(Spannable node) { 446 TypeMask _getTypeMask(Spannable node) {
417 return _typeMasks != null ? _typeMasks[node] : null; 447 return _typeMasks != null ? _typeMasks[node] : null;
418 } 448 }
419 449
420 void _setTypeMask(Spannable node, TypeMask mask) { 450 void _setTypeMask(Spannable node, TypeMask mask) {
421 if (_typeMasks == null) { 451 if (_typeMasks == null) {
422 _typeMasks = new Maplet<Spannable, TypeMask>(); 452 _typeMasks = new Maplet<Spannable, TypeMask>();
423 } 453 }
424 _typeMasks[node] = mask; 454 _typeMasks[node] = mask;
425 } 455 }
426 456
457 @override
427 void setTypeMask(Node node, TypeMask mask) { 458 void setTypeMask(Node node, TypeMask mask) {
428 _setTypeMask(node, mask); 459 _setTypeMask(node, mask);
429 } 460 }
430 461
462 @override
431 TypeMask getTypeMask(Node node) => _getTypeMask(node); 463 TypeMask getTypeMask(Node node) => _getTypeMask(node);
432 464
465 @override
433 void setGetterTypeMaskInComplexSendSet(SendSet node, TypeMask mask) { 466 void setGetterTypeMaskInComplexSendSet(SendSet node, TypeMask mask) {
434 _setTypeMask(node.selector, mask); 467 _setTypeMask(node.selector, mask);
435 } 468 }
436 469
470 @override
437 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node) { 471 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node) {
438 return _getTypeMask(node.selector); 472 return _getTypeMask(node.selector);
439 } 473 }
440 474
475 @override
441 void setOperatorTypeMaskInComplexSendSet(SendSet node, TypeMask mask) { 476 void setOperatorTypeMaskInComplexSendSet(SendSet node, TypeMask mask) {
442 _setTypeMask(node.assignmentOperator, mask); 477 _setTypeMask(node.assignmentOperator, mask);
443 } 478 }
444 479
480 @override
445 TypeMask getOperatorTypeMaskInComplexSendSet(SendSet node) { 481 TypeMask getOperatorTypeMaskInComplexSendSet(SendSet node) {
446 return _getTypeMask(node.assignmentOperator); 482 return _getTypeMask(node.assignmentOperator);
447 } 483 }
448 484
449 // The following methods set selectors on the "for in" node. Since 485 // The following methods set selectors on the "for in" node. Since
450 // we're using three selectors, we need to use children of the node, 486 // we're using three selectors, we need to use children of the node,
451 // and we arbitrarily choose which ones. 487 // and we arbitrarily choose which ones.
452 488
489 @override
453 void setIteratorTypeMask(ForIn node, TypeMask mask) { 490 void setIteratorTypeMask(ForIn node, TypeMask mask) {
454 _setTypeMask(node, mask); 491 _setTypeMask(node, mask);
455 } 492 }
456 493
494 @override
457 TypeMask getIteratorTypeMask(ForIn node) { 495 TypeMask getIteratorTypeMask(ForIn node) {
458 return _getTypeMask(node); 496 return _getTypeMask(node);
459 } 497 }
460 498
499 @override
461 void setMoveNextTypeMask(ForIn node, TypeMask mask) { 500 void setMoveNextTypeMask(ForIn node, TypeMask mask) {
462 _setTypeMask(node.forToken, mask); 501 _setTypeMask(node.forToken, mask);
463 } 502 }
464 503
504 @override
465 TypeMask getMoveNextTypeMask(ForIn node) { 505 TypeMask getMoveNextTypeMask(ForIn node) {
466 return _getTypeMask(node.forToken); 506 return _getTypeMask(node.forToken);
467 } 507 }
468 508
509 @override
469 void setCurrentTypeMask(ForIn node, TypeMask mask) { 510 void setCurrentTypeMask(ForIn node, TypeMask mask) {
470 _setTypeMask(node.inToken, mask); 511 _setTypeMask(node.inToken, mask);
471 } 512 }
472 513
514 @override
473 TypeMask getCurrentTypeMask(ForIn node) { 515 TypeMask getCurrentTypeMask(ForIn node) {
474 return _getTypeMask(node.inToken); 516 return _getTypeMask(node.inToken);
475 } 517 }
518
519 void registerNativeData(Node node, dynamic nativeData) {
520 if (_nativeData == null) {
521 _nativeData = <Node, dynamic>{};
522 }
523 _nativeData[node] = nativeData;
524 }
525
526 @override
527 dynamic getNativeData(Node node) {
528 return _nativeData != null ? _nativeData[node] : null;
529 }
476 } 530 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/serialization/equivalence.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698