| 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.dart.constant.evaluation; | 5 library analyzer.src.dart.constant.evaluation; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/context/declared_variables.dart'; | 9 import 'package:analyzer/context/declared_variables.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // so it depends on the variable. | 340 // so it depends on the variable. |
| 341 callback(element.variable); | 341 callback(element.variable); |
| 342 } else if (element is ConstructorElementImpl) { | 342 } else if (element is ConstructorElementImpl) { |
| 343 // The annotation is a constructor invocation, so it depends on the | 343 // The annotation is a constructor invocation, so it depends on the |
| 344 // constructor. | 344 // constructor. |
| 345 callback(element); | 345 callback(element); |
| 346 } else { | 346 } else { |
| 347 // This could happen in the event of invalid code. The error will be | 347 // This could happen in the event of invalid code. The error will be |
| 348 // reported at constant evaluation time. | 348 // reported at constant evaluation time. |
| 349 } | 349 } |
| 350 if (constNode.arguments != null) { | 350 if (constNode == null) { |
| 351 // We cannot determine what element the annotation is on, nor the offset |
| 352 // of the annotation, so there's not a lot of information in this |
| 353 // message, but it's better than getting an exception. |
| 354 AnalysisEngine.instance.logger.logInformation( |
| 355 'No annotationAst for $constant in ${constant.compilationUnit}'); |
| 356 } else if (constNode.arguments != null) { |
| 351 constNode.arguments.accept(referenceFinder); | 357 constNode.arguments.accept(referenceFinder); |
| 352 } | 358 } |
| 353 } else if (constant is VariableElement) { | 359 } else if (constant is VariableElement) { |
| 354 // constant is a VariableElement but not a VariableElementImpl. This can | 360 // constant is a VariableElement but not a VariableElementImpl. This can |
| 355 // happen sometimes in the case of invalid user code (for example, a | 361 // happen sometimes in the case of invalid user code (for example, a |
| 356 // constant expression that refers to a non-static field inside a generic | 362 // constant expression that refers to a non-static field inside a generic |
| 357 // class will wind up referring to a FieldMember). So just don't bother | 363 // class will wind up referring to a FieldMember). So just don't bother |
| 358 // computing any dependencies. | 364 // computing any dependencies. |
| 359 } else { | 365 } else { |
| 360 // Should not happen. | 366 // Should not happen. |
| (...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 } | 1987 } |
| 1982 | 1988 |
| 1983 @override | 1989 @override |
| 1984 String toString() { | 1990 String toString() { |
| 1985 if (value == null) { | 1991 if (value == null) { |
| 1986 return "error"; | 1992 return "error"; |
| 1987 } | 1993 } |
| 1988 return value.toString(); | 1994 return value.toString(); |
| 1989 } | 1995 } |
| 1990 } | 1996 } |
| OLD | NEW |