| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.constant; | 8 library engine.constant; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // which case we skip it. | 363 // which case we skip it. |
| 364 if (elementAnnotation != null) { | 364 if (elementAnnotation != null) { |
| 365 Element element = elementAnnotation.element; | 365 Element element = elementAnnotation.element; |
| 366 if (element is PropertyAccessorElement && | 366 if (element is PropertyAccessorElement && |
| 367 element.variable is VariableElementImpl) { | 367 element.variable is VariableElementImpl) { |
| 368 // The annotation is a reference to a compile-time constant variable. | 368 // The annotation is a reference to a compile-time constant variable. |
| 369 // Just copy the evaluation result. | 369 // Just copy the evaluation result. |
| 370 VariableElementImpl variableElement = | 370 VariableElementImpl variableElement = |
| 371 element.variable as VariableElementImpl; | 371 element.variable as VariableElementImpl; |
| 372 elementAnnotation.evaluationResult = variableElement.evaluationResult; | 372 elementAnnotation.evaluationResult = variableElement.evaluationResult; |
| 373 } else if (element is ConstructorElementImpl && | 373 } else if (element is ConstructorElementImpl && element.isConst && |
| 374 constNode.arguments != null) { | 374 constNode.arguments != null) { |
| 375 RecordingErrorListener errorListener = new RecordingErrorListener(); | 375 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 376 CompilationUnit sourceCompilationUnit = | 376 CompilationUnit sourceCompilationUnit = |
| 377 constNode.getAncestor((node) => node is CompilationUnit); | 377 constNode.getAncestor((node) => node is CompilationUnit); |
| 378 ErrorReporter errorReporter = new ErrorReporter( | 378 ErrorReporter errorReporter = new ErrorReporter( |
| 379 errorListener, sourceCompilationUnit.element.source); | 379 errorListener, sourceCompilationUnit.element.source); |
| 380 ConstantVisitor constantVisitor = | 380 ConstantVisitor constantVisitor = |
| 381 new ConstantVisitor(this, errorReporter); | 381 new ConstantVisitor(this, errorReporter); |
| 382 DartObjectImpl result = evaluateConstructorCall(constNode, | 382 DartObjectImpl result = evaluateConstructorCall(constNode, |
| 383 constNode.arguments.arguments, element, constantVisitor, | 383 constNode.arguments.arguments, element, constantVisitor, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (elementAnnotation != null) { | 478 if (elementAnnotation != null) { |
| 479 Element element = elementAnnotation.element; | 479 Element element = elementAnnotation.element; |
| 480 if (element is PropertyAccessorElement && | 480 if (element is PropertyAccessorElement && |
| 481 element.variable is VariableElementImpl) { | 481 element.variable is VariableElementImpl) { |
| 482 // The annotation is a reference to a compile-time constant variable, | 482 // The annotation is a reference to a compile-time constant variable, |
| 483 // so it depends on the variable. | 483 // so it depends on the variable. |
| 484 callback(element.variable); | 484 callback(element.variable); |
| 485 } else if (element is ConstructorElementImpl && element.isConst) { | 485 } else if (element is ConstructorElementImpl && element.isConst) { |
| 486 // The annotation is a constructor invocation, so it depends on the | 486 // The annotation is a constructor invocation, so it depends on the |
| 487 // constructor. | 487 // constructor. |
| 488 // TODO(paulberry): make sure the right thing happens if the | |
| 489 // constructor is non-const. | |
| 490 callback(element); | 488 callback(element); |
| 491 } else { | 489 } else { |
| 492 // This could happen in the event of invalid code. The error will be | 490 // This could happen in the event of invalid code. The error will be |
| 493 // reported at constant evaluation time. | 491 // reported at constant evaluation time. |
| 494 } | 492 } |
| 495 } | 493 } |
| 496 if (constNode.arguments != null) { | 494 if (constNode.arguments != null) { |
| 497 constNode.arguments.accept(referenceFinder); | 495 constNode.arguments.accept(referenceFinder); |
| 498 } | 496 } |
| 499 } else { | 497 } else { |
| (...skipping 4718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5218 return BoolState.from(_element == rightElement); | 5216 return BoolState.from(_element == rightElement); |
| 5219 } else if (rightOperand is DynamicState) { | 5217 } else if (rightOperand is DynamicState) { |
| 5220 return BoolState.UNKNOWN_VALUE; | 5218 return BoolState.UNKNOWN_VALUE; |
| 5221 } | 5219 } |
| 5222 return BoolState.FALSE_STATE; | 5220 return BoolState.FALSE_STATE; |
| 5223 } | 5221 } |
| 5224 | 5222 |
| 5225 @override | 5223 @override |
| 5226 String toString() => _element == null ? "-unknown-" : _element.name; | 5224 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5227 } | 5225 } |
| OLD | NEW |