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 engine.resolver; | 5 library engine.resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import "dart:math" as math; | 8 import "dart:math" as math; |
9 | 9 |
10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 * @param parameters the list of parameters to be validated | 1693 * @param parameters the list of parameters to be validated |
1694 */ | 1694 */ |
1695 void _validateDefaultValues(FormalParameterList parameters) { | 1695 void _validateDefaultValues(FormalParameterList parameters) { |
1696 if (parameters == null) { | 1696 if (parameters == null) { |
1697 return; | 1697 return; |
1698 } | 1698 } |
1699 for (FormalParameter parameter in parameters.parameters) { | 1699 for (FormalParameter parameter in parameters.parameters) { |
1700 if (parameter is DefaultFormalParameter) { | 1700 if (parameter is DefaultFormalParameter) { |
1701 DefaultFormalParameter defaultParameter = parameter; | 1701 DefaultFormalParameter defaultParameter = parameter; |
1702 Expression defaultValue = defaultParameter.defaultValue; | 1702 Expression defaultValue = defaultParameter.defaultValue; |
1703 if (defaultValue != null) { | 1703 DartObjectImpl result; |
1704 DartObjectImpl result = _validate(defaultValue, CompileTimeErrorCode.N
ON_CONSTANT_DEFAULT_VALUE); | 1704 if (defaultValue == null) { |
1705 VariableElementImpl element = parameter.element as VariableElementImpl
; | 1705 result = new DartObjectImpl(_typeProvider.nullType, |
1706 element.evaluationResult = new EvaluationResultImpl.con1(result); | 1706 NullState.NULL_STATE); |
| 1707 } else { |
| 1708 result = _validate(defaultValue, |
| 1709 CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE); |
1707 if (result != null) { | 1710 if (result != null) { |
1708 _reportErrorIfFromDeferredLibrary(defaultValue, CompileTimeErrorCode
.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY); | 1711 _reportErrorIfFromDeferredLibrary(defaultValue, CompileTimeErrorCode
.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY); |
1709 } | 1712 } |
1710 } | 1713 } |
| 1714 VariableElementImpl element = parameter.element as VariableElementImpl; |
| 1715 element.evaluationResult = new EvaluationResultImpl.con1(result); |
1711 } | 1716 } |
1712 } | 1717 } |
1713 } | 1718 } |
1714 | 1719 |
1715 /** | 1720 /** |
1716 * Validates that the expressions of any field initializers in the class decla
ration are all | 1721 * Validates that the expressions of any field initializers in the class decla
ration are all |
1717 * compile time constants. Since this is only required if the class has a cons
tant constructor, | 1722 * compile time constants. Since this is only required if the class has a cons
tant constructor, |
1718 * the error is reported at the constructor site. | 1723 * the error is reported at the constructor site. |
1719 * | 1724 * |
1720 * @param classDeclaration the class which should be validated | 1725 * @param classDeclaration the class which should be validated |
(...skipping 13772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15493 /** | 15498 /** |
15494 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the | 15499 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the |
15495 * identifier is not defined). | 15500 * identifier is not defined). |
15496 * | 15501 * |
15497 * @return the tag that has the given identifier | 15502 * @return the tag that has the given identifier |
15498 */ | 15503 */ |
15499 String getTagWithId(String identifier) { | 15504 String getTagWithId(String identifier) { |
15500 return idToTagMap[identifier]; | 15505 return idToTagMap[identifier]; |
15501 } | 15506 } |
15502 } | 15507 } |
OLD | NEW |