| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver; | 4 library engine.resolver; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 9 import 'instrumentation.dart'; | 9 import 'instrumentation.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 } finally { | 1443 } finally { |
| 1444 _enclosingClass = outerClass; | 1444 _enclosingClass = outerClass; |
| 1445 } | 1445 } |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 Object visitExportDirective(ExportDirective node) { | 1448 Object visitExportDirective(ExportDirective node) { |
| 1449 checkForDeprecatedMemberUse(node.uriElement, node); | 1449 checkForDeprecatedMemberUse(node.uriElement, node); |
| 1450 return super.visitExportDirective(node); | 1450 return super.visitExportDirective(node); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| 1454 checkForMissingReturn(node.returnType, node.functionExpression.body); |
| 1455 return super.visitFunctionDeclaration(node); |
| 1456 } |
| 1457 |
| 1453 Object visitImportDirective(ImportDirective node) { | 1458 Object visitImportDirective(ImportDirective node) { |
| 1454 checkForDeprecatedMemberUse(node.uriElement, node); | 1459 checkForDeprecatedMemberUse(node.uriElement, node); |
| 1455 return super.visitImportDirective(node); | 1460 return super.visitImportDirective(node); |
| 1456 } | 1461 } |
| 1457 | 1462 |
| 1458 Object visitIndexExpression(IndexExpression node) { | 1463 Object visitIndexExpression(IndexExpression node) { |
| 1459 checkForDeprecatedMemberUse(node.bestElement, node); | 1464 checkForDeprecatedMemberUse(node.bestElement, node); |
| 1460 return super.visitIndexExpression(node); | 1465 return super.visitIndexExpression(node); |
| 1461 } | 1466 } |
| 1462 | 1467 |
| 1463 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 1468 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 1464 checkForDeprecatedMemberUse(node.staticElement, node); | 1469 checkForDeprecatedMemberUse(node.staticElement, node); |
| 1465 return super.visitInstanceCreationExpression(node); | 1470 return super.visitInstanceCreationExpression(node); |
| 1466 } | 1471 } |
| 1467 | 1472 |
| 1468 Object visitIsExpression(IsExpression node) { | 1473 Object visitIsExpression(IsExpression node) { |
| 1469 checkAllTypeChecks(node); | 1474 checkAllTypeChecks(node); |
| 1470 return super.visitIsExpression(node); | 1475 return super.visitIsExpression(node); |
| 1471 } | 1476 } |
| 1472 | 1477 |
| 1473 Object visitMethodDeclaration(MethodDeclaration node) { | 1478 Object visitMethodDeclaration(MethodDeclaration node) { |
| 1474 checkForOverridingPrivateMember(node); | 1479 checkForOverridingPrivateMember(node); |
| 1480 checkForMissingReturn(node.returnType, node.body); |
| 1475 return super.visitMethodDeclaration(node); | 1481 return super.visitMethodDeclaration(node); |
| 1476 } | 1482 } |
| 1477 | 1483 |
| 1478 Object visitPostfixExpression(PostfixExpression node) { | 1484 Object visitPostfixExpression(PostfixExpression node) { |
| 1479 checkForDeprecatedMemberUse(node.bestElement, node); | 1485 checkForDeprecatedMemberUse(node.bestElement, node); |
| 1480 return super.visitPostfixExpression(node); | 1486 return super.visitPostfixExpression(node); |
| 1481 } | 1487 } |
| 1482 | 1488 |
| 1483 Object visitPrefixExpression(PrefixExpression node) { | 1489 Object visitPrefixExpression(PrefixExpression node) { |
| 1484 checkForDeprecatedMemberUse(node.bestElement, node); | 1490 checkForDeprecatedMemberUse(node.bestElement, node); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 if (_TO_INT_METHOD_NAME == methodInvocation.methodName.name && methodInv
ocation.argumentList.arguments.isEmpty) { | 1632 if (_TO_INT_METHOD_NAME == methodInvocation.methodName.name && methodInv
ocation.argumentList.arguments.isEmpty) { |
| 1627 _errorReporter.reportError2(HintCode.DIVISION_OPTIMIZATION, methodInvo
cation, []); | 1633 _errorReporter.reportError2(HintCode.DIVISION_OPTIMIZATION, methodInvo
cation, []); |
| 1628 return true; | 1634 return true; |
| 1629 } | 1635 } |
| 1630 } | 1636 } |
| 1631 } | 1637 } |
| 1632 return false; | 1638 return false; |
| 1633 } | 1639 } |
| 1634 | 1640 |
| 1635 /** | 1641 /** |
| 1642 * Generate a hint for functions or methods that have a return type, but do no
t have a return |
| 1643 * statement on all branches. At the end of blocks with no return, Dart implic
itly returns |
| 1644 * `null`, avoiding these implicit returns is considered a best practice. |
| 1645 * |
| 1646 * @param node the binary expression to check |
| 1647 * @param body the function body |
| 1648 * @return `true` if and only if a hint code is generated on the passed node |
| 1649 * @see HintCode#MISSING_RETURN |
| 1650 */ |
| 1651 bool checkForMissingReturn(TypeName returnType, FunctionBody body) => false; |
| 1652 |
| 1653 /** |
| 1636 * Check for the passed class declaration for the | 1654 * Check for the passed class declaration for the |
| 1637 * [HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE] hint code. | 1655 * [HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE] hint code. |
| 1638 * | 1656 * |
| 1639 * @param node the class declaration to check | 1657 * @param node the class declaration to check |
| 1640 * @return `true` if and only if a hint code is generated on the passed node | 1658 * @return `true` if and only if a hint code is generated on the passed node |
| 1641 * @see HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE | 1659 * @see HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE |
| 1642 */ | 1660 */ |
| 1643 bool checkForOverrideEqualsButNotHashCode(ClassDeclaration node) { | 1661 bool checkForOverrideEqualsButNotHashCode(ClassDeclaration node) { |
| 1644 ClassElement classElement = node.element; | 1662 ClassElement classElement = node.element; |
| 1645 if (classElement == null) { | 1663 if (classElement == null) { |
| 1646 return false; | 1664 return false; |
| 1647 } | 1665 } |
| 1648 MethodElement equalsOperatorMethodElement = classElement.getMethod(sc.TokenT
ype.EQ_EQ.lexeme); | 1666 MethodElement equalsOperatorMethodElement = classElement.getMethod(sc.TokenT
ype.EQ_EQ.lexeme); |
| 1649 if (equalsOperatorMethodElement != null) { | 1667 if (equalsOperatorMethodElement != null) { |
| 1650 PropertyAccessorElement hashCodeElement = classElement.getGetter(_HASHCODE
_GETTER_NAME); | 1668 PropertyAccessorElement hashCodeElement = classElement.getGetter(_HASHCODE
_GETTER_NAME); |
| 1651 if (hashCodeElement == null) { | 1669 if (hashCodeElement == null) { |
| 1652 _errorReporter.reportError2(HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
node.name, [classElement.displayName]); | 1670 _errorReporter.reportError2(HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
node.name, [classElement.displayName]); |
| 1653 return true; | 1671 return true; |
| 1654 } | 1672 } |
| 1655 } | 1673 } |
| 1656 return false; | 1674 return false; |
| 1657 } | 1675 } |
| 1658 | 1676 |
| 1659 /** | 1677 /** |
| 1660 * Check for the passed class declaration for the | 1678 * Checks that if the passed method declaration is private, it does not overri
de a private member |
| 1661 * [HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE] hint code. | 1679 * in a superclass. |
| 1662 * | 1680 * |
| 1663 * @param node the class declaration to check | 1681 * @param node the method declaration to check |
| 1664 * @return `true` if and only if a hint code is generated on the passed node | 1682 * @return `true` if and only if a hint code is generated on the passed node |
| 1665 * @see HintCode#OVERRIDDING_PRIVATE_MEMBER | 1683 * @see HintCode#OVERRIDDING_PRIVATE_MEMBER |
| 1666 */ | 1684 */ |
| 1667 bool checkForOverridingPrivateMember(MethodDeclaration node) { | 1685 bool checkForOverridingPrivateMember(MethodDeclaration node) { |
| 1668 if (_enclosingClass == null) { | 1686 if (_enclosingClass == null) { |
| 1669 return false; | 1687 return false; |
| 1670 } | 1688 } |
| 1671 if (!Identifier.isPrivateName(node.name.name)) { | 1689 if (!Identifier.isPrivateName(node.name.name)) { |
| 1672 return false; | 1690 return false; |
| 1673 } | 1691 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 | 1841 |
| 1824 Object visitBinaryExpression(BinaryExpression node) { | 1842 Object visitBinaryExpression(BinaryExpression node) { |
| 1825 sc.Token operator = node.operator; | 1843 sc.Token operator = node.operator; |
| 1826 bool isAmpAmp = identical(operator.type, sc.TokenType.AMPERSAND_AMPERSAND); | 1844 bool isAmpAmp = identical(operator.type, sc.TokenType.AMPERSAND_AMPERSAND); |
| 1827 bool isBarBar = identical(operator.type, sc.TokenType.BAR_BAR); | 1845 bool isBarBar = identical(operator.type, sc.TokenType.BAR_BAR); |
| 1828 if (isAmpAmp || isBarBar) { | 1846 if (isAmpAmp || isBarBar) { |
| 1829 Expression lhsCondition = node.leftOperand; | 1847 Expression lhsCondition = node.leftOperand; |
| 1830 if (!isDebugConstant(lhsCondition)) { | 1848 if (!isDebugConstant(lhsCondition)) { |
| 1831 ValidResult lhsResult = getConstantBooleanValue(lhsCondition); | 1849 ValidResult lhsResult = getConstantBooleanValue(lhsCondition); |
| 1832 if (lhsResult != null) { | 1850 if (lhsResult != null) { |
| 1833 if (identical(lhsResult, ValidResult.RESULT_TRUE) && isBarBar) { | 1851 if (lhsResult.isTrue && isBarBar) { |
| 1834 _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, [
]); | 1852 _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, [
]); |
| 1835 safelyVisit(lhsCondition); | 1853 safelyVisit(lhsCondition); |
| 1836 return null; | 1854 return null; |
| 1837 } else if (identical(lhsResult, ValidResult.RESULT_FALSE) && isAmpAmp)
{ | 1855 } else if (lhsResult.isFalse && isAmpAmp) { |
| 1838 _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, [
]); | 1856 _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, [
]); |
| 1839 safelyVisit(lhsCondition); | 1857 safelyVisit(lhsCondition); |
| 1840 return null; | 1858 return null; |
| 1841 } | 1859 } |
| 1842 } | 1860 } |
| 1843 } | 1861 } |
| 1844 } | 1862 } |
| 1845 return super.visitBinaryExpression(node); | 1863 return super.visitBinaryExpression(node); |
| 1846 } | 1864 } |
| 1847 | 1865 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1868 } | 1886 } |
| 1869 return null; | 1887 return null; |
| 1870 } | 1888 } |
| 1871 | 1889 |
| 1872 Object visitConditionalExpression(ConditionalExpression node) { | 1890 Object visitConditionalExpression(ConditionalExpression node) { |
| 1873 Expression conditionExpression = node.condition; | 1891 Expression conditionExpression = node.condition; |
| 1874 safelyVisit(conditionExpression); | 1892 safelyVisit(conditionExpression); |
| 1875 if (!isDebugConstant(conditionExpression)) { | 1893 if (!isDebugConstant(conditionExpression)) { |
| 1876 ValidResult result = getConstantBooleanValue(conditionExpression); | 1894 ValidResult result = getConstantBooleanValue(conditionExpression); |
| 1877 if (result != null) { | 1895 if (result != null) { |
| 1878 if (identical(result, ValidResult.RESULT_TRUE)) { | 1896 if (result.isTrue) { |
| 1879 _errorReporter.reportError2(HintCode.DEAD_CODE, node.elseExpression, [
]); | 1897 _errorReporter.reportError2(HintCode.DEAD_CODE, node.elseExpression, [
]); |
| 1880 safelyVisit(node.thenExpression); | 1898 safelyVisit(node.thenExpression); |
| 1881 return null; | 1899 return null; |
| 1882 } else { | 1900 } else { |
| 1883 _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenExpression, [
]); | 1901 _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenExpression, [
]); |
| 1884 safelyVisit(node.elseExpression); | 1902 safelyVisit(node.elseExpression); |
| 1885 return null; | 1903 return null; |
| 1886 } | 1904 } |
| 1887 } | 1905 } |
| 1888 } | 1906 } |
| 1889 return super.visitConditionalExpression(node); | 1907 return super.visitConditionalExpression(node); |
| 1890 } | 1908 } |
| 1891 | 1909 |
| 1892 Object visitIfStatement(IfStatement node) { | 1910 Object visitIfStatement(IfStatement node) { |
| 1893 Expression conditionExpression = node.condition; | 1911 Expression conditionExpression = node.condition; |
| 1894 safelyVisit(conditionExpression); | 1912 safelyVisit(conditionExpression); |
| 1895 if (!isDebugConstant(conditionExpression)) { | 1913 if (!isDebugConstant(conditionExpression)) { |
| 1896 ValidResult result = getConstantBooleanValue(conditionExpression); | 1914 ValidResult result = getConstantBooleanValue(conditionExpression); |
| 1897 if (result != null) { | 1915 if (result != null) { |
| 1898 if (identical(result, ValidResult.RESULT_TRUE)) { | 1916 if (result.isTrue) { |
| 1899 Statement elseStatement = node.elseStatement; | 1917 Statement elseStatement = node.elseStatement; |
| 1900 if (elseStatement != null) { | 1918 if (elseStatement != null) { |
| 1901 _errorReporter.reportError2(HintCode.DEAD_CODE, elseStatement, []); | 1919 _errorReporter.reportError2(HintCode.DEAD_CODE, elseStatement, []); |
| 1902 safelyVisit(node.thenStatement); | 1920 safelyVisit(node.thenStatement); |
| 1903 return null; | 1921 return null; |
| 1904 } | 1922 } |
| 1905 } else { | 1923 } else { |
| 1906 _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenStatement, []
); | 1924 _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenStatement, []
); |
| 1907 safelyVisit(node.elseStatement); | 1925 safelyVisit(node.elseStatement); |
| 1908 return null; | 1926 return null; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 } | 1979 } |
| 1962 return null; | 1980 return null; |
| 1963 } | 1981 } |
| 1964 | 1982 |
| 1965 Object visitWhileStatement(WhileStatement node) { | 1983 Object visitWhileStatement(WhileStatement node) { |
| 1966 Expression conditionExpression = node.condition; | 1984 Expression conditionExpression = node.condition; |
| 1967 safelyVisit(conditionExpression); | 1985 safelyVisit(conditionExpression); |
| 1968 if (!isDebugConstant(conditionExpression)) { | 1986 if (!isDebugConstant(conditionExpression)) { |
| 1969 ValidResult result = getConstantBooleanValue(conditionExpression); | 1987 ValidResult result = getConstantBooleanValue(conditionExpression); |
| 1970 if (result != null) { | 1988 if (result != null) { |
| 1971 if (identical(result, ValidResult.RESULT_FALSE)) { | 1989 if (result.isFalse) { |
| 1972 _errorReporter.reportError2(HintCode.DEAD_CODE, node.body, []); | 1990 _errorReporter.reportError2(HintCode.DEAD_CODE, node.body, []); |
| 1973 return null; | 1991 return null; |
| 1974 } | 1992 } |
| 1975 } | 1993 } |
| 1976 } | 1994 } |
| 1977 safelyVisit(node.body); | 1995 safelyVisit(node.body); |
| 1978 return null; | 1996 return null; |
| 1979 } | 1997 } |
| 1980 | 1998 |
| 1981 /** | 1999 /** |
| 1982 * Given some [Expression], this method returns [ValidResult#RESULT_TRUE] if i
t is | 2000 * Given some [Expression], this method returns [ValidResult#RESULT_TRUE] if i
t is |
| 1983 * `true`, [ValidResult#RESULT_FALSE] if it is `false`, or `null` if the | 2001 * `true`, [ValidResult#RESULT_FALSE] if it is `false`, or `null` if the |
| 1984 * expression is not a constant boolean value. | 2002 * expression is not a constant boolean value. |
| 1985 * | 2003 * |
| 1986 * @param expression the expression to evaluate | 2004 * @param expression the expression to evaluate |
| 1987 * @return [ValidResult#RESULT_TRUE] if it is `true`, [ValidResult#RESULT_FALS
E] | 2005 * @return [ValidResult#RESULT_TRUE] if it is `true`, [ValidResult#RESULT_FALS
E] |
| 1988 * if it is `false`, or `null` if the expression is not a constant boo
lean | 2006 * if it is `false`, or `null` if the expression is not a constant boo
lean |
| 1989 * value | 2007 * value |
| 1990 */ | 2008 */ |
| 1991 ValidResult getConstantBooleanValue(Expression expression) { | 2009 ValidResult getConstantBooleanValue(Expression expression) { |
| 1992 if (expression is BooleanLiteral) { | 2010 if (expression is BooleanLiteral) { |
| 1993 if ((expression as BooleanLiteral).value) { | 2011 if ((expression as BooleanLiteral).value) { |
| 1994 return ValidResult.RESULT_TRUE; | 2012 return new ValidResult(new DartObjectImpl(null, BoolState.from(true))); |
| 1995 } else { | 2013 } else { |
| 1996 return ValidResult.RESULT_FALSE; | 2014 return new ValidResult(new DartObjectImpl(null, BoolState.from(false))); |
| 1997 } | 2015 } |
| 1998 } | 2016 } |
| 1999 return null; | 2017 return null; |
| 2000 } | 2018 } |
| 2001 | 2019 |
| 2002 /** | 2020 /** |
| 2003 * Return `true` if and only if the passed expression is resolved to a constan
t variable. | 2021 * Return `true` if and only if the passed expression is resolved to a constan
t variable. |
| 2004 * | 2022 * |
| 2005 * @param expression some conditional expression | 2023 * @param expression some conditional expression |
| 2006 * @return `true` if and only if the passed expression is resolved to a consta
nt variable | 2024 * @return `true` if and only if the passed expression is resolved to a consta
nt variable |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 if (prefixElement != null && prefix.name == prefixElement.displayName)
{ | 3214 if (prefixElement != null && prefix.name == prefixElement.displayName)
{ |
| 3197 return element; | 3215 return element; |
| 3198 } | 3216 } |
| 3199 } | 3217 } |
| 3200 } | 3218 } |
| 3201 } | 3219 } |
| 3202 return null; | 3220 return null; |
| 3203 } | 3221 } |
| 3204 | 3222 |
| 3205 void gatherElements(Element element) { | 3223 void gatherElements(Element element) { |
| 3206 element.accept(new GeneralizingElementVisitor_7(this)); | 3224 element.accept(new GeneralizingElementVisitor_8(this)); |
| 3207 } | 3225 } |
| 3208 | 3226 |
| 3209 /** | 3227 /** |
| 3210 * Search the most closely enclosing list of parameters for a parameter with t
he given name. | 3228 * Search the most closely enclosing list of parameters for a parameter with t
he given name. |
| 3211 * | 3229 * |
| 3212 * @param node the node defining the parameter with the given name | 3230 * @param node the node defining the parameter with the given name |
| 3213 * @param parameterName the name of the parameter being searched for | 3231 * @param parameterName the name of the parameter being searched for |
| 3214 * @return the element representing the parameter with that name | 3232 * @return the element representing the parameter with that name |
| 3215 */ | 3233 */ |
| 3216 ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier
parameterName) { | 3234 ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier
parameterName) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3258 } | 3276 } |
| 3259 | 3277 |
| 3260 /** | 3278 /** |
| 3261 * Instances of the class `DeclarationMismatchException` represent an exception
that is | 3279 * Instances of the class `DeclarationMismatchException` represent an exception
that is |
| 3262 * thrown when the element model defined by a given AST structure does not match
an existing | 3280 * thrown when the element model defined by a given AST structure does not match
an existing |
| 3263 * element model. | 3281 * element model. |
| 3264 */ | 3282 */ |
| 3265 class DeclarationMatcher_DeclarationMismatchException extends RuntimeException { | 3283 class DeclarationMatcher_DeclarationMismatchException extends RuntimeException { |
| 3266 } | 3284 } |
| 3267 | 3285 |
| 3268 class GeneralizingElementVisitor_7 extends GeneralizingElementVisitor<Object> { | 3286 class GeneralizingElementVisitor_8 extends GeneralizingElementVisitor<Object> { |
| 3269 final DeclarationMatcher DeclarationMatcher_this; | 3287 final DeclarationMatcher DeclarationMatcher_this; |
| 3270 | 3288 |
| 3271 GeneralizingElementVisitor_7(this.DeclarationMatcher_this) : super(); | 3289 GeneralizingElementVisitor_8(this.DeclarationMatcher_this) : super(); |
| 3272 | 3290 |
| 3273 Object visitElement(Element element) { | 3291 Object visitElement(Element element) { |
| 3274 DeclarationMatcher_this._allElements.add(element); | 3292 DeclarationMatcher_this._allElements.add(element); |
| 3275 DeclarationMatcher_this._unmatchedElements.add(element); | 3293 DeclarationMatcher_this._unmatchedElements.add(element); |
| 3276 return super.visitElement(element); | 3294 return super.visitElement(element); |
| 3277 } | 3295 } |
| 3278 } | 3296 } |
| 3279 | 3297 |
| 3280 /** | 3298 /** |
| 3281 * Instances of the class `DeclarationResolver` are used to resolve declarations
in an AST | 3299 * Instances of the class `DeclarationResolver` are used to resolve declarations
in an AST |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4365 } | 4383 } |
| 4366 Element staticElement; | 4384 Element staticElement; |
| 4367 Element propagatedElement; | 4385 Element propagatedElement; |
| 4368 if (target == null) { | 4386 if (target == null) { |
| 4369 staticElement = resolveInvokedElement2(methodName); | 4387 staticElement = resolveInvokedElement2(methodName); |
| 4370 propagatedElement = null; | 4388 propagatedElement = null; |
| 4371 } else { | 4389 } else { |
| 4372 Type2 staticType = getStaticType(target); | 4390 Type2 staticType = getStaticType(target); |
| 4373 ClassElementImpl typeReference = getTypeReference(target); | 4391 ClassElementImpl typeReference = getTypeReference(target); |
| 4374 if (typeReference != null) { | 4392 if (typeReference != null) { |
| 4375 staticElement = propagatedElement = resolveElement(typeReference, method
Name.name); | 4393 staticElement = propagatedElement = resolveElement(typeReference, method
Name); |
| 4376 } else { | 4394 } else { |
| 4377 staticElement = resolveInvokedElement(target, staticType, methodName); | 4395 staticElement = resolveInvokedElement(target, staticType, methodName); |
| 4378 propagatedElement = resolveInvokedElement(target, getPropagatedType(targ
et), methodName); | 4396 propagatedElement = resolveInvokedElement(target, getPropagatedType(targ
et), methodName); |
| 4379 } | 4397 } |
| 4380 } | 4398 } |
| 4381 staticElement = convertSetterToGetter(staticElement); | 4399 staticElement = convertSetterToGetter(staticElement); |
| 4382 propagatedElement = convertSetterToGetter(propagatedElement); | 4400 propagatedElement = convertSetterToGetter(propagatedElement); |
| 4383 methodName.staticElement = staticElement; | 4401 methodName.staticElement = staticElement; |
| 4384 methodName.propagatedElement = propagatedElement; | 4402 methodName.propagatedElement = propagatedElement; |
| 4385 ArgumentList argumentList = node.argumentList; | 4403 ArgumentList argumentList = node.argumentList; |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5647 } | 5665 } |
| 5648 } | 5666 } |
| 5649 } | 5667 } |
| 5650 } | 5668 } |
| 5651 | 5669 |
| 5652 /** | 5670 /** |
| 5653 * Given an invocation of the form 'C.x()' where 'C' is a class, find and retu
rn the element 'x' | 5671 * Given an invocation of the form 'C.x()' where 'C' is a class, find and retu
rn the element 'x' |
| 5654 * in 'C'. | 5672 * in 'C'. |
| 5655 * | 5673 * |
| 5656 * @param classElement the class element | 5674 * @param classElement the class element |
| 5657 * @param memberName the member name | 5675 * @param nameNode the member name node |
| 5658 */ | 5676 */ |
| 5659 Element resolveElement(ClassElementImpl classElement, String memberName) { | 5677 Element resolveElement(ClassElementImpl classElement, SimpleIdentifier nameNod
e) { |
| 5678 String name = nameNode.name; |
| 5660 Element element = null; | 5679 Element element = null; |
| 5661 String methodNameStr = memberName; | 5680 element = classElement.getMethod(name); |
| 5662 element = classElement.getMethod(methodNameStr); | 5681 if (element == null && nameNode.inSetterContext()) { |
| 5663 if (element == null) { | 5682 element = classElement.getSetter(name); |
| 5664 element = classElement.getSetter(memberName); | 5683 } |
| 5665 if (element == null) { | 5684 if (element == null && nameNode.inGetterContext()) { |
| 5666 element = classElement.getGetter(memberName); | 5685 element = classElement.getGetter(name); |
| 5667 } | |
| 5668 } | 5686 } |
| 5669 if (element != null && element.isAccessibleIn(_definingLibrary)) { | 5687 if (element != null && element.isAccessibleIn(_definingLibrary)) { |
| 5670 return element; | 5688 return element; |
| 5671 } | 5689 } |
| 5672 return null; | 5690 return null; |
| 5673 } | 5691 } |
| 5674 | 5692 |
| 5675 /** | 5693 /** |
| 5676 * Given an invocation of the form 'e.m(a1, ..., an)', resolve 'e.m' to the el
ement being invoked. | 5694 * Given an invocation of the form 'e.m(a1, ..., an)', resolve 'e.m' to the el
ement being invoked. |
| 5677 * If the returned element is a method, then the method will be invoked. If th
e returned element | 5695 * If the returned element is a method, then the method will be invoked. If th
e returned element |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5752 return memberElement; | 5770 return memberElement; |
| 5753 } | 5771 } |
| 5754 | 5772 |
| 5755 void resolvePropertyAccess(Expression target, SimpleIdentifier propertyName) { | 5773 void resolvePropertyAccess(Expression target, SimpleIdentifier propertyName) { |
| 5756 Type2 staticType = getStaticType(target); | 5774 Type2 staticType = getStaticType(target); |
| 5757 Type2 propagatedType = getPropagatedType(target); | 5775 Type2 propagatedType = getPropagatedType(target); |
| 5758 Element staticElement = null; | 5776 Element staticElement = null; |
| 5759 Element propagatedElement = null; | 5777 Element propagatedElement = null; |
| 5760 ClassElementImpl typeReference = getTypeReference(target); | 5778 ClassElementImpl typeReference = getTypeReference(target); |
| 5761 if (typeReference != null) { | 5779 if (typeReference != null) { |
| 5762 staticElement = propagatedElement = resolveElement(typeReference, property
Name.name); | 5780 staticElement = propagatedElement = resolveElement(typeReference, property
Name); |
| 5763 } else { | 5781 } else { |
| 5764 staticElement = resolveProperty(target, staticType, propertyName); | 5782 staticElement = resolveProperty(target, staticType, propertyName); |
| 5765 propagatedElement = resolveProperty(target, propagatedType, propertyName); | 5783 propagatedElement = resolveProperty(target, propagatedType, propertyName); |
| 5766 } | 5784 } |
| 5767 if (target.parent.parent is Annotation) { | 5785 if (target.parent.parent is Annotation) { |
| 5768 if (staticElement != null) { | 5786 if (staticElement != null) { |
| 5769 propertyName.staticElement = staticElement; | 5787 propertyName.staticElement = staticElement; |
| 5770 } | 5788 } |
| 5771 return; | 5789 return; |
| 5772 } | 5790 } |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7379 Map<String, PrefixElementImpl> nameToPrefixMap = new Map<String, PrefixEle
mentImpl>(); | 7397 Map<String, PrefixElementImpl> nameToPrefixMap = new Map<String, PrefixEle
mentImpl>(); |
| 7380 List<ImportElement> imports = new List<ImportElement>(); | 7398 List<ImportElement> imports = new List<ImportElement>(); |
| 7381 List<ExportElement> exports = new List<ExportElement>(); | 7399 List<ExportElement> exports = new List<ExportElement>(); |
| 7382 for (Directive directive in library.definingCompilationUnit.directives) { | 7400 for (Directive directive in library.definingCompilationUnit.directives) { |
| 7383 if (directive is ImportDirective) { | 7401 if (directive is ImportDirective) { |
| 7384 ImportDirective importDirective = directive as ImportDirective; | 7402 ImportDirective importDirective = directive as ImportDirective; |
| 7385 Source importedSource = library.getSource(importDirective); | 7403 Source importedSource = library.getSource(importDirective); |
| 7386 if (importedSource != null) { | 7404 if (importedSource != null) { |
| 7387 Library importedLibrary = _libraryMap[importedSource]; | 7405 Library importedLibrary = _libraryMap[importedSource]; |
| 7388 if (importedLibrary != null) { | 7406 if (importedLibrary != null) { |
| 7389 ImportElementImpl importElement = new ImportElementImpl(); | 7407 ImportElementImpl importElement = new ImportElementImpl(directive.
offset); |
| 7390 importElement.offset = directive.offset; | |
| 7391 StringLiteral uriLiteral = importDirective.uri; | 7408 StringLiteral uriLiteral = importDirective.uri; |
| 7392 if (uriLiteral != null) { | 7409 if (uriLiteral != null) { |
| 7393 importElement.uriEnd = uriLiteral.end; | 7410 importElement.uriEnd = uriLiteral.end; |
| 7394 } | 7411 } |
| 7395 importElement.uri = library.getUri(importDirective); | 7412 importElement.uri = library.getUri(importDirective); |
| 7396 importElement.combinators = buildCombinators(importDirective); | 7413 importElement.combinators = buildCombinators(importDirective); |
| 7397 LibraryElement importedLibraryElement = importedLibrary.libraryEle
ment; | 7414 LibraryElement importedLibraryElement = importedLibrary.libraryEle
ment; |
| 7398 if (importedLibraryElement != null) { | 7415 if (importedLibraryElement != null) { |
| 7399 importElement.importedLibrary = importedLibraryElement; | 7416 importElement.importedLibrary = importedLibraryElement; |
| 7400 } | 7417 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7435 if (analysisContext.computeKindOf(exportedSource) != SourceKind.LI
BRARY) { | 7452 if (analysisContext.computeKindOf(exportedSource) != SourceKind.LI
BRARY) { |
| 7436 StringLiteral uriLiteral = exportDirective.uri; | 7453 StringLiteral uriLiteral = exportDirective.uri; |
| 7437 _errorListener.onError(new AnalysisError.con2(library.librarySou
rce, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.EXPORT_OF_NON_LI
BRARY, [uriLiteral.toSource()])); | 7454 _errorListener.onError(new AnalysisError.con2(library.librarySou
rce, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.EXPORT_OF_NON_LI
BRARY, [uriLiteral.toSource()])); |
| 7438 } | 7455 } |
| 7439 } | 7456 } |
| 7440 } | 7457 } |
| 7441 } | 7458 } |
| 7442 } | 7459 } |
| 7443 Source librarySource = library.librarySource; | 7460 Source librarySource = library.librarySource; |
| 7444 if (!library.explicitlyImportsCore && _coreLibrarySource != librarySource)
{ | 7461 if (!library.explicitlyImportsCore && _coreLibrarySource != librarySource)
{ |
| 7445 ImportElementImpl importElement = new ImportElementImpl(); | 7462 ImportElementImpl importElement = new ImportElementImpl(-1); |
| 7446 importElement.importedLibrary = _coreLibrary.libraryElement; | 7463 importElement.importedLibrary = _coreLibrary.libraryElement; |
| 7447 importElement.synthetic = true; | 7464 importElement.synthetic = true; |
| 7448 imports.add(importElement); | 7465 imports.add(importElement); |
| 7449 } | 7466 } |
| 7450 LibraryElementImpl libraryElement = library.libraryElement; | 7467 LibraryElementImpl libraryElement = library.libraryElement; |
| 7451 libraryElement.imports = new List.from(imports); | 7468 libraryElement.imports = new List.from(imports); |
| 7452 libraryElement.exports = new List.from(exports); | 7469 libraryElement.exports = new List.from(exports); |
| 7453 } | 7470 } |
| 7454 } | 7471 } |
| 7455 | 7472 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7675 } | 7692 } |
| 7676 return identifiers; | 7693 return identifiers; |
| 7677 } | 7694 } |
| 7678 | 7695 |
| 7679 /** | 7696 /** |
| 7680 * Compute a value for all of the constants in the libraries being analyzed. | 7697 * Compute a value for all of the constants in the libraries being analyzed. |
| 7681 */ | 7698 */ |
| 7682 void performConstantEvaluation() { | 7699 void performConstantEvaluation() { |
| 7683 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.resolve.st
art(); | 7700 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.resolve.st
art(); |
| 7684 try { | 7701 try { |
| 7685 ConstantValueComputer computer = new ConstantValueComputer(); | 7702 ConstantValueComputer computer = new ConstantValueComputer(_typeProvider); |
| 7686 for (Library library in _librariesInCycles) { | 7703 for (Library library in _librariesInCycles) { |
| 7687 for (Source source in library.compilationUnitSources) { | 7704 for (Source source in library.compilationUnitSources) { |
| 7688 try { | 7705 try { |
| 7689 CompilationUnit unit = library.getAST(source); | 7706 CompilationUnit unit = library.getAST(source); |
| 7690 if (unit != null) { | 7707 if (unit != null) { |
| 7691 computer.add(unit); | 7708 computer.add(unit); |
| 7692 } | 7709 } |
| 7693 } on AnalysisException catch (exception) { | 7710 } on AnalysisException catch (exception) { |
| 7694 AnalysisEngine.instance.logger.logError2("Internal Error: Could not
access AST for ${source.fullName} during constant evaluation", exception); | 7711 AnalysisEngine.instance.logger.logError2("Internal Error: Could not
access AST for ${source.fullName} during constant evaluation", exception); |
| 7695 } | 7712 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7997 */ | 8014 */ |
| 7998 ClassElement _enclosingClass = null; | 8015 ClassElement _enclosingClass = null; |
| 7999 | 8016 |
| 8000 /** | 8017 /** |
| 8001 * The element representing the function containing the current node, or `null
` if the | 8018 * The element representing the function containing the current node, or `null
` if the |
| 8002 * current node is not contained in a function. | 8019 * current node is not contained in a function. |
| 8003 */ | 8020 */ |
| 8004 ExecutableElement _enclosingFunction = null; | 8021 ExecutableElement _enclosingFunction = null; |
| 8005 | 8022 |
| 8006 /** | 8023 /** |
| 8024 * The [Comment] before a [FunctionDeclaration] or a [MethodDeclaration] that |
| 8025 * cannot be resolved where we visited it, because it should be resolved in th
e scope of the body. |
| 8026 */ |
| 8027 Comment _commentBeforeFunction = null; |
| 8028 |
| 8029 /** |
| 8007 * The object keeping track of which elements have had their types overridden. | 8030 * The object keeping track of which elements have had their types overridden. |
| 8008 */ | 8031 */ |
| 8009 TypeOverrideManager _overrideManager = new TypeOverrideManager(); | 8032 TypeOverrideManager _overrideManager = new TypeOverrideManager(); |
| 8010 | 8033 |
| 8011 /** | 8034 /** |
| 8012 * The object keeping track of which elements have had their types promoted. | 8035 * The object keeping track of which elements have had their types promoted. |
| 8013 */ | 8036 */ |
| 8014 TypePromotionManager _promoteManager = new TypePromotionManager(); | 8037 TypePromotionManager _promoteManager = new TypePromotionManager(); |
| 8015 | 8038 |
| 8016 /** | 8039 /** |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8126 } else { | 8149 } else { |
| 8127 safelyVisit(leftOperand); | 8150 safelyVisit(leftOperand); |
| 8128 safelyVisit(rightOperand); | 8151 safelyVisit(rightOperand); |
| 8129 } | 8152 } |
| 8130 node.accept(_elementResolver); | 8153 node.accept(_elementResolver); |
| 8131 node.accept(_typeAnalyzer); | 8154 node.accept(_typeAnalyzer); |
| 8132 return null; | 8155 return null; |
| 8133 } | 8156 } |
| 8134 | 8157 |
| 8135 Object visitBlockFunctionBody(BlockFunctionBody node) { | 8158 Object visitBlockFunctionBody(BlockFunctionBody node) { |
| 8159 safelyVisit(_commentBeforeFunction); |
| 8136 try { | 8160 try { |
| 8137 _overrideManager.enterScope(); | 8161 _overrideManager.enterScope(); |
| 8138 super.visitBlockFunctionBody(node); | 8162 super.visitBlockFunctionBody(node); |
| 8139 } finally { | 8163 } finally { |
| 8140 _overrideManager.exitScope(); | 8164 _overrideManager.exitScope(); |
| 8141 } | 8165 } |
| 8142 return null; | 8166 return null; |
| 8143 } | 8167 } |
| 8144 | 8168 |
| 8145 Object visitBreakStatement(BreakStatement node) { | 8169 Object visitBreakStatement(BreakStatement node) { |
| 8146 node.accept(_elementResolver); | 8170 node.accept(_elementResolver); |
| 8147 node.accept(_typeAnalyzer); | 8171 node.accept(_typeAnalyzer); |
| 8148 return null; | 8172 return null; |
| 8149 } | 8173 } |
| 8150 | 8174 |
| 8151 Object visitClassDeclaration(ClassDeclaration node) { | 8175 Object visitClassDeclaration(ClassDeclaration node) { |
| 8152 ClassElement outerType = _enclosingClass; | 8176 ClassElement outerType = _enclosingClass; |
| 8153 try { | 8177 try { |
| 8154 _enclosingClass = node.element; | 8178 _enclosingClass = node.element; |
| 8155 _typeAnalyzer.thisType = _enclosingClass == null ? null : _enclosingClass.
type; | 8179 _typeAnalyzer.thisType = _enclosingClass == null ? null : _enclosingClass.
type; |
| 8156 super.visitClassDeclaration(node); | 8180 super.visitClassDeclaration(node); |
| 8157 } finally { | 8181 } finally { |
| 8158 _typeAnalyzer.thisType = outerType == null ? null : outerType.type; | 8182 _typeAnalyzer.thisType = outerType == null ? null : outerType.type; |
| 8159 _enclosingClass = outerType; | 8183 _enclosingClass = outerType; |
| 8160 } | 8184 } |
| 8161 return null; | 8185 return null; |
| 8162 } | 8186 } |
| 8163 | 8187 |
| 8188 Object visitComment(Comment node) { |
| 8189 if (node.parent is FunctionDeclaration || node.parent is MethodDeclaration)
{ |
| 8190 if (node != _commentBeforeFunction) { |
| 8191 _commentBeforeFunction = node; |
| 8192 return null; |
| 8193 } |
| 8194 } |
| 8195 super.visitComment(node); |
| 8196 _commentBeforeFunction = null; |
| 8197 return null; |
| 8198 } |
| 8199 |
| 8164 Object visitCommentReference(CommentReference node) { | 8200 Object visitCommentReference(CommentReference node) { |
| 8165 node.accept(_elementResolver); | 8201 node.accept(_elementResolver); |
| 8166 node.accept(_typeAnalyzer); | 8202 node.accept(_typeAnalyzer); |
| 8167 return null; | 8203 return null; |
| 8168 } | 8204 } |
| 8169 | 8205 |
| 8170 Object visitCompilationUnit(CompilationUnit node) { | 8206 Object visitCompilationUnit(CompilationUnit node) { |
| 8171 try { | 8207 try { |
| 8172 _overrideManager.enterScope(); | 8208 _overrideManager.enterScope(); |
| 8173 NodeList<Directive> directives = node.directives; | 8209 NodeList<Directive> directives = node.directives; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8272 Object visitDoStatement(DoStatement node) { | 8308 Object visitDoStatement(DoStatement node) { |
| 8273 try { | 8309 try { |
| 8274 _overrideManager.enterScope(); | 8310 _overrideManager.enterScope(); |
| 8275 super.visitDoStatement(node); | 8311 super.visitDoStatement(node); |
| 8276 } finally { | 8312 } finally { |
| 8277 _overrideManager.exitScope(); | 8313 _overrideManager.exitScope(); |
| 8278 } | 8314 } |
| 8279 return null; | 8315 return null; |
| 8280 } | 8316 } |
| 8281 | 8317 |
| 8318 Object visitEmptyFunctionBody(EmptyFunctionBody node) { |
| 8319 safelyVisit(_commentBeforeFunction); |
| 8320 return super.visitEmptyFunctionBody(node); |
| 8321 } |
| 8322 |
| 8282 Object visitExpressionFunctionBody(ExpressionFunctionBody node) { | 8323 Object visitExpressionFunctionBody(ExpressionFunctionBody node) { |
| 8324 safelyVisit(_commentBeforeFunction); |
| 8283 try { | 8325 try { |
| 8284 _overrideManager.enterScope(); | 8326 _overrideManager.enterScope(); |
| 8285 super.visitExpressionFunctionBody(node); | 8327 super.visitExpressionFunctionBody(node); |
| 8286 } finally { | 8328 } finally { |
| 8287 _overrideManager.exitScope(); | 8329 _overrideManager.exitScope(); |
| 8288 } | 8330 } |
| 8289 return null; | 8331 return null; |
| 8290 } | 8332 } |
| 8291 | 8333 |
| 8292 Object visitFieldDeclaration(FieldDeclaration node) { | 8334 Object visitFieldDeclaration(FieldDeclaration node) { |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8901 * Return `true` if the given variable is accessed within a closure in the giv
en | 8943 * Return `true` if the given variable is accessed within a closure in the giv
en |
| 8902 * [ASTNode] and also mutated somewhere in variable scope. This information is
only | 8944 * [ASTNode] and also mutated somewhere in variable scope. This information is
only |
| 8903 * available for local variables (including parameters). | 8945 * available for local variables (including parameters). |
| 8904 * | 8946 * |
| 8905 * @param variable the variable to check | 8947 * @param variable the variable to check |
| 8906 * @param target the [ASTNode] to check within | 8948 * @param target the [ASTNode] to check within |
| 8907 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode | 8949 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode |
| 8908 */ | 8950 */ |
| 8909 bool isVariableAccessedInClosure(Element variable, ASTNode target) { | 8951 bool isVariableAccessedInClosure(Element variable, ASTNode target) { |
| 8910 List<bool> result = [false]; | 8952 List<bool> result = [false]; |
| 8911 target.accept(new RecursiveASTVisitor_8(result, variable)); | 8953 target.accept(new RecursiveASTVisitor_9(result, variable)); |
| 8912 return result[0]; | 8954 return result[0]; |
| 8913 } | 8955 } |
| 8914 | 8956 |
| 8915 /** | 8957 /** |
| 8916 * Return `true` if the given variable is potentially mutated somewhere in the
given | 8958 * Return `true` if the given variable is potentially mutated somewhere in the
given |
| 8917 * [ASTNode]. This information is only available for local variables (includin
g parameters). | 8959 * [ASTNode]. This information is only available for local variables (includin
g parameters). |
| 8918 * | 8960 * |
| 8919 * @param variable the variable to check | 8961 * @param variable the variable to check |
| 8920 * @param target the [ASTNode] to check within | 8962 * @param target the [ASTNode] to check within |
| 8921 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode | 8963 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode |
| 8922 */ | 8964 */ |
| 8923 bool isVariablePotentiallyMutatedIn(Element variable, ASTNode target) { | 8965 bool isVariablePotentiallyMutatedIn(Element variable, ASTNode target) { |
| 8924 List<bool> result = [false]; | 8966 List<bool> result = [false]; |
| 8925 target.accept(new RecursiveASTVisitor_9(result, variable)); | 8967 target.accept(new RecursiveASTVisitor_10(result, variable)); |
| 8926 return result[0]; | 8968 return result[0]; |
| 8927 } | 8969 } |
| 8928 | 8970 |
| 8929 /** | 8971 /** |
| 8930 * If it is appropriate to do so, promotes the current type of the static elem
ent associated with | 8972 * If it is appropriate to do so, promotes the current type of the static elem
ent associated with |
| 8931 * the given expression with the given type. Generally speaking, it is appropr
iate if the given | 8973 * the given expression with the given type. Generally speaking, it is appropr
iate if the given |
| 8932 * type is more specific than the current type. | 8974 * type is more specific than the current type. |
| 8933 * | 8975 * |
| 8934 * @param expression the expression used to access the static element whose ty
pes might be | 8976 * @param expression the expression used to access the static element whose ty
pes might be |
| 8935 * promoted | 8977 * promoted |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9072 | 9114 |
| 9073 get typeAnalyzer_J2DAccessor => _typeAnalyzer; | 9115 get typeAnalyzer_J2DAccessor => _typeAnalyzer; |
| 9074 | 9116 |
| 9075 set typeAnalyzer_J2DAccessor(__v) => _typeAnalyzer = __v; | 9117 set typeAnalyzer_J2DAccessor(__v) => _typeAnalyzer = __v; |
| 9076 | 9118 |
| 9077 get enclosingClass_J2DAccessor => _enclosingClass; | 9119 get enclosingClass_J2DAccessor => _enclosingClass; |
| 9078 | 9120 |
| 9079 set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v; | 9121 set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v; |
| 9080 } | 9122 } |
| 9081 | 9123 |
| 9082 class RecursiveASTVisitor_8 extends RecursiveASTVisitor<Object> { | 9124 class RecursiveASTVisitor_9 extends RecursiveASTVisitor<Object> { |
| 9083 List<bool> result; | 9125 List<bool> result; |
| 9084 | 9126 |
| 9085 Element variable; | 9127 Element variable; |
| 9086 | 9128 |
| 9087 RecursiveASTVisitor_8(this.result, this.variable) : super(); | 9129 RecursiveASTVisitor_9(this.result, this.variable) : super(); |
| 9088 | 9130 |
| 9089 bool _inClosure = false; | 9131 bool _inClosure = false; |
| 9090 | 9132 |
| 9091 Object visitFunctionExpression(FunctionExpression node) { | 9133 Object visitFunctionExpression(FunctionExpression node) { |
| 9092 bool inClosure = this._inClosure; | 9134 bool inClosure = this._inClosure; |
| 9093 try { | 9135 try { |
| 9094 this._inClosure = true; | 9136 this._inClosure = true; |
| 9095 return super.visitFunctionExpression(node); | 9137 return super.visitFunctionExpression(node); |
| 9096 } finally { | 9138 } finally { |
| 9097 this._inClosure = inClosure; | 9139 this._inClosure = inClosure; |
| 9098 } | 9140 } |
| 9099 } | 9141 } |
| 9100 | 9142 |
| 9101 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9143 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 9102 if (result[0]) { | 9144 if (result[0]) { |
| 9103 return null; | 9145 return null; |
| 9104 } | 9146 } |
| 9105 if (_inClosure && identical(node.staticElement, variable)) { | 9147 if (_inClosure && identical(node.staticElement, variable)) { |
| 9106 result[0] = javaBooleanOr(result[0], true); | 9148 result[0] = javaBooleanOr(result[0], true); |
| 9107 } | 9149 } |
| 9108 return null; | 9150 return null; |
| 9109 } | 9151 } |
| 9110 } | 9152 } |
| 9111 | 9153 |
| 9112 class RecursiveASTVisitor_9 extends RecursiveASTVisitor<Object> { | 9154 class RecursiveASTVisitor_10 extends RecursiveASTVisitor<Object> { |
| 9113 List<bool> result; | 9155 List<bool> result; |
| 9114 | 9156 |
| 9115 Element variable; | 9157 Element variable; |
| 9116 | 9158 |
| 9117 RecursiveASTVisitor_9(this.result, this.variable) : super(); | 9159 RecursiveASTVisitor_10(this.result, this.variable) : super(); |
| 9118 | 9160 |
| 9119 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9161 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 9120 if (result[0]) { | 9162 if (result[0]) { |
| 9121 return null; | 9163 return null; |
| 9122 } | 9164 } |
| 9123 if (identical(node.staticElement, variable)) { | 9165 if (identical(node.staticElement, variable)) { |
| 9124 if (node.inSetterContext()) { | 9166 if (node.inSetterContext()) { |
| 9125 result[0] = javaBooleanOr(result[0], true); | 9167 result[0] = javaBooleanOr(result[0], true); |
| 9126 } | 9168 } |
| 9127 } | 9169 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9215 } | 9257 } |
| 9216 | 9258 |
| 9217 /** | 9259 /** |
| 9218 * Return the library element for the library containing the compilation unit
being resolved. | 9260 * Return the library element for the library containing the compilation unit
being resolved. |
| 9219 * | 9261 * |
| 9220 * @return the library element for the library containing the compilation unit
being resolved | 9262 * @return the library element for the library containing the compilation unit
being resolved |
| 9221 */ | 9263 */ |
| 9222 LibraryElement get definingLibrary => _definingLibrary; | 9264 LibraryElement get definingLibrary => _definingLibrary; |
| 9223 | 9265 |
| 9224 /** | 9266 /** |
| 9267 * Replaces the current [Scope] with the enclosing [Scope]. |
| 9268 */ |
| 9269 void popNameScope() { |
| 9270 _nameScope = _nameScope.enclosingScope; |
| 9271 } |
| 9272 |
| 9273 /** |
| 9274 * Pushes a new [Scope] into the visitor. |
| 9275 * |
| 9276 * @return the new [Scope]. |
| 9277 */ |
| 9278 Scope pushNameScope() { |
| 9279 Scope newScope = new EnclosedScope(_nameScope); |
| 9280 _nameScope = newScope; |
| 9281 return newScope; |
| 9282 } |
| 9283 |
| 9284 /** |
| 9225 * Report an error with the given analysis error. | 9285 * Report an error with the given analysis error. |
| 9226 * | 9286 * |
| 9227 * @param errorCode analysis error | 9287 * @param errorCode analysis error |
| 9228 */ | 9288 */ |
| 9229 void reportError(AnalysisError analysisError) { | 9289 void reportError(AnalysisError analysisError) { |
| 9230 _errorListener.onError(analysisError); | 9290 _errorListener.onError(analysisError); |
| 9231 } | 9291 } |
| 9232 | 9292 |
| 9233 Object visitBlock(Block node) { | 9293 Object visitBlock(Block node) { |
| 9234 Scope outerScope = _nameScope; | 9294 Scope outerScope = _nameScope; |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10864 * @param body the boy of the function whose propagated return type is to be c
omputed | 10924 * @param body the boy of the function whose propagated return type is to be c
omputed |
| 10865 * @return the propagated return type that was computed | 10925 * @return the propagated return type that was computed |
| 10866 */ | 10926 */ |
| 10867 Type2 computePropagatedReturnType2(FunctionBody body) { | 10927 Type2 computePropagatedReturnType2(FunctionBody body) { |
| 10868 if (body is ExpressionFunctionBody) { | 10928 if (body is ExpressionFunctionBody) { |
| 10869 ExpressionFunctionBody expressionBody = body as ExpressionFunctionBody; | 10929 ExpressionFunctionBody expressionBody = body as ExpressionFunctionBody; |
| 10870 return expressionBody.expression.bestType; | 10930 return expressionBody.expression.bestType; |
| 10871 } | 10931 } |
| 10872 if (body is BlockFunctionBody) { | 10932 if (body is BlockFunctionBody) { |
| 10873 List<Type2> result = [null]; | 10933 List<Type2> result = [null]; |
| 10874 body.accept(new GeneralizingASTVisitor_10(result)); | 10934 body.accept(new GeneralizingASTVisitor_11(result)); |
| 10875 return result[0]; | 10935 return result[0]; |
| 10876 } | 10936 } |
| 10877 return null; | 10937 return null; |
| 10878 } | 10938 } |
| 10879 | 10939 |
| 10880 /** | 10940 /** |
| 10881 * Compute the static return type of the method or function represented by the
given element. | 10941 * Compute the static return type of the method or function represented by the
given element. |
| 10882 * | 10942 * |
| 10883 * @param element the element representing the method or function invoked by t
he given node | 10943 * @param element the element representing the method or function invoked by t
he given node |
| 10884 * @return the static return type that was computed | 10944 * @return the static return type that was computed |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11227 } | 11287 } |
| 11228 } | 11288 } |
| 11229 return staticType; | 11289 return staticType; |
| 11230 } | 11290 } |
| 11231 | 11291 |
| 11232 get thisType_J2DAccessor => _thisType; | 11292 get thisType_J2DAccessor => _thisType; |
| 11233 | 11293 |
| 11234 set thisType_J2DAccessor(__v) => _thisType = __v; | 11294 set thisType_J2DAccessor(__v) => _thisType = __v; |
| 11235 } | 11295 } |
| 11236 | 11296 |
| 11237 class GeneralizingASTVisitor_10 extends GeneralizingASTVisitor<Object> { | 11297 class GeneralizingASTVisitor_11 extends GeneralizingASTVisitor<Object> { |
| 11238 List<Type2> result; | 11298 List<Type2> result; |
| 11239 | 11299 |
| 11240 GeneralizingASTVisitor_10(this.result) : super(); | 11300 GeneralizingASTVisitor_11(this.result) : super(); |
| 11241 | 11301 |
| 11242 Object visitExpression(Expression node) => null; | 11302 Object visitExpression(Expression node) => null; |
| 11243 | 11303 |
| 11244 Object visitReturnStatement(ReturnStatement node) { | 11304 Object visitReturnStatement(ReturnStatement node) { |
| 11245 Type2 type; | 11305 Type2 type; |
| 11246 Expression expression = node.expression; | 11306 Expression expression = node.expression; |
| 11247 if (expression != null) { | 11307 if (expression != null) { |
| 11248 type = expression.bestType; | 11308 type = expression.bestType; |
| 11249 } else { | 11309 } else { |
| 11250 type = BottomTypeImpl.instance; | 11310 type = BottomTypeImpl.instance; |
| (...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14118 * | 14178 * |
| 14119 * @coverage dart.engine.resolver | 14179 * @coverage dart.engine.resolver |
| 14120 */ | 14180 */ |
| 14121 class ConstantVerifier extends RecursiveASTVisitor<Object> { | 14181 class ConstantVerifier extends RecursiveASTVisitor<Object> { |
| 14122 /** | 14182 /** |
| 14123 * The error reporter by which errors will be reported. | 14183 * The error reporter by which errors will be reported. |
| 14124 */ | 14184 */ |
| 14125 ErrorReporter _errorReporter; | 14185 ErrorReporter _errorReporter; |
| 14126 | 14186 |
| 14127 /** | 14187 /** |
| 14188 * The type provider used to access the known types. |
| 14189 */ |
| 14190 TypeProvider _typeProvider; |
| 14191 |
| 14192 /** |
| 14128 * The type representing the type 'bool'. | 14193 * The type representing the type 'bool'. |
| 14129 */ | 14194 */ |
| 14130 InterfaceType _boolType; | 14195 InterfaceType _boolType; |
| 14131 | 14196 |
| 14132 /** | 14197 /** |
| 14133 * The type representing the type 'int'. | 14198 * The type representing the type 'int'. |
| 14134 */ | 14199 */ |
| 14135 InterfaceType _intType; | 14200 InterfaceType _intType; |
| 14136 | 14201 |
| 14137 /** | 14202 /** |
| 14138 * The type representing the type 'num'. | 14203 * The type representing the type 'num'. |
| 14139 */ | 14204 */ |
| 14140 InterfaceType _numType; | 14205 InterfaceType _numType; |
| 14141 | 14206 |
| 14142 /** | 14207 /** |
| 14143 * The type representing the type 'string'. | 14208 * The type representing the type 'string'. |
| 14144 */ | 14209 */ |
| 14145 InterfaceType _stringType; | 14210 InterfaceType _stringType; |
| 14146 | 14211 |
| 14147 /** | 14212 /** |
| 14148 * Initialize a newly created constant verifier. | 14213 * Initialize a newly created constant verifier. |
| 14149 * | 14214 * |
| 14150 * @param errorReporter the error reporter by which errors will be reported | 14215 * @param errorReporter the error reporter by which errors will be reported |
| 14151 */ | 14216 */ |
| 14152 ConstantVerifier(ErrorReporter errorReporter, TypeProvider typeProvider) { | 14217 ConstantVerifier(ErrorReporter errorReporter, TypeProvider typeProvider) { |
| 14153 this._errorReporter = errorReporter; | 14218 this._errorReporter = errorReporter; |
| 14219 this._typeProvider = typeProvider; |
| 14154 this._boolType = typeProvider.boolType; | 14220 this._boolType = typeProvider.boolType; |
| 14155 this._intType = typeProvider.intType; | 14221 this._intType = typeProvider.intType; |
| 14156 this._numType = typeProvider.numType; | 14222 this._numType = typeProvider.numType; |
| 14157 this._stringType = typeProvider.stringType; | 14223 this._stringType = typeProvider.stringType; |
| 14158 } | 14224 } |
| 14159 | 14225 |
| 14160 Object visitAnnotation(Annotation node) { | 14226 Object visitAnnotation(Annotation node) { |
| 14161 super.visitAnnotation(node); | 14227 super.visitAnnotation(node); |
| 14162 Element element = node.element; | 14228 Element element = node.element; |
| 14163 if (element is ConstructorElement) { | 14229 if (element is ConstructorElement) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14202 validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT); | 14268 validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT); |
| 14203 } | 14269 } |
| 14204 } | 14270 } |
| 14205 return null; | 14271 return null; |
| 14206 } | 14272 } |
| 14207 | 14273 |
| 14208 Object visitMapLiteral(MapLiteral node) { | 14274 Object visitMapLiteral(MapLiteral node) { |
| 14209 super.visitMapLiteral(node); | 14275 super.visitMapLiteral(node); |
| 14210 bool isConst = node.constKeyword != null; | 14276 bool isConst = node.constKeyword != null; |
| 14211 bool reportEqualKeys = true; | 14277 bool reportEqualKeys = true; |
| 14212 Set<Object> keys = new Set<Object>(); | 14278 Set<DartObject> keys = new Set<DartObject>(); |
| 14213 List<Expression> invalidKeys = new List<Expression>(); | 14279 List<Expression> invalidKeys = new List<Expression>(); |
| 14214 for (MapLiteralEntry entry in node.entries) { | 14280 for (MapLiteralEntry entry in node.entries) { |
| 14215 Expression key = entry.key; | 14281 Expression key = entry.key; |
| 14216 if (isConst) { | 14282 if (isConst) { |
| 14217 EvaluationResultImpl result = validate(key, CompileTimeErrorCode.NON_CON
STANT_MAP_KEY); | 14283 EvaluationResultImpl result = validate(key, CompileTimeErrorCode.NON_CON
STANT_MAP_KEY); |
| 14218 validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE); | 14284 validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE); |
| 14219 if (result is ValidResult) { | 14285 if (result is ValidResult) { |
| 14220 Object value = (result as ValidResult).value; | 14286 DartObject value = (result as ValidResult).value; |
| 14221 if (keys.contains(value)) { | 14287 if (keys.contains(value)) { |
| 14222 invalidKeys.add(key); | 14288 invalidKeys.add(key); |
| 14223 } else { | 14289 } else { |
| 14224 keys.add(value); | 14290 keys.add(value); |
| 14225 } | 14291 } |
| 14226 } | 14292 } |
| 14227 } else { | 14293 } else { |
| 14228 EvaluationResultImpl result = key.accept(new ConstantVisitor()); | 14294 EvaluationResultImpl result = key.accept(new ConstantVisitor(_typeProvid
er)); |
| 14229 if (result is ValidResult) { | 14295 if (result is ValidResult) { |
| 14230 Object value = (result as ValidResult).value; | 14296 DartObject value = (result as ValidResult).value; |
| 14231 if (keys.contains(value)) { | 14297 if (keys.contains(value)) { |
| 14232 invalidKeys.add(key); | 14298 invalidKeys.add(key); |
| 14233 } else { | 14299 } else { |
| 14234 keys.add(value); | 14300 keys.add(value); |
| 14235 } | 14301 } |
| 14236 } else { | 14302 } else { |
| 14237 reportEqualKeys = false; | 14303 reportEqualKeys = false; |
| 14238 } | 14304 } |
| 14239 } | 14305 } |
| 14240 } | 14306 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14287 ErrorCode dataErrorCode = data.errorCode; | 14353 ErrorCode dataErrorCode = data.errorCode; |
| 14288 if (identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCE
PTION) || identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE)
|| identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRIN
G) || identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL) || ide
ntical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_INT) || identical(dat
aErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM)) { | 14354 if (identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCE
PTION) || identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE)
|| identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRIN
G) || identical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL) || ide
ntical(dataErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_INT) || identical(dat
aErrorCode, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM)) { |
| 14289 _errorReporter.reportError2(dataErrorCode, data.node, []); | 14355 _errorReporter.reportError2(dataErrorCode, data.node, []); |
| 14290 } else { | 14356 } else { |
| 14291 _errorReporter.reportError2(errorCode, data.node, []); | 14357 _errorReporter.reportError2(errorCode, data.node, []); |
| 14292 } | 14358 } |
| 14293 } | 14359 } |
| 14294 } | 14360 } |
| 14295 } | 14361 } |
| 14296 | 14362 |
| 14363 ValidResult valid(InterfaceType type, InstanceState state) => new ValidResult(
new DartObjectImpl(type, state)); |
| 14364 |
| 14297 /** | 14365 /** |
| 14298 * Validate that the given expression is a compile time constant. Return the v
alue of the compile | 14366 * Validate that the given expression is a compile time constant. Return the v
alue of the compile |
| 14299 * time constant, or `null` if the expression is not a compile time constant. | 14367 * time constant, or `null` if the expression is not a compile time constant. |
| 14300 * | 14368 * |
| 14301 * @param expression the expression to be validated | 14369 * @param expression the expression to be validated |
| 14302 * @param errorCode the error code to be used if the expression is not a compi
le time constant | 14370 * @param errorCode the error code to be used if the expression is not a compi
le time constant |
| 14303 * @return the value of the compile time constant | 14371 * @return the value of the compile time constant |
| 14304 */ | 14372 */ |
| 14305 EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) { | 14373 EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) { |
| 14306 EvaluationResultImpl result = expression.accept(new ConstantVisitor()); | 14374 EvaluationResultImpl result = expression.accept(new ConstantVisitor(_typePro
vider)); |
| 14307 reportErrors(result, errorCode); | 14375 reportErrors(result, errorCode); |
| 14308 return result; | 14376 return result; |
| 14309 } | 14377 } |
| 14310 | 14378 |
| 14311 /** | 14379 /** |
| 14312 * Validate that if the passed arguments are constant expressions. | 14380 * Validate that if the passed arguments are constant expressions. |
| 14313 * | 14381 * |
| 14314 * @param argumentList the argument list to evaluate | 14382 * @param argumentList the argument list to evaluate |
| 14315 */ | 14383 */ |
| 14316 void validateConstantArguments(ArgumentList argumentList) { | 14384 void validateConstantArguments(ArgumentList argumentList) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14363 } | 14431 } |
| 14364 | 14432 |
| 14365 /** | 14433 /** |
| 14366 * Validates that the given expression is a compile time constant. | 14434 * Validates that the given expression is a compile time constant. |
| 14367 * | 14435 * |
| 14368 * @param parameterElements the elements of parameters of constant constructor
, they are | 14436 * @param parameterElements the elements of parameters of constant constructor
, they are |
| 14369 * considered as a valid potentially constant expressions | 14437 * considered as a valid potentially constant expressions |
| 14370 * @param expression the expression to validate | 14438 * @param expression the expression to validate |
| 14371 */ | 14439 */ |
| 14372 void validateInitializerExpression(List<ParameterElement> parameterElements, E
xpression expression) { | 14440 void validateInitializerExpression(List<ParameterElement> parameterElements, E
xpression expression) { |
| 14373 EvaluationResultImpl result = expression.accept(new ConstantVisitor_13(this,
parameterElements)); | 14441 EvaluationResultImpl result = expression.accept(new ConstantVisitor_14(_type
Provider, this, parameterElements)); |
| 14374 reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER)
; | 14442 reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER)
; |
| 14375 } | 14443 } |
| 14376 | 14444 |
| 14377 /** | 14445 /** |
| 14378 * Validates that all of the arguments of a constructor initializer are compil
e time constants. | 14446 * Validates that all of the arguments of a constructor initializer are compil
e time constants. |
| 14379 * | 14447 * |
| 14380 * @param parameterElements the elements of parameters of constant constructor
, they are | 14448 * @param parameterElements the elements of parameters of constant constructor
, they are |
| 14381 * considered as a valid potentially constant expressions | 14449 * considered as a valid potentially constant expressions |
| 14382 * @param argumentList the argument list to validate | 14450 * @param argumentList the argument list to validate |
| 14383 */ | 14451 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 14409 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); | 14477 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); |
| 14410 } | 14478 } |
| 14411 if (initializer is SuperConstructorInvocation) { | 14479 if (initializer is SuperConstructorInvocation) { |
| 14412 SuperConstructorInvocation invocation = initializer as SuperConstructorI
nvocation; | 14480 SuperConstructorInvocation invocation = initializer as SuperConstructorI
nvocation; |
| 14413 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); | 14481 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); |
| 14414 } | 14482 } |
| 14415 } | 14483 } |
| 14416 } | 14484 } |
| 14417 } | 14485 } |
| 14418 | 14486 |
| 14419 class ConstantVisitor_13 extends ConstantVisitor { | 14487 class ConstantVisitor_14 extends ConstantVisitor { |
| 14420 final ConstantVerifier ConstantVerifier_this; | 14488 final ConstantVerifier ConstantVerifier_this; |
| 14421 | 14489 |
| 14422 List<ParameterElement> parameterElements; | 14490 List<ParameterElement> parameterElements; |
| 14423 | 14491 |
| 14424 ConstantVisitor_13(this.ConstantVerifier_this, this.parameterElements) : super
(); | 14492 ConstantVisitor_14(TypeProvider arg0, this.ConstantVerifier_this, this.paramet
erElements) : super(arg0); |
| 14425 | 14493 |
| 14426 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) { | 14494 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) { |
| 14427 Element element = node.staticElement; | 14495 Element element = node.staticElement; |
| 14428 for (ParameterElement parameterElement in parameterElements) { | 14496 for (ParameterElement parameterElement in parameterElements) { |
| 14429 if (identical(parameterElement, element) && parameterElement != null) { | 14497 if (identical(parameterElement, element) && parameterElement != null) { |
| 14430 Type2 type = parameterElement.type; | 14498 Type2 type = parameterElement.type; |
| 14431 if (type != null) { | 14499 if (type != null) { |
| 14432 if (type.isDynamic) { | 14500 if (type.isDynamic) { |
| 14433 return ValidResult.RESULT_DYNAMIC; | 14501 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.objectType, DynamicState.DYNAMIC_STATE); |
| 14434 } | 14502 } else if (type.isSubtypeOf(ConstantVerifier_this._boolType)) { |
| 14435 if (type.isSubtypeOf(ConstantVerifier_this._boolType)) { | 14503 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.boolType, BoolState.UNKNOWN_VALUE); |
| 14436 return ValidResult.RESULT_BOOL; | 14504 } else if (type.isSubtypeOf(ConstantVerifier_this._typeProvider.double
Type)) { |
| 14437 } | 14505 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.doubleType, DoubleState.UNKNOWN_VALUE); |
| 14438 if (type.isSubtypeOf(ConstantVerifier_this._intType)) { | 14506 } else if (type.isSubtypeOf(ConstantVerifier_this._intType)) { |
| 14439 return ValidResult.RESULT_INT; | 14507 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.intType, IntState.UNKNOWN_VALUE); |
| 14440 } | 14508 } else if (type.isSubtypeOf(ConstantVerifier_this._numType)) { |
| 14441 if (type.isSubtypeOf(ConstantVerifier_this._numType)) { | 14509 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.numType, NumState.UNKNOWN_VALUE); |
| 14442 return ValidResult.RESULT_NUM; | 14510 } else if (type.isSubtypeOf(ConstantVerifier_this._stringType)) { |
| 14443 } | 14511 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.stringType, StringState.UNKNOWN_VALUE); |
| 14444 if (type.isSubtypeOf(ConstantVerifier_this._stringType)) { | |
| 14445 return ValidResult.RESULT_STRING; | |
| 14446 } | 14512 } |
| 14447 } | 14513 } |
| 14448 return ValidResult.RESULT_OBJECT; | 14514 return ConstantVerifier_this.valid(type is InterfaceType ? (type as Inte
rfaceType) : ConstantVerifier_this._typeProvider.objectType, GenericState.UNKNOW
N_VALUE); |
| 14449 } | 14515 } |
| 14450 } | 14516 } |
| 14451 return super.visitSimpleIdentifier(node); | 14517 return super.visitSimpleIdentifier(node); |
| 14452 } | 14518 } |
| 14453 } | 14519 } |
| 14454 | 14520 |
| 14455 /** | 14521 /** |
| 14456 * Instances of the class `ErrorVerifier` traverse an AST structure looking for
additional | 14522 * Instances of the class `ErrorVerifier` traverse an AST structure looking for
additional |
| 14457 * errors and warnings not covered by the parser and resolver. | 14523 * errors and warnings not covered by the parser and resolver. |
| 14458 * | 14524 * |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15508 if (parameterElt is ParameterElementImpl) { | 15574 if (parameterElt is ParameterElementImpl) { |
| 15509 overriddenParameterElts.add(parameterElt as ParameterElementImpl); | 15575 overriddenParameterElts.add(parameterElt as ParameterElementImpl); |
| 15510 } | 15576 } |
| 15511 } | 15577 } |
| 15512 } | 15578 } |
| 15513 if (parameterElts.length > 0) { | 15579 if (parameterElts.length > 0) { |
| 15514 if (identical(parameterElts[0].parameterKind, ParameterKind.NAMED)) { | 15580 if (identical(parameterElts[0].parameterKind, ParameterKind.NAMED)) { |
| 15515 for (int i = 0; i < parameterElts.length; i++) { | 15581 for (int i = 0; i < parameterElts.length; i++) { |
| 15516 ParameterElementImpl parameterElt = parameterElts[i]; | 15582 ParameterElementImpl parameterElt = parameterElts[i]; |
| 15517 EvaluationResultImpl result = parameterElt.evaluationResult; | 15583 EvaluationResultImpl result = parameterElt.evaluationResult; |
| 15518 if (result == null || identical(result, ValidResult.RESULT_OBJECT)) { | 15584 if (isUserDefinedObject(result)) { |
| 15519 continue; | 15585 continue; |
| 15520 } | 15586 } |
| 15521 String parameterName = parameterElt.name; | 15587 String parameterName = parameterElt.name; |
| 15522 for (int j = 0; j < overriddenParameterElts.length; j++) { | 15588 for (int j = 0; j < overriddenParameterElts.length; j++) { |
| 15523 ParameterElementImpl overriddenParameterElt = overriddenParameterElt
s[j]; | 15589 ParameterElementImpl overriddenParameterElt = overriddenParameterElt
s[j]; |
| 15524 String overriddenParameterName = overriddenParameterElt.name; | 15590 String overriddenParameterName = overriddenParameterElt.name; |
| 15525 if (parameterName != null && parameterName == overriddenParameterNam
e) { | 15591 if (parameterName != null && parameterName == overriddenParameterNam
e) { |
| 15526 EvaluationResultImpl overriddenResult = overriddenParameterElt.eva
luationResult; | 15592 EvaluationResultImpl overriddenResult = overriddenParameterElt.eva
luationResult; |
| 15527 if (overriddenResult == null || identical(result, ValidResult.RESU
LT_OBJECT)) { | 15593 if (isUserDefinedObject(overriddenResult)) { |
| 15528 break; | 15594 break; |
| 15529 } | 15595 } |
| 15530 if (!result.equalValues(overriddenResult)) { | 15596 if (!result.equalValues(_typeProvider, overriddenResult)) { |
| 15531 _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_D
IFFERENT_DEFAULT_VALUES_NAMED, formalParameters[i], [ | 15597 _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_D
IFFERENT_DEFAULT_VALUES_NAMED, formalParameters[i], [ |
| 15532 overriddenExecutable.enclosingElement.displayName, | 15598 overriddenExecutable.enclosingElement.displayName, |
| 15533 overriddenExecutable.displayName, | 15599 overriddenExecutable.displayName, |
| 15534 parameterName]); | 15600 parameterName]); |
| 15535 foundError = true; | 15601 foundError = true; |
| 15536 } | 15602 } |
| 15537 } | 15603 } |
| 15538 } | 15604 } |
| 15539 } | 15605 } |
| 15540 } else { | 15606 } else { |
| 15541 for (int i = 0; i < parameterElts.length && i < overriddenParameterElts.
length; i++) { | 15607 for (int i = 0; i < parameterElts.length && i < overriddenParameterElts.
length; i++) { |
| 15542 ParameterElementImpl parameterElt = parameterElts[i]; | 15608 ParameterElementImpl parameterElt = parameterElts[i]; |
| 15543 EvaluationResultImpl result = parameterElt.evaluationResult; | 15609 EvaluationResultImpl result = parameterElt.evaluationResult; |
| 15544 if (result == null || identical(result, ValidResult.RESULT_OBJECT)) { | 15610 if (isUserDefinedObject(result)) { |
| 15545 continue; | 15611 continue; |
| 15546 } | 15612 } |
| 15547 ParameterElementImpl overriddenParameterElt = overriddenParameterElts[
i]; | 15613 ParameterElementImpl overriddenParameterElt = overriddenParameterElts[
i]; |
| 15548 EvaluationResultImpl overriddenResult = overriddenParameterElt.evaluat
ionResult; | 15614 EvaluationResultImpl overriddenResult = overriddenParameterElt.evaluat
ionResult; |
| 15549 if (overriddenResult == null || identical(result, ValidResult.RESULT_O
BJECT)) { | 15615 if (isUserDefinedObject(overriddenResult)) { |
| 15550 continue; | 15616 continue; |
| 15551 } | 15617 } |
| 15552 if (!result.equalValues(overriddenResult)) { | 15618 if (!result.equalValues(_typeProvider, overriddenResult)) { |
| 15553 _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_DIFFE
RENT_DEFAULT_VALUES_POSITIONAL, formalParameters[i], [ | 15619 _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_DIFFE
RENT_DEFAULT_VALUES_POSITIONAL, formalParameters[i], [ |
| 15554 overriddenExecutable.enclosingElement.displayName, | 15620 overriddenExecutable.enclosingElement.displayName, |
| 15555 overriddenExecutable.displayName]); | 15621 overriddenExecutable.displayName]); |
| 15556 foundError = true; | 15622 foundError = true; |
| 15557 } | 15623 } |
| 15558 } | 15624 } |
| 15559 } | 15625 } |
| 15560 } | 15626 } |
| 15561 return foundError; | 15627 return foundError; |
| 15562 } | 15628 } |
| (...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17597 } | 17663 } |
| 17598 Set<ExecutableElement> missingOverrides = new Set<ExecutableElement>(); | 17664 Set<ExecutableElement> missingOverrides = new Set<ExecutableElement>(); |
| 17599 MemberMap membersInheritedFromInterfaces = _inheritanceManager.getMapOfMembe
rsInheritedFromInterfaces(_enclosingClass); | 17665 MemberMap membersInheritedFromInterfaces = _inheritanceManager.getMapOfMembe
rsInheritedFromInterfaces(_enclosingClass); |
| 17600 MemberMap membersInheritedFromSuperclasses = _inheritanceManager.getMapOfMem
bersInheritedFromClasses(_enclosingClass); | 17666 MemberMap membersInheritedFromSuperclasses = _inheritanceManager.getMapOfMem
bersInheritedFromClasses(_enclosingClass); |
| 17601 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) { | 17667 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) { |
| 17602 String memberName = membersInheritedFromInterfaces.getKey(i); | 17668 String memberName = membersInheritedFromInterfaces.getKey(i); |
| 17603 ExecutableElement executableElt = membersInheritedFromInterfaces.getValue(
i); | 17669 ExecutableElement executableElt = membersInheritedFromInterfaces.getValue(
i); |
| 17604 if (memberName == null) { | 17670 if (memberName == null) { |
| 17605 break; | 17671 break; |
| 17606 } | 17672 } |
| 17673 if ((executableElt.enclosingElement as ClassElement).type.isObject) { |
| 17674 continue; |
| 17675 } |
| 17676 InterfaceType enclosingType = _enclosingClass.type; |
| 17677 if (isMemberInClassOrMixin(executableElt, _enclosingClass)) { |
| 17678 continue; |
| 17679 } |
| 17607 ExecutableElement elt = membersInheritedFromSuperclasses.get(executableElt
.name); | 17680 ExecutableElement elt = membersInheritedFromSuperclasses.get(executableElt
.name); |
| 17608 if (elt != null) { | 17681 if (elt != null) { |
| 17609 if (elt is MethodElement && !(elt as MethodElement).isAbstract) { | 17682 if ((elt is MethodElement && !(elt as MethodElement).isAbstract) || (elt
is PropertyAccessorElement && !(elt as PropertyAccessorElement).isAbstract)) { |
| 17610 continue; | 17683 FunctionType foundConcreteFT = _inheritanceManager.substituteTypeArgum
entsInMemberFromInheritance(elt.type, executableElt.name, enclosingType); |
| 17611 } else if (elt is PropertyAccessorElement && !(elt as PropertyAccessorEl
ement).isAbstract) { | 17684 FunctionType requiredMemberFT = _inheritanceManager.substituteTypeArgu
mentsInMemberFromInheritance(executableElt.type, executableElt.name, enclosingTy
pe); |
| 17612 continue; | 17685 if (foundConcreteFT.isSubtypeOf(requiredMemberFT)) { |
| 17686 continue; |
| 17687 } |
| 17613 } | 17688 } |
| 17614 } | 17689 } |
| 17615 if (executableElt is MethodElement) { | 17690 missingOverrides.add(executableElt); |
| 17616 if (!methodsInEnclosingClass.contains(memberName) && !memberHasConcreteM
ethodImplementationInSuperclassChain(_enclosingClass, memberName, new List<Class
Element>())) { | |
| 17617 missingOverrides.add(executableElt); | |
| 17618 } | |
| 17619 } else if (executableElt is PropertyAccessorElement) { | |
| 17620 if (!accessorsInEnclosingClass.contains(memberName) && !memberHasConcret
eAccessorImplementationInSuperclassChain(_enclosingClass, memberName, new List<C
lassElement>())) { | |
| 17621 missingOverrides.add(executableElt); | |
| 17622 } | |
| 17623 } | |
| 17624 } | 17691 } |
| 17625 int missingOverridesSize = missingOverrides.length; | 17692 int missingOverridesSize = missingOverrides.length; |
| 17626 if (missingOverridesSize == 0) { | 17693 if (missingOverridesSize == 0) { |
| 17627 return false; | 17694 return false; |
| 17628 } | 17695 } |
| 17629 List<ExecutableElement> missingOverridesArray = new List.from(missingOverrid
es); | 17696 List<ExecutableElement> missingOverridesArray = new List.from(missingOverrid
es); |
| 17630 List<String> stringMembersArrayListSet = new List<String>(); | 17697 List<String> stringMembersArrayListSet = new List<String>(); |
| 17631 for (int i = 0; i < missingOverridesArray.length; i++) { | 17698 for (int i = 0; i < missingOverridesArray.length; i++) { |
| 17632 String newStrMember = "${missingOverridesArray[i].enclosingElement.display
Name}.${missingOverridesArray[i].displayName}"; | 17699 String newStrMember = "${missingOverridesArray[i].enclosingElement.display
Name}.${missingOverridesArray[i].displayName}"; |
| 17633 if (!stringMembersArrayListSet.contains(newStrMember)) { | 17700 if (!stringMembersArrayListSet.contains(newStrMember)) { |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18566 firstIteration = false; | 18633 firstIteration = false; |
| 18567 break; | 18634 break; |
| 18568 } else { | 18635 } else { |
| 18569 return true; | 18636 return true; |
| 18570 } | 18637 } |
| 18571 } | 18638 } |
| 18572 if (current != null && !checked.contains(current)) { | 18639 if (current != null && !checked.contains(current)) { |
| 18573 break; | 18640 break; |
| 18574 } | 18641 } |
| 18575 } | 18642 } |
| 18576 current.accept(new GeneralizingElementVisitor_14(target, toCheck)); | 18643 current.accept(new GeneralizingElementVisitor_15(target, toCheck)); |
| 18577 checked.add(current); | 18644 checked.add(current); |
| 18578 } | 18645 } |
| 18579 } | 18646 } |
| 18580 | 18647 |
| 18581 /** | 18648 /** |
| 18582 * @return `true` if given [Type] implements operator <i>==</i>, and it is not | 18649 * @return `true` if given [Type] implements operator <i>==</i>, and it is not |
| 18583 * <i>int</i> or <i>String</i>. | 18650 * <i>int</i> or <i>String</i>. |
| 18584 */ | 18651 */ |
| 18585 bool implementsEqualsWhenNotAllowed(Type2 type) { | 18652 bool implementsEqualsWhenNotAllowed(Type2 type) { |
| 18586 if (type == null || type == _typeProvider.intType || type == _typeProvider.s
tringType) { | 18653 if (type == null || type == _typeProvider.intType || type == _typeProvider.s
tringType) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 18616 */ | 18683 */ |
| 18617 bool isInConstConstructorInvocation(ASTNode node) { | 18684 bool isInConstConstructorInvocation(ASTNode node) { |
| 18618 InstanceCreationExpression creation = node.getAncestor(InstanceCreationExpre
ssion); | 18685 InstanceCreationExpression creation = node.getAncestor(InstanceCreationExpre
ssion); |
| 18619 if (creation == null) { | 18686 if (creation == null) { |
| 18620 return false; | 18687 return false; |
| 18621 } | 18688 } |
| 18622 return creation.isConst; | 18689 return creation.isConst; |
| 18623 } | 18690 } |
| 18624 | 18691 |
| 18625 /** | 18692 /** |
| 18693 * Return `true` iff the passed [ClassElement] has a method, getter or setter
that |
| 18694 * matches the name of the passed [ExecutableElement] in either the class itse
lf, or one of |
| 18695 * its' mixins. |
| 18696 * |
| 18697 * By "match", only the name of the member is tested to match, it does not hav
e to equal or be a |
| 18698 * subtype of the passed executable element, this is due to the specific use w
here this method is |
| 18699 * used in [checkForNonAbstractClassInheritsAbstractMember]. |
| 18700 * |
| 18701 * @param executableElt the executable to search for in the passed class eleme
nt |
| 18702 * @param classElt the class method to search through the members of |
| 18703 * @return `true` iff the passed member is found in the passed class element |
| 18704 */ |
| 18705 bool isMemberInClassOrMixin(ExecutableElement executableElt, ClassElement clas
sElt) { |
| 18706 ExecutableElement foundElt; |
| 18707 String executableName = executableElt.name; |
| 18708 if (executableElt is MethodElement) { |
| 18709 foundElt = classElt.getMethod(executableName); |
| 18710 if (foundElt != null) { |
| 18711 return true; |
| 18712 } |
| 18713 List<InterfaceType> mixins = classElt.mixins; |
| 18714 for (int i = 0; i < mixins.length && foundElt == null; i++) { |
| 18715 foundElt = mixins[i].getMethod(executableName); |
| 18716 } |
| 18717 if (foundElt != null) { |
| 18718 return true; |
| 18719 } |
| 18720 } else if (executableElt is PropertyAccessorElement) { |
| 18721 foundElt = classElt.getGetter(executableElt.name); |
| 18722 if (foundElt == null) { |
| 18723 foundElt = classElt.getSetter(executableName); |
| 18724 } |
| 18725 if (foundElt != null) { |
| 18726 return true; |
| 18727 } |
| 18728 List<InterfaceType> mixins = classElt.mixins; |
| 18729 for (int i = 0; i < mixins.length && foundElt == null; i++) { |
| 18730 foundElt = mixins[i].getGetter(executableName); |
| 18731 if (foundElt == null) { |
| 18732 foundElt = mixins[i].getSetter(executableName); |
| 18733 } |
| 18734 } |
| 18735 if (foundElt != null) { |
| 18736 return true; |
| 18737 } |
| 18738 } |
| 18739 return false; |
| 18740 } |
| 18741 |
| 18742 /** |
| 18626 * @param node the 'this' expression to analyze | 18743 * @param node the 'this' expression to analyze |
| 18627 * @return `true` if the given 'this' expression is in the valid context | 18744 * @return `true` if the given 'this' expression is in the valid context |
| 18628 */ | 18745 */ |
| 18629 bool isThisInValidContext(ThisExpression node) { | 18746 bool isThisInValidContext(ThisExpression node) { |
| 18630 for (ASTNode n = node; n != null; n = n.parent) { | 18747 for (ASTNode n = node; n != null; n = n.parent) { |
| 18631 if (n is CompilationUnit) { | 18748 if (n is CompilationUnit) { |
| 18632 return false; | 18749 return false; |
| 18633 } | 18750 } |
| 18634 if (n is ConstructorDeclaration) { | 18751 if (n is ConstructorDeclaration) { |
| 18635 ConstructorDeclaration constructor = n as ConstructorDeclaration; | 18752 ConstructorDeclaration constructor = n as ConstructorDeclaration; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18670 } | 18787 } |
| 18671 if (parent is CommentReference) { | 18788 if (parent is CommentReference) { |
| 18672 CommentReference commentReference = parent as CommentReference; | 18789 CommentReference commentReference = parent as CommentReference; |
| 18673 if (commentReference.newKeyword != null) { | 18790 if (commentReference.newKeyword != null) { |
| 18674 return true; | 18791 return true; |
| 18675 } | 18792 } |
| 18676 } | 18793 } |
| 18677 return false; | 18794 return false; |
| 18678 } | 18795 } |
| 18679 | 18796 |
| 18797 bool isUserDefinedObject(EvaluationResultImpl result) => result == null || (re
sult is ValidResult && (result as ValidResult).isUserDefinedObject); |
| 18798 |
| 18680 /** | 18799 /** |
| 18681 * Return `true` iff the passed [ClassElement] has a concrete implementation o
f the | 18800 * Return `true` iff the passed [ClassElement] has a concrete implementation o
f the |
| 18682 * passed accessor name in the superclass chain. | 18801 * passed accessor name in the superclass chain. |
| 18683 */ | 18802 */ |
| 18684 bool memberHasConcreteAccessorImplementationInSuperclassChain(ClassElement cla
ssElement, String accessorName, List<ClassElement> superclassChain) { | 18803 bool memberHasConcreteAccessorImplementationInSuperclassChain(ClassElement cla
ssElement, String accessorName, List<ClassElement> superclassChain) { |
| 18685 if (superclassChain.contains(classElement)) { | 18804 if (superclassChain.contains(classElement)) { |
| 18686 return false; | 18805 return false; |
| 18687 } else { | 18806 } else { |
| 18688 superclassChain.add(classElement); | 18807 superclassChain.add(classElement); |
| 18689 } | 18808 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18776 | 18895 |
| 18777 static final List<INIT_STATE> values = [ | 18896 static final List<INIT_STATE> values = [ |
| 18778 NOT_INIT, | 18897 NOT_INIT, |
| 18779 INIT_IN_DECLARATION, | 18898 INIT_IN_DECLARATION, |
| 18780 INIT_IN_FIELD_FORMAL, | 18899 INIT_IN_FIELD_FORMAL, |
| 18781 INIT_IN_INITIALIZERS]; | 18900 INIT_IN_INITIALIZERS]; |
| 18782 | 18901 |
| 18783 INIT_STATE(String name, int ordinal) : super(name, ordinal); | 18902 INIT_STATE(String name, int ordinal) : super(name, ordinal); |
| 18784 } | 18903 } |
| 18785 | 18904 |
| 18786 class GeneralizingElementVisitor_14 extends GeneralizingElementVisitor<Object> { | 18905 class GeneralizingElementVisitor_15 extends GeneralizingElementVisitor<Object> { |
| 18787 Element target; | 18906 Element target; |
| 18788 | 18907 |
| 18789 List<Element> toCheck; | 18908 List<Element> toCheck; |
| 18790 | 18909 |
| 18791 GeneralizingElementVisitor_14(this.target, this.toCheck) : super(); | 18910 GeneralizingElementVisitor_15(this.target, this.toCheck) : super(); |
| 18792 | 18911 |
| 18793 bool _inClass = false; | 18912 bool _inClass = false; |
| 18794 | 18913 |
| 18795 Object visitClassElement(ClassElement element) { | 18914 Object visitClassElement(ClassElement element) { |
| 18796 addTypeToCheck(element.supertype); | 18915 addTypeToCheck(element.supertype); |
| 18797 for (InterfaceType mixin in element.mixins) { | 18916 for (InterfaceType mixin in element.mixins) { |
| 18798 addTypeToCheck(mixin); | 18917 addTypeToCheck(mixin); |
| 18799 } | 18918 } |
| 18800 _inClass = !element.isTypedef; | 18919 _inClass = !element.isTypedef; |
| 18801 try { | 18920 try { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18903 * @param correction the template used to create the correction to be displaye
d for the error | 19022 * @param correction the template used to create the correction to be displaye
d for the error |
| 18904 */ | 19023 */ |
| 18905 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { | 19024 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { |
| 18906 this.correction9 = correction; | 19025 this.correction9 = correction; |
| 18907 } | 19026 } |
| 18908 | 19027 |
| 18909 String get correction => correction9; | 19028 String get correction => correction9; |
| 18910 | 19029 |
| 18911 ErrorSeverity get errorSeverity => type.severity; | 19030 ErrorSeverity get errorSeverity => type.severity; |
| 18912 } | 19031 } |
| OLD | NEW |