| 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 import 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/dart/ast/visitor.dart'; | 6 import 'package:analyzer/dart/ast/visitor.dart'; |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/constant.dart'; | 8 import 'package:analyzer/src/generated/constant.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart' | 9 import 'package:analyzer/src/generated/error.dart' |
| 10 show AnalysisErrorListener, ErrorReporter; | 10 show AnalysisErrorListener, ErrorReporter; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // ConstantEvaluator will not compute constants for non-const fields, | 129 // ConstantEvaluator will not compute constants for non-const fields, |
| 130 // so run ConstantVisitor for those to figure out if the initializer is | 130 // so run ConstantVisitor for those to figure out if the initializer is |
| 131 // actually a constant (and therefore side effect free to evaluate). | 131 // actually a constant (and therefore side effect free to evaluate). |
| 132 assert(!field.isConst); | 132 assert(!field.isConst); |
| 133 | 133 |
| 134 var initializer = field.initializer; | 134 var initializer = field.initializer; |
| 135 if (initializer == null) return null; | 135 if (initializer == null) return null; |
| 136 return initializer.accept(_constantVisitor); | 136 return initializer.accept(_constantVisitor); |
| 137 } | 137 } |
| 138 } | 138 } |
| OLD | NEW |