| 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 library engine.resolver; | 3 library engine.resolver; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'instrumentation.dart'; | 7 import 'instrumentation.dart'; |
| 8 import 'source.dart'; | 8 import 'source.dart'; |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'scanner.dart' as sc; | 10 import 'scanner.dart' as sc; |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 if (node.inSetterContext()) { | 1936 if (node.inSetterContext()) { |
| 1937 String methodName = sc.TokenType.INDEX_EQ.lexeme; | 1937 String methodName = sc.TokenType.INDEX_EQ.lexeme; |
| 1938 lookUpCheckIndexOperator(node, target, methodName, staticType, propagatedT
ype); | 1938 lookUpCheckIndexOperator(node, target, methodName, staticType, propagatedT
ype); |
| 1939 } | 1939 } |
| 1940 return null; | 1940 return null; |
| 1941 } | 1941 } |
| 1942 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 1942 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 1943 ConstructorElement invokedConstructor = node.constructorName.element; | 1943 ConstructorElement invokedConstructor = node.constructorName.element; |
| 1944 node.staticElement = invokedConstructor; | 1944 node.staticElement = invokedConstructor; |
| 1945 node.element = invokedConstructor; | 1945 node.element = invokedConstructor; |
| 1946 resolveArgumentsToParameters(node.isConst(), node.argumentList, invokedConst
ructor); | 1946 ArgumentList argumentList2 = node.argumentList; |
| 1947 List<ParameterElement> parameters = resolveArgumentsToParameters(node.isCons
t(), argumentList2, invokedConstructor); |
| 1948 if (parameters != null) { |
| 1949 argumentList2.correspondingStaticParameters = parameters; |
| 1950 } |
| 1947 return null; | 1951 return null; |
| 1948 } | 1952 } |
| 1949 Object visitLibraryDirective(LibraryDirective node) { | 1953 Object visitLibraryDirective(LibraryDirective node) { |
| 1950 setMetadata(node.element, node); | 1954 setMetadata(node.element, node); |
| 1951 return null; | 1955 return null; |
| 1952 } | 1956 } |
| 1953 Object visitMethodDeclaration(MethodDeclaration node) { | 1957 Object visitMethodDeclaration(MethodDeclaration node) { |
| 1954 setMetadata(node.element, node); | 1958 setMetadata(node.element, node); |
| 1955 return null; | 1959 return null; |
| 1956 } | 1960 } |
| 1957 Object visitMethodInvocation(MethodInvocation node) { | 1961 Object visitMethodInvocation(MethodInvocation node) { |
| 1958 SimpleIdentifier methodName2 = node.methodName; | 1962 SimpleIdentifier methodName2 = node.methodName; |
| 1959 Expression target = node.realTarget; | 1963 Expression target = node.realTarget; |
| 1960 Element staticElement; | 1964 Element staticElement; |
| 1961 Element propagatedElement; | 1965 Element propagatedElement; |
| 1962 if (target is SuperExpression && !isSuperInValidContext((target as SuperExpr
ession))) { | 1966 if (target is SuperExpression && !isSuperInValidContext((target as SuperExpr
ession))) { |
| 1963 return null; | 1967 return null; |
| 1964 } | 1968 } |
| 1965 if (target == null) { | 1969 if (target == null) { |
| 1966 staticElement = resolveInvokedElement2(methodName2); | 1970 staticElement = resolveInvokedElement2(methodName2); |
| 1967 propagatedElement = null; | 1971 propagatedElement = null; |
| 1968 } else { | 1972 } else { |
| 1969 Type2 targetType = getStaticType(target); | 1973 Type2 targetType = getStaticType(target); |
| 1970 staticElement = resolveInvokedElement(target, targetType, methodName2); | 1974 staticElement = resolveInvokedElement(target, targetType, methodName2); |
| 1971 propagatedElement = resolveInvokedElement(target, getPropagatedType(target
), methodName2); | 1975 propagatedElement = resolveInvokedElement(target, getPropagatedType(target
), methodName2); |
| 1972 } | 1976 } |
| 1973 staticElement = convertSetterToGetter(staticElement); | 1977 staticElement = convertSetterToGetter(staticElement); |
| 1974 propagatedElement = convertSetterToGetter(propagatedElement); | 1978 propagatedElement = convertSetterToGetter(propagatedElement); |
| 1975 Element recordedElement = recordResolution2(methodName2, staticElement, prop
agatedElement); | 1979 recordResolution2(methodName2, staticElement, propagatedElement); |
| 1976 if (recordedElement is PropertyAccessorElement) { | 1980 ArgumentList argumentList2 = node.argumentList; |
| 1977 FunctionType getterType = ((recordedElement as PropertyAccessorElement)).t
ype; | 1981 if (staticElement != null) { |
| 1978 if (getterType != null) { | 1982 List<ParameterElement> parameters = computePropagatedParameters(argumentLi
st2, staticElement); |
| 1979 Type2 getterReturnType = getterType.returnType; | 1983 if (parameters != null) { |
| 1980 if (getterReturnType is InterfaceType) { | 1984 argumentList2.correspondingStaticParameters = parameters; |
| 1981 MethodElement callMethod = ((getterReturnType as InterfaceType)).lookU
pMethod(CALL_METHOD_NAME, _resolver.definingLibrary); | |
| 1982 if (callMethod != null) { | |
| 1983 resolveArgumentsToParameters(false, node.argumentList, callMethod); | |
| 1984 } | |
| 1985 } else if (getterReturnType is FunctionType) { | |
| 1986 Element functionElement = ((getterReturnType as FunctionType)).element
; | |
| 1987 if (functionElement is ExecutableElement) { | |
| 1988 resolveArgumentsToParameters(false, node.argumentList, (functionElem
ent as ExecutableElement)); | |
| 1989 } | |
| 1990 } | |
| 1991 } | 1985 } |
| 1992 } else if (recordedElement is ExecutableElement) { | 1986 } |
| 1993 resolveArgumentsToParameters(false, node.argumentList, (recordedElement as
ExecutableElement)); | 1987 if (propagatedElement != null) { |
| 1994 } else if (recordedElement is VariableElement) { | 1988 List<ParameterElement> parameters = computePropagatedParameters(argumentLi
st2, propagatedElement); |
| 1995 VariableElement variable = recordedElement as VariableElement; | 1989 if (parameters != null) { |
| 1996 Type2 type2 = variable.type; | 1990 argumentList2.correspondingParameters = parameters; |
| 1997 if (type2 is FunctionType) { | |
| 1998 FunctionType functionType = type2 as FunctionType; | |
| 1999 List<ParameterElement> parameters2 = functionType.parameters; | |
| 2000 resolveArgumentsToParameters2(false, node.argumentList, parameters2); | |
| 2001 } else if (type2 is InterfaceType) { | |
| 2002 MethodElement callMethod = ((type2 as InterfaceType)).lookUpMethod(CALL_
METHOD_NAME, _resolver.definingLibrary); | |
| 2003 if (callMethod != null) { | |
| 2004 List<ParameterElement> parameters3 = callMethod.parameters; | |
| 2005 resolveArgumentsToParameters2(false, node.argumentList, parameters3); | |
| 2006 } | |
| 2007 } | 1991 } |
| 2008 } | 1992 } |
| 2009 ErrorCode errorCode; | 1993 ErrorCode errorCode; |
| 2010 if (staticElement == null) { | 1994 if (staticElement == null) { |
| 2011 if (propagatedElement == null) { | 1995 if (propagatedElement == null) { |
| 2012 errorCode = checkForInvocationError(target, staticElement); | 1996 errorCode = checkForInvocationError(target, staticElement); |
| 2013 } else { | 1997 } else { |
| 2014 errorCode = checkForInvocationError(target, propagatedElement); | 1998 errorCode = checkForInvocationError(target, propagatedElement); |
| 2015 } | 1999 } |
| 2016 } else { | 2000 } else { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 element = enclosingClass2.getNamedConstructor(name.name); | 2117 element = enclosingClass2.getNamedConstructor(name.name); |
| 2134 } | 2118 } |
| 2135 if (element == null) { | 2119 if (element == null) { |
| 2136 return null; | 2120 return null; |
| 2137 } | 2121 } |
| 2138 if (name != null) { | 2122 if (name != null) { |
| 2139 recordResolution(name, element); | 2123 recordResolution(name, element); |
| 2140 } | 2124 } |
| 2141 node.staticElement = element; | 2125 node.staticElement = element; |
| 2142 node.element = element; | 2126 node.element = element; |
| 2143 resolveArgumentsToParameters(false, node.argumentList, element); | 2127 ArgumentList argumentList2 = node.argumentList; |
| 2128 List<ParameterElement> parameters = resolveArgumentsToParameters(false, argu
mentList2, element); |
| 2129 if (parameters != null) { |
| 2130 argumentList2.correspondingStaticParameters = parameters; |
| 2131 } |
| 2144 return null; | 2132 return null; |
| 2145 } | 2133 } |
| 2146 Object visitSimpleIdentifier(SimpleIdentifier node) { | 2134 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 2147 if (node.element != null) { | 2135 if (node.element != null) { |
| 2148 return null; | 2136 return null; |
| 2149 } | 2137 } |
| 2150 Element element = resolveSimpleIdentifier(node); | 2138 Element element = resolveSimpleIdentifier(node); |
| 2151 if (isFactoryConstructorReturnType(node) && element != _resolver.enclosingCl
ass) { | 2139 if (isFactoryConstructorReturnType(node) && element != _resolver.enclosingCl
ass) { |
| 2152 _resolver.reportError(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLAS
S, node, []); | 2140 _resolver.reportError(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLAS
S, node, []); |
| 2153 } else if (element == null) { | 2141 } else if (element == null) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 } else { | 2174 } else { |
| 2187 if (element.isFactory()) { | 2175 if (element.isFactory()) { |
| 2188 _resolver.reportError(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, n
ode, [element]); | 2176 _resolver.reportError(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, n
ode, [element]); |
| 2189 } | 2177 } |
| 2190 } | 2178 } |
| 2191 if (name != null) { | 2179 if (name != null) { |
| 2192 recordResolution(name, element); | 2180 recordResolution(name, element); |
| 2193 } | 2181 } |
| 2194 node.staticElement = element; | 2182 node.staticElement = element; |
| 2195 node.element = element; | 2183 node.element = element; |
| 2196 resolveArgumentsToParameters(false, node.argumentList, element); | 2184 ArgumentList argumentList2 = node.argumentList; |
| 2185 List<ParameterElement> parameters = resolveArgumentsToParameters(false, argu
mentList2, element); |
| 2186 if (parameters != null) { |
| 2187 argumentList2.correspondingStaticParameters = parameters; |
| 2188 } |
| 2197 return null; | 2189 return null; |
| 2198 } | 2190 } |
| 2199 Object visitSuperExpression(SuperExpression node) { | 2191 Object visitSuperExpression(SuperExpression node) { |
| 2200 if (!isSuperInValidContext(node)) { | 2192 if (!isSuperInValidContext(node)) { |
| 2201 _resolver.reportError(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, node,
[]); | 2193 _resolver.reportError(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, node,
[]); |
| 2202 } | 2194 } |
| 2203 return super.visitSuperExpression(node); | 2195 return super.visitSuperExpression(node); |
| 2204 } | 2196 } |
| 2205 Object visitTypeParameter(TypeParameter node) { | 2197 Object visitTypeParameter(TypeParameter node) { |
| 2206 TypeName bound2 = node.bound; | 2198 TypeName bound2 = node.bound; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 * "noSuchMethod" | 2310 * "noSuchMethod" |
| 2319 */ | 2311 */ |
| 2320 bool classDeclaresNoSuchMethod2(Element element) { | 2312 bool classDeclaresNoSuchMethod2(Element element) { |
| 2321 if (element is ClassElement) { | 2313 if (element is ClassElement) { |
| 2322 return classDeclaresNoSuchMethod((element as ClassElement)); | 2314 return classDeclaresNoSuchMethod((element as ClassElement)); |
| 2323 } | 2315 } |
| 2324 return false; | 2316 return false; |
| 2325 } | 2317 } |
| 2326 | 2318 |
| 2327 /** | 2319 /** |
| 2320 * Given a list of arguments and the element that will be invoked using those
argument, compute |
| 2321 * the list of parameters that correspond to the list of arguments. Return the
parameters that |
| 2322 * correspond to the arguments, or {@code null} if no correspondence could be
computed. |
| 2323 * @param argumentList the list of arguments being passed to the element |
| 2324 * @param executableElement the element that will be invoked with the argument
s |
| 2325 * @return the parameters that correspond to the arguments |
| 2326 */ |
| 2327 List<ParameterElement> computePropagatedParameters(ArgumentList argumentList,
Element element2) { |
| 2328 if (element2 is PropertyAccessorElement) { |
| 2329 FunctionType getterType = ((element2 as PropertyAccessorElement)).type; |
| 2330 if (getterType != null) { |
| 2331 Type2 getterReturnType = getterType.returnType; |
| 2332 if (getterReturnType is InterfaceType) { |
| 2333 MethodElement callMethod = ((getterReturnType as InterfaceType)).lookU
pMethod(CALL_METHOD_NAME, _resolver.definingLibrary); |
| 2334 if (callMethod != null) { |
| 2335 return resolveArgumentsToParameters(false, argumentList, callMethod)
; |
| 2336 } |
| 2337 } else if (getterReturnType is FunctionType) { |
| 2338 Element functionElement = ((getterReturnType as FunctionType)).element
; |
| 2339 if (functionElement is ExecutableElement) { |
| 2340 return resolveArgumentsToParameters(false, argumentList, (functionEl
ement as ExecutableElement)); |
| 2341 } |
| 2342 } |
| 2343 } |
| 2344 } else if (element2 is ExecutableElement) { |
| 2345 return resolveArgumentsToParameters(false, argumentList, (element2 as Exec
utableElement)); |
| 2346 } else if (element2 is VariableElement) { |
| 2347 VariableElement variable = element2 as VariableElement; |
| 2348 Type2 type2 = variable.type; |
| 2349 if (type2 is FunctionType) { |
| 2350 FunctionType functionType = type2 as FunctionType; |
| 2351 List<ParameterElement> parameters2 = functionType.parameters; |
| 2352 return resolveArgumentsToParameters2(false, argumentList, parameters2); |
| 2353 } else if (type2 is InterfaceType) { |
| 2354 MethodElement callMethod = ((type2 as InterfaceType)).lookUpMethod(CALL_
METHOD_NAME, _resolver.definingLibrary); |
| 2355 if (callMethod != null) { |
| 2356 List<ParameterElement> parameters3 = callMethod.parameters; |
| 2357 return resolveArgumentsToParameters2(false, argumentList, parameters3)
; |
| 2358 } |
| 2359 } |
| 2360 } |
| 2361 return null; |
| 2362 } |
| 2363 |
| 2364 /** |
| 2328 * If the given element is a setter, return the getter associated with it. Oth
erwise, return the | 2365 * If the given element is a setter, return the getter associated with it. Oth
erwise, return the |
| 2329 * element unchanged. | 2366 * element unchanged. |
| 2330 * @param element the element to be normalized | 2367 * @param element the element to be normalized |
| 2331 * @return a non-setter element derived from the given element | 2368 * @return a non-setter element derived from the given element |
| 2332 */ | 2369 */ |
| 2333 Element convertSetterToGetter(Element element) { | 2370 Element convertSetterToGetter(Element element) { |
| 2334 if (element is PropertyAccessorElement) { | 2371 if (element is PropertyAccessorElement) { |
| 2335 return ((element as PropertyAccessorElement)).variable.getter; | 2372 return ((element as PropertyAccessorElement)).variable.getter; |
| 2336 } | 2373 } |
| 2337 return element; | 2374 return element; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 if (getter != null) { | 2576 if (getter != null) { |
| 2540 return getter; | 2577 return getter; |
| 2541 } | 2578 } |
| 2542 } | 2579 } |
| 2543 for (InterfaceType interfaceType in targetType.interfaces) { | 2580 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2544 PropertyAccessorElement getter = lookUpGetterInInterfaces(interfaceType, t
rue, getterName, visitedInterfaces); | 2581 PropertyAccessorElement getter = lookUpGetterInInterfaces(interfaceType, t
rue, getterName, visitedInterfaces); |
| 2545 if (getter != null) { | 2582 if (getter != null) { |
| 2546 return getter; | 2583 return getter; |
| 2547 } | 2584 } |
| 2548 } | 2585 } |
| 2586 for (InterfaceType mixinType in targetType.mixins) { |
| 2587 PropertyAccessorElement getter = lookUpGetterInInterfaces(mixinType, true,
getterName, visitedInterfaces); |
| 2588 if (getter != null) { |
| 2589 return getter; |
| 2590 } |
| 2591 } |
| 2549 InterfaceType superclass2 = targetType.superclass; | 2592 InterfaceType superclass2 = targetType.superclass; |
| 2550 if (superclass2 == null) { | 2593 if (superclass2 == null) { |
| 2551 return null; | 2594 return null; |
| 2552 } | 2595 } |
| 2553 return lookUpGetterInInterfaces(superclass2, true, getterName, visitedInterf
aces); | 2596 return lookUpGetterInInterfaces(superclass2, true, getterName, visitedInterf
aces); |
| 2554 } | 2597 } |
| 2555 | 2598 |
| 2556 /** | 2599 /** |
| 2557 * Look up the method or getter with the given name in the given type. Return
the element | 2600 * Look up the method or getter with the given name in the given type. Return
the element |
| 2558 * representing the method or getter that was found, or {@code null} if there
is no method or | 2601 * representing the method or getter that was found, or {@code null} if there
is no method or |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 if (member != null) { | 2647 if (member != null) { |
| 2605 return member; | 2648 return member; |
| 2606 } | 2649 } |
| 2607 } | 2650 } |
| 2608 for (InterfaceType interfaceType in targetType.interfaces) { | 2651 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2609 ExecutableElement member = lookUpGetterOrMethodInInterfaces(interfaceType,
true, memberName, visitedInterfaces); | 2652 ExecutableElement member = lookUpGetterOrMethodInInterfaces(interfaceType,
true, memberName, visitedInterfaces); |
| 2610 if (member != null) { | 2653 if (member != null) { |
| 2611 return member; | 2654 return member; |
| 2612 } | 2655 } |
| 2613 } | 2656 } |
| 2657 for (InterfaceType mixinType in targetType.mixins) { |
| 2658 ExecutableElement member = lookUpGetterOrMethodInInterfaces(mixinType, tru
e, memberName, visitedInterfaces); |
| 2659 if (member != null) { |
| 2660 return member; |
| 2661 } |
| 2662 } |
| 2614 InterfaceType superclass2 = targetType.superclass; | 2663 InterfaceType superclass2 = targetType.superclass; |
| 2615 if (superclass2 == null) { | 2664 if (superclass2 == null) { |
| 2616 return null; | 2665 return null; |
| 2617 } | 2666 } |
| 2618 return lookUpGetterOrMethodInInterfaces(superclass2, true, memberName, visit
edInterfaces); | 2667 return lookUpGetterOrMethodInInterfaces(superclass2, true, memberName, visit
edInterfaces); |
| 2619 } | 2668 } |
| 2620 | 2669 |
| 2621 /** | 2670 /** |
| 2622 * Find the element corresponding to the given label node in the current label
scope. | 2671 * Find the element corresponding to the given label node in the current label
scope. |
| 2623 * @param parentNode the node containing the given label | 2672 * @param parentNode the node containing the given label |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2704 if (method != null) { | 2753 if (method != null) { |
| 2705 return method; | 2754 return method; |
| 2706 } | 2755 } |
| 2707 } | 2756 } |
| 2708 for (InterfaceType interfaceType in targetType.interfaces) { | 2757 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2709 MethodElement method = lookUpMethodInInterfaces(interfaceType, true, metho
dName, visitedInterfaces); | 2758 MethodElement method = lookUpMethodInInterfaces(interfaceType, true, metho
dName, visitedInterfaces); |
| 2710 if (method != null) { | 2759 if (method != null) { |
| 2711 return method; | 2760 return method; |
| 2712 } | 2761 } |
| 2713 } | 2762 } |
| 2763 for (InterfaceType mixinType in targetType.mixins) { |
| 2764 MethodElement method = lookUpMethodInInterfaces(mixinType, true, methodNam
e, visitedInterfaces); |
| 2765 if (method != null) { |
| 2766 return method; |
| 2767 } |
| 2768 } |
| 2714 InterfaceType superclass2 = targetType.superclass; | 2769 InterfaceType superclass2 = targetType.superclass; |
| 2715 if (superclass2 == null) { | 2770 if (superclass2 == null) { |
| 2716 return null; | 2771 return null; |
| 2717 } | 2772 } |
| 2718 return lookUpMethodInInterfaces(superclass2, true, methodName, visitedInterf
aces); | 2773 return lookUpMethodInInterfaces(superclass2, true, methodName, visitedInterf
aces); |
| 2719 } | 2774 } |
| 2720 | 2775 |
| 2721 /** | 2776 /** |
| 2722 * Look up the setter with the given name in the given type. Return the elemen
t representing the | 2777 * Look up the setter with the given name in the given type. Return the elemen
t representing the |
| 2723 * setter that was found, or {@code null} if there is no setter with the given
name. | 2778 * setter that was found, or {@code null} if there is no setter with the given
name. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 if (setter != null) { | 2820 if (setter != null) { |
| 2766 return setter; | 2821 return setter; |
| 2767 } | 2822 } |
| 2768 } | 2823 } |
| 2769 for (InterfaceType interfaceType in targetType.interfaces) { | 2824 for (InterfaceType interfaceType in targetType.interfaces) { |
| 2770 PropertyAccessorElement setter = lookUpSetterInInterfaces(interfaceType, t
rue, setterName, visitedInterfaces); | 2825 PropertyAccessorElement setter = lookUpSetterInInterfaces(interfaceType, t
rue, setterName, visitedInterfaces); |
| 2771 if (setter != null) { | 2826 if (setter != null) { |
| 2772 return setter; | 2827 return setter; |
| 2773 } | 2828 } |
| 2774 } | 2829 } |
| 2830 for (InterfaceType mixinType in targetType.mixins) { |
| 2831 PropertyAccessorElement setter = lookUpSetterInInterfaces(mixinType, true,
setterName, visitedInterfaces); |
| 2832 if (setter != null) { |
| 2833 return setter; |
| 2834 } |
| 2835 } |
| 2775 InterfaceType superclass2 = targetType.superclass; | 2836 InterfaceType superclass2 = targetType.superclass; |
| 2776 if (superclass2 == null) { | 2837 if (superclass2 == null) { |
| 2777 return null; | 2838 return null; |
| 2778 } | 2839 } |
| 2779 return lookUpSetterInInterfaces(superclass2, true, setterName, visitedInterf
aces); | 2840 return lookUpSetterInInterfaces(superclass2, true, setterName, visitedInterf
aces); |
| 2780 } | 2841 } |
| 2781 | 2842 |
| 2782 /** | 2843 /** |
| 2783 * Return the binary operator that is invoked by the given compound assignment
operator. | 2844 * Return the binary operator that is invoked by the given compound assignment
operator. |
| 2784 * @param operator the assignment operator being mapped | 2845 * @param operator the assignment operator being mapped |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2827 | 2888 |
| 2828 /** | 2889 /** |
| 2829 * Record the fact that the given AST node was resolved to the given elements. | 2890 * Record the fact that the given AST node was resolved to the given elements. |
| 2830 * @param node the AST node that was resolved | 2891 * @param node the AST node that was resolved |
| 2831 * @param staticElement the element to which the AST node was resolved using s
tatic type | 2892 * @param staticElement the element to which the AST node was resolved using s
tatic type |
| 2832 * information | 2893 * information |
| 2833 * @param propagatedElement the element to which the AST node was resolved usi
ng propagated type | 2894 * @param propagatedElement the element to which the AST node was resolved usi
ng propagated type |
| 2834 * information | 2895 * information |
| 2835 * @return the element that was associated with the node | 2896 * @return the element that was associated with the node |
| 2836 */ | 2897 */ |
| 2837 Element recordResolution2(SimpleIdentifier node, Element staticElement2, Eleme
nt propagatedElement) { | 2898 void recordResolution2(SimpleIdentifier node, Element staticElement2, Element
propagatedElement) { |
| 2838 node.staticElement = staticElement2; | 2899 node.staticElement = staticElement2; |
| 2839 Element element = propagatedElement == null ? staticElement2 : propagatedEle
ment; | 2900 node.element = propagatedElement == null ? staticElement2 : propagatedElemen
t; |
| 2840 node.element = element; | |
| 2841 return element; | |
| 2842 } | 2901 } |
| 2843 | 2902 |
| 2844 /** | 2903 /** |
| 2845 * Given a list of arguments and the element that will be invoked using those
argument, compute | 2904 * Given a list of arguments and the element that will be invoked using those
argument, compute |
| 2846 * the list of parameters that correspond to the list of arguments. | 2905 * the list of parameters that correspond to the list of arguments. Return the
parameters that |
| 2906 * correspond to the arguments, or {@code null} if no correspondence could be
computed. |
| 2847 * @param reportError if {@code true} then compile-time error should be report
ed; if {@code false}then compile-time warning | 2907 * @param reportError if {@code true} then compile-time error should be report
ed; if {@code false}then compile-time warning |
| 2848 * @param argumentList the list of arguments being passed to the element | 2908 * @param argumentList the list of arguments being passed to the element |
| 2849 * @param executableElement the element that will be invoked with the argument
s | 2909 * @param executableElement the element that will be invoked with the argument
s |
| 2910 * @return the parameters that correspond to the arguments |
| 2850 */ | 2911 */ |
| 2851 void resolveArgumentsToParameters(bool reportError, ArgumentList argumentList,
ExecutableElement executableElement) { | 2912 List<ParameterElement> resolveArgumentsToParameters(bool reportError, Argument
List argumentList, ExecutableElement executableElement) { |
| 2852 if (executableElement == null) { | 2913 if (executableElement == null) { |
| 2853 return; | 2914 return null; |
| 2854 } | 2915 } |
| 2855 List<ParameterElement> parameters2 = executableElement.parameters; | 2916 List<ParameterElement> parameters2 = executableElement.parameters; |
| 2856 resolveArgumentsToParameters2(reportError, argumentList, parameters2); | 2917 return resolveArgumentsToParameters2(reportError, argumentList, parameters2)
; |
| 2857 } | 2918 } |
| 2858 | 2919 |
| 2859 /** | 2920 /** |
| 2860 * Given a list of arguments and the element that will be invoked using those
argument, compute | 2921 * Given a list of arguments and the parameters related to the element that wi
ll be invoked using |
| 2861 * the list of parameters that correspond to the list of arguments. | 2922 * those argument, compute the list of parameters that correspond to the list
of arguments. Return |
| 2923 * the parameters that correspond to the arguments. |
| 2862 * @param reportError if {@code true} then compile-time error should be report
ed; if {@code false}then compile-time warning | 2924 * @param reportError if {@code true} then compile-time error should be report
ed; if {@code false}then compile-time warning |
| 2863 * @param argumentList the list of arguments being passed to the element | 2925 * @param argumentList the list of arguments being passed to the element |
| 2864 * @param parameters the of the function that will be invoked with the argumen
ts | 2926 * @param parameters the of the function that will be invoked with the argumen
ts |
| 2927 * @return the parameters that correspond to the arguments |
| 2865 */ | 2928 */ |
| 2866 void resolveArgumentsToParameters2(bool reportError2, ArgumentList argumentLis
t, List<ParameterElement> parameters) { | 2929 List<ParameterElement> resolveArgumentsToParameters2(bool reportError2, Argume
ntList argumentList, List<ParameterElement> parameters) { |
| 2867 List<ParameterElement> requiredParameters = new List<ParameterElement>(); | 2930 List<ParameterElement> requiredParameters = new List<ParameterElement>(); |
| 2868 List<ParameterElement> positionalParameters = new List<ParameterElement>(); | 2931 List<ParameterElement> positionalParameters = new List<ParameterElement>(); |
| 2869 Map<String, ParameterElement> namedParameters = new Map<String, ParameterEle
ment>(); | 2932 Map<String, ParameterElement> namedParameters = new Map<String, ParameterEle
ment>(); |
| 2870 for (ParameterElement parameter in parameters) { | 2933 for (ParameterElement parameter in parameters) { |
| 2871 ParameterKind kind = parameter.parameterKind; | 2934 ParameterKind kind = parameter.parameterKind; |
| 2872 if (identical(kind, ParameterKind.REQUIRED)) { | 2935 if (identical(kind, ParameterKind.REQUIRED)) { |
| 2873 requiredParameters.add(parameter); | 2936 requiredParameters.add(parameter); |
| 2874 } else if (identical(kind, ParameterKind.POSITIONAL)) { | 2937 } else if (identical(kind, ParameterKind.POSITIONAL)) { |
| 2875 positionalParameters.add(parameter); | 2938 positionalParameters.add(parameter); |
| 2876 } else { | 2939 } else { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2909 } | 2972 } |
| 2910 } | 2973 } |
| 2911 } | 2974 } |
| 2912 if (positionalArgumentCount < requiredParameters.length) { | 2975 if (positionalArgumentCount < requiredParameters.length) { |
| 2913 ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.NOT_ENOUGH_REQUI
RED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS; | 2976 ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.NOT_ENOUGH_REQUI
RED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS; |
| 2914 _resolver.reportError(errorCode, argumentList, [requiredParameters.length,
positionalArgumentCount]); | 2977 _resolver.reportError(errorCode, argumentList, [requiredParameters.length,
positionalArgumentCount]); |
| 2915 } else if (positionalArgumentCount > unnamedParameterCount) { | 2978 } else if (positionalArgumentCount > unnamedParameterCount) { |
| 2916 ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.EXTRA_POSITIONAL
_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS; | 2979 ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.EXTRA_POSITIONAL
_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS; |
| 2917 _resolver.reportError(errorCode, argumentList, [unnamedParameterCount, pos
itionalArgumentCount]); | 2980 _resolver.reportError(errorCode, argumentList, [unnamedParameterCount, pos
itionalArgumentCount]); |
| 2918 } | 2981 } |
| 2919 argumentList.correspondingParameters = resolvedParameters; | 2982 return resolvedParameters; |
| 2920 } | 2983 } |
| 2921 | 2984 |
| 2922 /** | 2985 /** |
| 2923 * Resolve the names in the given combinators in the scope of the given librar
y. | 2986 * Resolve the names in the given combinators in the scope of the given librar
y. |
| 2924 * @param library the library that defines the names | 2987 * @param library the library that defines the names |
| 2925 * @param combinators the combinators containing the names to be resolved | 2988 * @param combinators the combinators containing the names to be resolved |
| 2926 */ | 2989 */ |
| 2927 void resolveCombinators(LibraryElement library, NodeList<Combinator> combinato
rs) { | 2990 void resolveCombinators(LibraryElement library, NodeList<Combinator> combinato
rs) { |
| 2928 if (library == null) { | 2991 if (library == null) { |
| 2929 return; | 2992 return; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 Type2 staticType = getStaticType(target); | 3088 Type2 staticType = getStaticType(target); |
| 3026 ExecutableElement staticElement = resolveProperty(target, staticType, proper
tyName); | 3089 ExecutableElement staticElement = resolveProperty(target, staticType, proper
tyName); |
| 3027 propertyName.staticElement = staticElement; | 3090 propertyName.staticElement = staticElement; |
| 3028 Type2 propagatedType = getPropagatedType(target); | 3091 Type2 propagatedType = getPropagatedType(target); |
| 3029 ExecutableElement propagatedElement = resolveProperty(target, propagatedType
, propertyName); | 3092 ExecutableElement propagatedElement = resolveProperty(target, propagatedType
, propertyName); |
| 3030 Element selectedElement = select2(staticElement, propagatedElement); | 3093 Element selectedElement = select2(staticElement, propagatedElement); |
| 3031 propertyName.element = selectedElement; | 3094 propertyName.element = selectedElement; |
| 3032 if (shouldReportMissingMember(staticType, staticElement) && (_strictMode ||
propagatedType == null || shouldReportMissingMember(propagatedType, propagatedEl
ement))) { | 3095 if (shouldReportMissingMember(staticType, staticElement) && (_strictMode ||
propagatedType == null || shouldReportMissingMember(propagatedType, propagatedEl
ement))) { |
| 3033 bool staticNoSuchMethod = staticType != null && classDeclaresNoSuchMethod2
(staticType.element); | 3096 bool staticNoSuchMethod = staticType != null && classDeclaresNoSuchMethod2
(staticType.element); |
| 3034 bool propagatedNoSuchMethod = propagatedType != null && classDeclaresNoSuc
hMethod2(propagatedType.element); | 3097 bool propagatedNoSuchMethod = propagatedType != null && classDeclaresNoSuc
hMethod2(propagatedType.element); |
| 3035 if (!staticNoSuchMethod && !propagatedNoSuchMethod) { | 3098 if (!staticNoSuchMethod && (_strictMode || !propagatedNoSuchMethod)) { |
| 3036 bool isStaticProperty = isStatic(selectedElement); | 3099 bool isStaticProperty = isStatic(selectedElement); |
| 3037 if (propertyName.inSetterContext()) { | 3100 if (propertyName.inSetterContext()) { |
| 3038 if (isStaticProperty) { | 3101 if (isStaticProperty) { |
| 3039 _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, propertyNa
me, [propertyName.name, staticType.displayName]); | 3102 _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, propertyNa
me, [propertyName.name, staticType.displayName]); |
| 3040 } else { | 3103 } else { |
| 3041 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SETTER, proper
tyName, [propertyName.name, staticType.displayName]); | 3104 _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SETTER, proper
tyName, [propertyName.name, staticType.displayName]); |
| 3042 } | 3105 } |
| 3043 } else if (propertyName.inGetterContext()) { | 3106 } else if (propertyName.inGetterContext()) { |
| 3044 if (isStaticProperty) { | 3107 if (isStaticProperty) { |
| 3045 _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, propertyNa
me, [propertyName.name, staticType.displayName]); | 3108 _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, propertyNa
me, [propertyName.name, staticType.displayName]); |
| (...skipping 5936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8982 } | 9045 } |
| 8983 | 9046 |
| 8984 /** | 9047 /** |
| 8985 * Hide all of the given names by removing them from the given collection of d
efined names. | 9048 * Hide all of the given names by removing them from the given collection of d
efined names. |
| 8986 * @param definedNames the names that were defined before this operation | 9049 * @param definedNames the names that were defined before this operation |
| 8987 * @param hiddenNames the names to be hidden | 9050 * @param hiddenNames the names to be hidden |
| 8988 */ | 9051 */ |
| 8989 void hide(Map<String, Element> definedNames, List<String> hiddenNames) { | 9052 void hide(Map<String, Element> definedNames, List<String> hiddenNames) { |
| 8990 for (String name in hiddenNames) { | 9053 for (String name in hiddenNames) { |
| 8991 definedNames.remove(name); | 9054 definedNames.remove(name); |
| 9055 definedNames.remove("${name}="); |
| 8992 } | 9056 } |
| 8993 } | 9057 } |
| 8994 | 9058 |
| 8995 /** | 9059 /** |
| 8996 * Show only the given names by removing all other names from the given collec
tion of defined | 9060 * Show only the given names by removing all other names from the given collec
tion of defined |
| 8997 * names. | 9061 * names. |
| 8998 * @param definedNames the names that were defined before this operation | 9062 * @param definedNames the names that were defined before this operation |
| 8999 * @param shownNames the names to be shown | 9063 * @param shownNames the names to be shown |
| 9000 */ | 9064 */ |
| 9001 Map<String, Element> show(Map<String, Element> definedNames, List<String> show
nNames) { | 9065 Map<String, Element> show(Map<String, Element> definedNames, List<String> show
nNames) { |
| 9002 Map<String, Element> newNames = new Map<String, Element>(); | 9066 Map<String, Element> newNames = new Map<String, Element>(); |
| 9003 for (String name in shownNames) { | 9067 for (String name in shownNames) { |
| 9004 Element element = definedNames[name]; | 9068 Element element = definedNames[name]; |
| 9005 if (element != null) { | 9069 if (element != null) { |
| 9006 newNames[name] = element; | 9070 newNames[name] = element; |
| 9007 } | 9071 } |
| 9072 String setterName = "${name}="; |
| 9073 element = definedNames[setterName]; |
| 9074 if (element != null) { |
| 9075 newNames[setterName] = element; |
| 9076 } |
| 9008 } | 9077 } |
| 9009 return newNames; | 9078 return newNames; |
| 9010 } | 9079 } |
| 9011 } | 9080 } |
| 9012 /** | 9081 /** |
| 9013 * The abstract class {@code Scope} defines the behavior common to name scopes u
sed by the resolver | 9082 * The abstract class {@code Scope} defines the behavior common to name scopes u
sed by the resolver |
| 9014 * to determine which names are visible at any given point in the code. | 9083 * to determine which names are visible at any given point in the code. |
| 9015 * @coverage dart.engine.resolver | 9084 * @coverage dart.engine.resolver |
| 9016 */ | 9085 */ |
| 9017 abstract class Scope { | 9086 abstract class Scope { |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10340 /** | 10409 /** |
| 10341 * This verifies that the passed argument can be assigned to their correspondi
ng parameters. | 10410 * This verifies that the passed argument can be assigned to their correspondi
ng parameters. |
| 10342 * @param node the argument to evaluate | 10411 * @param node the argument to evaluate |
| 10343 * @return {@code true} if and only if an error code is generated on the passe
d node | 10412 * @return {@code true} if and only if an error code is generated on the passe
d node |
| 10344 * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE | 10413 * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE |
| 10345 */ | 10414 */ |
| 10346 bool checkForArgumentTypeNotAssignable2(Expression argument) { | 10415 bool checkForArgumentTypeNotAssignable2(Expression argument) { |
| 10347 if (argument == null) { | 10416 if (argument == null) { |
| 10348 return false; | 10417 return false; |
| 10349 } | 10418 } |
| 10350 ParameterElement parameterElement2 = argument.parameterElement; | 10419 ParameterElement staticParameterElement2 = argument.staticParameterElement; |
| 10351 if (parameterElement2 == null) { | 10420 Type2 staticParameterType = staticParameterElement2 == null ? null : staticP
arameterElement2.type; |
| 10352 return false; | 10421 Type2 staticArgumentType = getStaticType(argument); |
| 10353 } | 10422 if (staticArgumentType == null || staticParameterType == null) { |
| 10354 Type2 parameterType = parameterElement2.type; | |
| 10355 if (parameterType == null) { | |
| 10356 return false; | |
| 10357 } | |
| 10358 Type2 staticType = getStaticType(argument); | |
| 10359 if (staticType == null) { | |
| 10360 return false; | |
| 10361 } | |
| 10362 if (staticType.isAssignableTo(parameterType)) { | |
| 10363 return false; | 10423 return false; |
| 10364 } | 10424 } |
| 10365 if (_strictMode) { | 10425 if (_strictMode) { |
| 10366 _errorReporter.reportError2(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
, argument, [staticType.displayName, parameterType.displayName]); | 10426 if (staticArgumentType.isAssignableTo(staticParameterType)) { |
| 10427 return false; |
| 10428 } |
| 10429 _errorReporter.reportError2(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
, argument, [staticArgumentType.displayName, staticParameterType.displayName]); |
| 10367 return true; | 10430 return true; |
| 10368 } | 10431 } |
| 10369 Type2 propagatedType = getPropagatedType(argument); | 10432 ParameterElement propagatedParameterElement = argument.parameterElement; |
| 10370 if (propagatedType != null && propagatedType.isAssignableTo(parameterType))
{ | 10433 Type2 propagatedParameterType = propagatedParameterElement == null ? null :
propagatedParameterElement.type; |
| 10434 Type2 propagatedArgumentType = getPropagatedType(argument); |
| 10435 if (propagatedArgumentType == null || propagatedParameterType == null) { |
| 10436 if (staticArgumentType.isAssignableTo(staticParameterType)) { |
| 10437 return false; |
| 10438 } |
| 10439 _errorReporter.reportError2(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
, argument, [staticArgumentType.displayName, staticParameterType.displayName]); |
| 10440 return true; |
| 10441 } |
| 10442 if (staticArgumentType.isAssignableTo(staticParameterType) || staticArgument
Type.isAssignableTo(propagatedParameterType) || propagatedArgumentType.isAssigna
bleTo(staticParameterType) || propagatedArgumentType.isAssignableTo(propagatedPa
rameterType)) { |
| 10371 return false; | 10443 return false; |
| 10372 } | 10444 } |
| 10373 _errorReporter.reportError2(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
argument, [(propagatedType == null ? staticType : propagatedType).displayName, p
arameterType.displayName]); | 10445 _errorReporter.reportError2(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
argument, [(propagatedArgumentType == null ? staticArgumentType : propagatedArgu
mentType).displayName, (propagatedParameterType == null ? staticParameterType :
propagatedParameterType).displayName]); |
| 10374 return true; | 10446 return true; |
| 10375 } | 10447 } |
| 10376 | 10448 |
| 10377 /** | 10449 /** |
| 10378 * This verifies that left hand side of the passed assignment expression is no
t final. | 10450 * This verifies that left hand side of the passed assignment expression is no
t final. |
| 10379 * @param node the assignment expression to evaluate | 10451 * @param node the assignment expression to evaluate |
| 10380 * @return {@code true} if and only if an error code is generated on the passe
d node | 10452 * @return {@code true} if and only if an error code is generated on the passe
d node |
| 10381 * @see StaticWarningCode#ASSIGNMENT_TO_FINAL | 10453 * @see StaticWarningCode#ASSIGNMENT_TO_FINAL |
| 10382 */ | 10454 */ |
| 10383 bool checkForAssignmentToFinal(AssignmentExpression node) { | 10455 bool checkForAssignmentToFinal(AssignmentExpression node) { |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12422 class PubVerifier extends RecursiveASTVisitor<Object> { | 12494 class PubVerifier extends RecursiveASTVisitor<Object> { |
| 12423 | 12495 |
| 12424 /** | 12496 /** |
| 12425 * The error reporter by which errors will be reported. | 12497 * The error reporter by which errors will be reported. |
| 12426 */ | 12498 */ |
| 12427 ErrorReporter _errorReporter; | 12499 ErrorReporter _errorReporter; |
| 12428 PubVerifier(ErrorReporter errorReporter) { | 12500 PubVerifier(ErrorReporter errorReporter) { |
| 12429 this._errorReporter = errorReporter; | 12501 this._errorReporter = errorReporter; |
| 12430 } | 12502 } |
| 12431 Object visitImportDirective(ImportDirective directive) { | 12503 Object visitImportDirective(ImportDirective directive) { |
| 12432 // StringLiteral uriLiteral = directive.uri; | |
| 12433 // if (uriLiteral == null) { | |
| 12434 // return null; | |
| 12435 // } | |
| 12436 // String uriContent = uriLiteral.stringValue; | |
| 12437 // if (uriContent == null) { | |
| 12438 // return null; | |
| 12439 // } | |
| 12440 // uriContent = uriContent.trim(); | |
| 12441 // int index = uriContent.indexOf(':'); | |
| 12442 // String scheme; | |
| 12443 // String path; | |
| 12444 // if (index > -1) { | |
| 12445 // scheme = uriContent.substring(0, index); | |
| 12446 // path = uriContent.substring(index + 1); | |
| 12447 // } else { | |
| 12448 // scheme = FileUriResolver.FILE_SCHEME; | |
| 12449 // path = uriContent; | |
| 12450 // } | |
| 12451 // if (scheme == FileUriResolver.FILE_SCHEME) { | |
| 12452 // if (checkForFileImportOutsideLibReferencesFileInside(directive, path)) { | |
| 12453 // _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_
REFERENCES_FILE_INSIDE, uriLiteral, []); | |
| 12454 // } else if (checkForFileImportInsideLibReferencesFileOutside(directive, p
ath)) { | |
| 12455 // _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_R
EFERENCES_FILE_OUTSIDE, uriLiteral, []); | |
| 12456 // } | |
| 12457 // } else if (scheme == PackageUriResolver.PACKAGE_SCHEME) { | |
| 12458 // if (checkForPackageImportContainsDotDot(path)) { | |
| 12459 // _errorReporter.reportError2(PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_
DOT_DOT, uriLiteral, []); | |
| 12460 // } | |
| 12461 // } | |
| 12462 return null; | 12504 return null; |
| 12463 } | 12505 } |
| 12464 | 12506 |
| 12465 /** | 12507 /** |
| 12466 * Determine if the file file path lies inside the "lib" directory hierarchy b
ut references a file | 12508 * Determine if the file file path lies inside the "lib" directory hierarchy b
ut references a file |
| 12467 * outside that directory hierarchy. | 12509 * outside that directory hierarchy. |
| 12468 * @param directive the import directive (not {@code null}) | 12510 * @param directive the import directive (not {@code null}) |
| 12469 * @param path the file path being verified (not {@code null}) | 12511 * @param path the file path being verified (not {@code null}) |
| 12470 * @return {@code true} if the file is inside but references a file outside | 12512 * @return {@code true} if the file is inside but references a file outside |
| 12471 */ | 12513 */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12514 */ | 12556 */ |
| 12515 bool checkForPackageImportContainsDotDot(String path) => path.contains("/../")
; | 12557 bool checkForPackageImportContainsDotDot(String path) => path.contains("/../")
; |
| 12516 | 12558 |
| 12517 /** | 12559 /** |
| 12518 * Answer the full name of the source associated with the compilation unit con
taining the given | 12560 * Answer the full name of the source associated with the compilation unit con
taining the given |
| 12519 * AST node. The returned value will have all {@link File#separatorChar} repla
ce by '/'. | 12561 * AST node. The returned value will have all {@link File#separatorChar} repla
ce by '/'. |
| 12520 * @param node the node (not {@code null}) | 12562 * @param node the node (not {@code null}) |
| 12521 * @return the full name or {@code null} if it could not be determined | 12563 * @return the full name or {@code null} if it could not be determined |
| 12522 */ | 12564 */ |
| 12523 String getSourceFullName(ASTNode node) { | 12565 String getSourceFullName(ASTNode node) { |
| 12524 // CompilationUnit unit = node.getAncestor(CompilationUnit); | 12566 CompilationUnit unit = node.getAncestor(CompilationUnit); |
| 12525 // if (unit != null) { | 12567 if (unit != null) { |
| 12526 // CompilationUnitElement element2 = unit.element; | 12568 CompilationUnitElement element2 = unit.element; |
| 12527 // if (element2 != null) { | 12569 if (element2 != null) { |
| 12528 // Source librarySource = element2.source; | 12570 Source librarySource = element2.source; |
| 12529 // if (librarySource != null) { | 12571 if (librarySource != null) { |
| 12530 // String fullName2 = librarySource.fullName; | 12572 String fullName2 = librarySource.fullName; |
| 12531 // if (fullName2 != null) { | 12573 if (fullName2 != null) { |
| 12532 // return fullName2.replaceAll(JavaFile.separatorChar, '/'); | 12574 return fullName2.replaceAll(r'\', '/'); |
| 12533 // } | 12575 } |
| 12534 // } | 12576 } |
| 12535 // } | 12577 } |
| 12536 // } | 12578 } |
| 12537 return null; | 12579 return null; |
| 12538 } | 12580 } |
| 12539 } | 12581 } |
| 12540 /** | 12582 /** |
| 12541 * The enumeration {@code ResolverErrorCode} defines the error codes used for er
rors detected by the | 12583 * The enumeration {@code ResolverErrorCode} defines the error codes used for er
rors detected by the |
| 12542 * resolver. The convention for this class is for the name of the error code to
indicate the problem | 12584 * resolver. The convention for this class is for the name of the error code to
indicate the problem |
| 12543 * that caused the error to be generated and for the error message to explain wh
at is wrong and, | 12585 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 12544 * when appropriate, how the problem can be corrected. | 12586 * when appropriate, how the problem can be corrected. |
| 12545 * @coverage dart.engine.resolver | 12587 * @coverage dart.engine.resolver |
| 12546 */ | 12588 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 12574 ResolverErrorCode(this.name, this.ordinal, ErrorType type, String message) { | 12616 ResolverErrorCode(this.name, this.ordinal, ErrorType type, String message) { |
| 12575 this._type = type; | 12617 this._type = type; |
| 12576 this._message = message; | 12618 this._message = message; |
| 12577 } | 12619 } |
| 12578 ErrorSeverity get errorSeverity => _type.severity; | 12620 ErrorSeverity get errorSeverity => _type.severity; |
| 12579 String get message => _message; | 12621 String get message => _message; |
| 12580 ErrorType get type => _type; | 12622 ErrorType get type => _type; |
| 12581 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; | 12623 int compareTo(ResolverErrorCode other) => ordinal - other.ordinal; |
| 12582 String toString() => name; | 12624 String toString() => name; |
| 12583 } | 12625 } |
| OLD | NEW |