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 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 '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
10 import '../diagnostics/source_span.dart'; | 10 import '../diagnostics/source_span.dart'; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 String toString() => 'TreeElementMapping($analyzedElement)'; | 345 String toString() => 'TreeElementMapping($analyzedElement)'; |
346 | 346 |
347 @override | 347 @override |
348 void forEachConstantNode(f(Node n, ConstantExpression c)) { | 348 void forEachConstantNode(f(Node n, ConstantExpression c)) { |
349 if (_constants != null) { | 349 if (_constants != null) { |
350 _constants.forEach(f); | 350 _constants.forEach(f); |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 @override | 354 @override |
355 Element getFunctionDefinition(FunctionExpression node) { | 355 FunctionElement getFunctionDefinition(FunctionExpression node) { |
356 return this[node]; | 356 Element e = this[node]; |
| 357 return e is FunctionElement ? e : null; |
357 } | 358 } |
358 | 359 |
359 @override | 360 @override |
360 ConstructorElement getRedirectingTargetConstructor( | 361 ConstructorElement getRedirectingTargetConstructor( |
361 RedirectingFactoryBody node) { | 362 RedirectingFactoryBody node) { |
362 return this[node]; | 363 return this[node]; |
363 } | 364 } |
364 | 365 |
365 void defineTarget(Node node, JumpTarget target) { | 366 void defineTarget(Node node, JumpTarget target) { |
366 _definedTargets ??= new Maplet<Node, JumpTarget>(); | 367 _definedTargets ??= new Maplet<Node, JumpTarget>(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 _nativeData = <Node, dynamic>{}; | 430 _nativeData = <Node, dynamic>{}; |
430 } | 431 } |
431 _nativeData[node] = nativeData; | 432 _nativeData[node] = nativeData; |
432 } | 433 } |
433 | 434 |
434 @override | 435 @override |
435 dynamic getNativeData(Node node) { | 436 dynamic getNativeData(Node node) { |
436 return _nativeData != null ? _nativeData[node] : null; | 437 return _nativeData != null ? _nativeData[node] : null; |
437 } | 438 } |
438 } | 439 } |
OLD | NEW |