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, ParsingContext; | 8 import '../common/resolution.dart' show Resolution, ParsingContext; |
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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 } | 1390 } |
1391 | 1391 |
1392 abstract class ConstantVariableMixin implements VariableElement { | 1392 abstract class ConstantVariableMixin implements VariableElement { |
1393 ConstantExpression constantCache; | 1393 ConstantExpression constantCache; |
1394 | 1394 |
1395 ConstantExpression get constant { | 1395 ConstantExpression get constant { |
1396 if (isPatch) { | 1396 if (isPatch) { |
1397 ConstantVariableMixin originVariable = origin; | 1397 ConstantVariableMixin originVariable = origin; |
1398 return originVariable.constant; | 1398 return originVariable.constant; |
1399 } | 1399 } |
1400 assert(invariant(this, constantCache != null, | 1400 assert(invariant(this, !isConst || constantCache != null, |
1401 message: "Constant has not been computed for $this.")); | 1401 message: "Constant has not been computed for $this.")); |
1402 return constantCache; | 1402 return constantCache; |
1403 } | 1403 } |
1404 | 1404 |
1405 void set constant(ConstantExpression value) { | 1405 void set constant(ConstantExpression value) { |
1406 if (isPatch) { | 1406 if (isPatch) { |
1407 ConstantVariableMixin originVariable = origin; | 1407 ConstantVariableMixin originVariable = origin; |
1408 originVariable.constant = value; | 1408 originVariable.constant = value; |
1409 return; | 1409 return; |
1410 } | 1410 } |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3274 if (definingElement.isField) { | 3274 if (definingElement.isField) { |
3275 FieldElement field = definingElement; | 3275 FieldElement field = definingElement; |
3276 body = field.initializer; | 3276 body = field.initializer; |
3277 } else if (node != null && node.asFunctionExpression() != null) { | 3277 } else if (node != null && node.asFunctionExpression() != null) { |
3278 body = node.asFunctionExpression().body; | 3278 body = node.asFunctionExpression().body; |
3279 } | 3279 } |
3280 return new ParsedResolvedAst( | 3280 return new ParsedResolvedAst( |
3281 declaration, node, body, definingElement.treeElements); | 3281 declaration, node, body, definingElement.treeElements); |
3282 } | 3282 } |
3283 } | 3283 } |
OLD | NEW |