| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 /** | 539 /** |
| 540 * Compute a value for the given constant. | 540 * Compute a value for the given constant. |
| 541 * | 541 * |
| 542 * @param constNode the constant for which a value is to be computed | 542 * @param constNode the constant for which a value is to be computed |
| 543 */ | 543 */ |
| 544 void _computeValueFor(AstNode constNode) { | 544 void _computeValueFor(AstNode constNode) { |
| 545 beforeComputeValue(constNode); | 545 beforeComputeValue(constNode); |
| 546 if (constNode is VariableDeclaration) { | 546 if (constNode is VariableDeclaration) { |
| 547 VariableDeclaration declaration = constNode; | 547 VariableDeclaration declaration = constNode; |
| 548 Element element = declaration.element; | 548 VariableElement element = declaration.element; |
| 549 RecordingErrorListener errorListener = new RecordingErrorListener(); | 549 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 550 ErrorReporter errorReporter = new ErrorReporter(errorListener, element.sou
rce); | 550 ErrorReporter errorReporter = new ErrorReporter(errorListener, element.sou
rce); |
| 551 DartObjectImpl dartObject = declaration.initializer.accept(createConstantV
isitor(errorReporter)); | 551 DartObjectImpl dartObject = declaration.initializer.accept(createConstantV
isitor(errorReporter)); |
| 552 if (dartObject != null) { |
| 553 if (!dartObject.isNull && !dartObject.type.isSubtypeOf(element.type)) { |
| 554 errorReporter.reportErrorForNode( |
| 555 CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH, |
| 556 declaration, [dartObject.type, element.type]); |
| 557 } |
| 558 } |
| 552 (element as VariableElementImpl).evaluationResult = new EvaluationResultIm
pl.con2(dartObject, errorListener.errors); | 559 (element as VariableElementImpl).evaluationResult = new EvaluationResultIm
pl.con2(dartObject, errorListener.errors); |
| 553 } else if (constNode is InstanceCreationExpression) { | 560 } else if (constNode is InstanceCreationExpression) { |
| 554 InstanceCreationExpression expression = constNode; | 561 InstanceCreationExpression expression = constNode; |
| 555 ConstructorElement constructor = expression.staticElement; | 562 ConstructorElement constructor = expression.staticElement; |
| 556 if (constructor == null) { | 563 if (constructor == null) { |
| 557 // Couldn't resolve the constructor so we can't compute a value. No pro
blem--the error | 564 // Couldn't resolve the constructor so we can't compute a value. No pro
blem--the error |
| 558 // has already been reported. But we still need to store an evaluation
result. | 565 // has already been reported. But we still need to store an evaluation
result. |
| 559 expression.evaluationResult = new EvaluationResultImpl.con1(null); | 566 expression.evaluationResult = new EvaluationResultImpl.con1(null); |
| 560 return; | 567 return; |
| 561 } | 568 } |
| (...skipping 4065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4627 | 4634 |
| 4628 @override | 4635 @override |
| 4629 String get typeName => "Type"; | 4636 String get typeName => "Type"; |
| 4630 | 4637 |
| 4631 @override | 4638 @override |
| 4632 int get hashCode => _element == null ? 0 : _element.hashCode; | 4639 int get hashCode => _element == null ? 0 : _element.hashCode; |
| 4633 | 4640 |
| 4634 @override | 4641 @override |
| 4635 String toString() => _element == null ? "-unknown-" : _element.name; | 4642 String toString() => _element == null ? "-unknown-" : _element.name; |
| 4636 } | 4643 } |
| OLD | NEW |