OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.modelx; | 5 library elements.modelx; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution, Parsing; | 8 import '../common/resolution.dart' show Resolution, Parsing; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constant_constructors.dart'; | 10 import '../constants/constant_constructors.dart'; |
(...skipping 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 /// found through [declaration] since its node define the inheritance relation | 3261 /// found through [declaration] since its node define the inheritance relation |
3262 /// for the class. For unpatched elements the defining element is the element | 3262 /// for the class. For unpatched elements the defining element is the element |
3263 /// itself. | 3263 /// itself. |
3264 AstElement get definingElement; | 3264 AstElement get definingElement; |
3265 | 3265 |
3266 bool get hasResolvedAst { | 3266 bool get hasResolvedAst { |
3267 return definingElement.hasNode && definingElement.hasTreeElements; | 3267 return definingElement.hasNode && definingElement.hasTreeElements; |
3268 } | 3268 } |
3269 | 3269 |
3270 ResolvedAst get resolvedAst { | 3270 ResolvedAst get resolvedAst { |
| 3271 Node node = definingElement.node; |
| 3272 Node body; |
| 3273 if (definingElement.isField) { |
| 3274 FieldElement field = definingElement; |
| 3275 body = field.initializer; |
| 3276 } else if (node != null && node.asFunctionExpression() != null) { |
| 3277 body = node.asFunctionExpression().body; |
| 3278 } |
3271 return new ParsedResolvedAst( | 3279 return new ParsedResolvedAst( |
3272 declaration, definingElement.node, definingElement.treeElements); | 3280 declaration, node, body, definingElement.treeElements); |
3273 } | 3281 } |
3274 } | 3282 } |
OLD | NEW |