| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.constant; | 5 library analyzer.src.generated.constant; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 Object visitVariableDeclaration(VariableDeclaration node) { | 1314 Object visitVariableDeclaration(VariableDeclaration node) { |
| 1315 super.visitVariableDeclaration(node); | 1315 super.visitVariableDeclaration(node); |
| 1316 Expression initializer = node.initializer; | 1316 Expression initializer = node.initializer; |
| 1317 VariableElement element = node.element; | 1317 VariableElement element = node.element; |
| 1318 if (initializer != null && | 1318 if (initializer != null && |
| 1319 (node.isConst || | 1319 (node.isConst || |
| 1320 treatFinalInstanceVarAsConst && | 1320 treatFinalInstanceVarAsConst && |
| 1321 element is FieldElement && | 1321 element is FieldElement && |
| 1322 node.isFinal && | 1322 node.isFinal && |
| 1323 !element.isStatic)) { | 1323 !element.isStatic)) { |
| 1324 if (node.element != null) { | 1324 if (element != null) { |
| 1325 constantsToCompute.add(node.element); | 1325 constantsToCompute.add(element); |
| 1326 } | 1326 } |
| 1327 } | 1327 } |
| 1328 return null; | 1328 return null; |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 /** | 1332 /** |
| 1333 * An object used to compute the values of constant variables and constant | 1333 * An object used to compute the values of constant variables and constant |
| 1334 * constructor invocations in one or more compilation units. The expected usage | 1334 * constructor invocations in one or more compilation units. The expected usage |
| 1335 * pattern is for the compilation units to be added to this computer using the | 1335 * pattern is for the compilation units to be added to this computer using the |
| (...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5413 return BoolState.from(_element == rightElement); | 5413 return BoolState.from(_element == rightElement); |
| 5414 } else if (rightOperand is DynamicState) { | 5414 } else if (rightOperand is DynamicState) { |
| 5415 return BoolState.UNKNOWN_VALUE; | 5415 return BoolState.UNKNOWN_VALUE; |
| 5416 } | 5416 } |
| 5417 return BoolState.FALSE_STATE; | 5417 return BoolState.FALSE_STATE; |
| 5418 } | 5418 } |
| 5419 | 5419 |
| 5420 @override | 5420 @override |
| 5421 String toString() => _element == null ? "-unknown-" : _element.name; | 5421 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5422 } | 5422 } |
| OLD | NEW |