| 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/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 treatFinalInstanceVarAsConst && | 1323 treatFinalInstanceVarAsConst && |
| 1324 element is FieldElement && | 1324 element is FieldElement && |
| 1325 node.isFinal && | 1325 node.isFinal && |
| 1326 !element.isStatic)) { | 1326 !element.isStatic)) { |
| 1327 if (node.element != null) { | 1327 if (node.element != null) { |
| 1328 constantsToCompute.add(node.element); | 1328 constantsToCompute.add(node.element); |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 return null; | 1331 return null; |
| 1332 } | 1332 } |
| 1333 | |
| 1334 AnalysisContext _getOwningContext() { | |
| 1335 if (context is InternalAnalysisContext) { | |
| 1336 InternalAnalysisContext internalContext = context; | |
| 1337 return internalContext.getContextFor(librarySource); | |
| 1338 } | |
| 1339 return context; | |
| 1340 } | |
| 1341 } | 1333 } |
| 1342 | 1334 |
| 1343 /** | 1335 /** |
| 1344 * An object used to compute the values of constant variables and constant | 1336 * An object used to compute the values of constant variables and constant |
| 1345 * constructor invocations in one or more compilation units. The expected usage | 1337 * constructor invocations in one or more compilation units. The expected usage |
| 1346 * pattern is for the compilation units to be added to this computer using the | 1338 * pattern is for the compilation units to be added to this computer using the |
| 1347 * method [add] and then for the method [computeValues] to be invoked exactly | 1339 * method [add] and then for the method [computeValues] to be invoked exactly |
| 1348 * once. Any use of an instance after invoking the method [computeValues] will | 1340 * once. Any use of an instance after invoking the method [computeValues] will |
| 1349 * result in unpredictable behavior. | 1341 * result in unpredictable behavior. |
| 1350 */ | 1342 */ |
| (...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5426 return BoolState.from(_element == rightElement); | 5418 return BoolState.from(_element == rightElement); |
| 5427 } else if (rightOperand is DynamicState) { | 5419 } else if (rightOperand is DynamicState) { |
| 5428 return BoolState.UNKNOWN_VALUE; | 5420 return BoolState.UNKNOWN_VALUE; |
| 5429 } | 5421 } |
| 5430 return BoolState.FALSE_STATE; | 5422 return BoolState.FALSE_STATE; |
| 5431 } | 5423 } |
| 5432 | 5424 |
| 5433 @override | 5425 @override |
| 5434 String toString() => _element == null ? "-unknown-" : _element.name; | 5426 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5435 } | 5427 } |
| OLD | NEW |