| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * This library is capable of producing linked summaries from unlinked | 6 * This library is capable of producing linked summaries from unlinked |
| 7 * ones (or prelinked ones). It functions by building a miniature | 7 * ones (or prelinked ones). It functions by building a miniature |
| 8 * element model to represent the contents of the summaries, and then | 8 * element model to represent the contents of the summaries, and then |
| 9 * scanning the element model to gather linked information and adding | 9 * scanning the element model to gather linked information and adding |
| 10 * it to the summary data structures. | 10 * it to the summary data structures. |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 // TODO(paulberry): implement. | 965 // TODO(paulberry): implement. |
| 966 throw new UnimplementedError(); | 966 throw new UnimplementedError(); |
| 967 } else { | 967 } else { |
| 968 DartType getTypeArgument(int i) { | 968 DartType getTypeArgument(int i) { |
| 969 if (i < type.typeArguments.length) { | 969 if (i < type.typeArguments.length) { |
| 970 return resolveTypeRef(type.typeArguments[i], typeParameterContext); | 970 return resolveTypeRef(type.typeArguments[i], typeParameterContext); |
| 971 } else { | 971 } else { |
| 972 return DynamicTypeImpl.instance; | 972 return DynamicTypeImpl.instance; |
| 973 } | 973 } |
| 974 } | 974 } |
| 975 ReferenceableElementForLink element = _resolveRef(type.reference); | 975 ReferenceableElementForLink element = resolveRef(type.reference); |
| 976 return element.buildType( | 976 return element.buildType( |
| 977 getTypeArgument, type.implicitFunctionTypeIndices); | 977 getTypeArgument, type.implicitFunctionTypeIndices); |
| 978 } | 978 } |
| 979 } | 979 } |
| 980 | 980 |
| 981 @override | |
| 982 String toString() => enclosingElement.toString(); | |
| 983 | |
| 984 /** | 981 /** |
| 985 * Return the element referred to by the given [index] in | 982 * Return the element referred to by the given [index] in |
| 986 * [UnlinkedUnit.references]. If the reference is unresolved, | 983 * [UnlinkedUnit.references]. If the reference is unresolved, |
| 987 * return [UndefinedElementForLink.instance]. | 984 * return [UndefinedElementForLink.instance]. |
| 988 */ | 985 */ |
| 989 ReferenceableElementForLink _resolveRef(int index) { | 986 ReferenceableElementForLink resolveRef(int index) { |
| 990 if (_references[index] == null) { | 987 if (_references[index] == null) { |
| 991 UnlinkedReference unlinkedReference = | 988 UnlinkedReference unlinkedReference = |
| 992 index < _unlinkedUnit.references.length | 989 index < _unlinkedUnit.references.length |
| 993 ? _unlinkedUnit.references[index] | 990 ? _unlinkedUnit.references[index] |
| 994 : null; | 991 : null; |
| 995 LinkedReference linkedReference = _linkedUnit.references[index]; | 992 LinkedReference linkedReference = _linkedUnit.references[index]; |
| 996 String name = unlinkedReference == null | 993 String name = unlinkedReference == null |
| 997 ? linkedReference.name | 994 ? linkedReference.name |
| 998 : unlinkedReference.name; | 995 : unlinkedReference.name; |
| 999 int containingReference = unlinkedReference == null | 996 int containingReference = unlinkedReference == null |
| 1000 ? linkedReference.containingReference | 997 ? linkedReference.containingReference |
| 1001 : unlinkedReference.prefixReference; | 998 : unlinkedReference.prefixReference; |
| 1002 if (containingReference != 0 && | 999 if (containingReference != 0 && |
| 1003 _linkedUnit.references[containingReference].kind != | 1000 _linkedUnit.references[containingReference].kind != |
| 1004 ReferenceKind.prefix) { | 1001 ReferenceKind.prefix) { |
| 1005 if (linkedReference.kind == ReferenceKind.function) { | 1002 if (linkedReference.kind == ReferenceKind.function) { |
| 1006 // Local function | 1003 // Local function |
| 1007 _references[index] = _resolveRef(containingReference) | 1004 _references[index] = resolveRef(containingReference) |
| 1008 .getLocalFunction(linkedReference.localIndex) ?? | 1005 .getLocalFunction(linkedReference.localIndex) ?? |
| 1009 UndefinedElementForLink.instance; | 1006 UndefinedElementForLink.instance; |
| 1010 } else { | 1007 } else { |
| 1011 _references[index] = | 1008 _references[index] = |
| 1012 _resolveRef(containingReference).getContainedName(name); | 1009 resolveRef(containingReference).getContainedName(name); |
| 1013 } | 1010 } |
| 1014 } else if (linkedReference.dependency == 0) { | 1011 } else if (linkedReference.dependency == 0) { |
| 1015 if (name == 'void') { | 1012 if (name == 'void') { |
| 1016 _references[index] = enclosingElement._linker.voidElement; | 1013 _references[index] = enclosingElement._linker.voidElement; |
| 1017 } else if (name == '*bottom*') { | 1014 } else if (name == '*bottom*') { |
| 1018 _references[index] = enclosingElement._linker.bottomElement; | 1015 _references[index] = enclosingElement._linker.bottomElement; |
| 1019 } else if (name == 'dynamic') { | 1016 } else if (name == 'dynamic') { |
| 1020 _references[index] = enclosingElement._linker.dynamicElement; | 1017 _references[index] = enclosingElement._linker.dynamicElement; |
| 1021 } else { | 1018 } else { |
| 1022 _references[index] = enclosingElement.getContainedName(name); | 1019 _references[index] = enclosingElement.getContainedName(name); |
| 1023 } | 1020 } |
| 1024 } else { | 1021 } else { |
| 1025 LibraryElementForLink dependency = | 1022 LibraryElementForLink dependency = |
| 1026 enclosingElement._getDependency(linkedReference.dependency); | 1023 enclosingElement._getDependency(linkedReference.dependency); |
| 1027 _references[index] = dependency.getContainedName(name); | 1024 _references[index] = dependency.getContainedName(name); |
| 1028 } | 1025 } |
| 1029 } | 1026 } |
| 1030 return _references[index]; | 1027 return _references[index]; |
| 1031 } | 1028 } |
| 1029 |
| 1030 @override |
| 1031 String toString() => enclosingElement.toString(); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 /** | 1034 /** |
| 1035 * Element representing a compilation unit which is part of the build | 1035 * Element representing a compilation unit which is part of the build |
| 1036 * unit being linked. | 1036 * unit being linked. |
| 1037 */ | 1037 */ |
| 1038 class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink { | 1038 class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink { |
| 1039 @override | 1039 @override |
| 1040 final LinkedUnitBuilder _linkedUnit; | 1040 final LinkedUnitBuilder _linkedUnit; |
| 1041 | 1041 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 | 1401 |
| 1402 /** | 1402 /** |
| 1403 * If [constructorElement] redirects to another constructor via a factory | 1403 * If [constructorElement] redirects to another constructor via a factory |
| 1404 * redirect, return the constructor it redirects to. | 1404 * redirect, return the constructor it redirects to. |
| 1405 */ | 1405 */ |
| 1406 ConstructorElementForLink _getFactoryRedirectedConstructor() { | 1406 ConstructorElementForLink _getFactoryRedirectedConstructor() { |
| 1407 EntityRef redirectedConstructor = | 1407 EntityRef redirectedConstructor = |
| 1408 constructorElement._unlinkedExecutable.redirectedConstructor; | 1408 constructorElement._unlinkedExecutable.redirectedConstructor; |
| 1409 if (redirectedConstructor != null) { | 1409 if (redirectedConstructor != null) { |
| 1410 return constructorElement.compilationUnit | 1410 return constructorElement.compilationUnit |
| 1411 ._resolveRef(redirectedConstructor.reference) | 1411 .resolveRef(redirectedConstructor.reference) |
| 1412 .asConstructor; | 1412 .asConstructor; |
| 1413 } else { | 1413 } else { |
| 1414 return null; | 1414 return null; |
| 1415 } | 1415 } |
| 1416 } | 1416 } |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 /** | 1419 /** |
| 1420 * Specialization of [DependencyWalker] for detecting constant | 1420 * Specialization of [DependencyWalker] for detecting constant |
| 1421 * evaluation cycles. | 1421 * evaluation cycles. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 if (unlinkedConst == null) { | 1460 if (unlinkedConst == null) { |
| 1461 return; | 1461 return; |
| 1462 } | 1462 } |
| 1463 int refPtr = 0; | 1463 int refPtr = 0; |
| 1464 for (UnlinkedConstOperation operation in unlinkedConst.operations) { | 1464 for (UnlinkedConstOperation operation in unlinkedConst.operations) { |
| 1465 switch (operation) { | 1465 switch (operation) { |
| 1466 case UnlinkedConstOperation.pushReference: | 1466 case UnlinkedConstOperation.pushReference: |
| 1467 case UnlinkedConstOperation.invokeMethodRef: | 1467 case UnlinkedConstOperation.invokeMethodRef: |
| 1468 EntityRef ref = unlinkedConst.references[refPtr++]; | 1468 EntityRef ref = unlinkedConst.references[refPtr++]; |
| 1469 ConstVariableNode variable = | 1469 ConstVariableNode variable = |
| 1470 compilationUnit._resolveRef(ref.reference).asConstVariable; | 1470 compilationUnit.resolveRef(ref.reference).asConstVariable; |
| 1471 if (variable != null) { | 1471 if (variable != null) { |
| 1472 dependencies.add(variable); | 1472 dependencies.add(variable); |
| 1473 } | 1473 } |
| 1474 break; | 1474 break; |
| 1475 case UnlinkedConstOperation.makeTypedList: | 1475 case UnlinkedConstOperation.makeTypedList: |
| 1476 refPtr++; | 1476 refPtr++; |
| 1477 break; | 1477 break; |
| 1478 case UnlinkedConstOperation.makeTypedMap: | 1478 case UnlinkedConstOperation.makeTypedMap: |
| 1479 refPtr += 2; | 1479 refPtr += 2; |
| 1480 break; | 1480 break; |
| 1481 case UnlinkedConstOperation.invokeConstructor: | 1481 case UnlinkedConstOperation.invokeConstructor: |
| 1482 EntityRef ref = unlinkedConst.references[refPtr++]; | 1482 EntityRef ref = unlinkedConst.references[refPtr++]; |
| 1483 ConstructorElementForLink element = | 1483 ConstructorElementForLink element = |
| 1484 compilationUnit._resolveRef(ref.reference).asConstructor; | 1484 compilationUnit.resolveRef(ref.reference).asConstructor; |
| 1485 if (element?._constNode != null) { | 1485 if (element?._constNode != null) { |
| 1486 dependencies.add(element._constNode); | 1486 dependencies.add(element._constNode); |
| 1487 } | 1487 } |
| 1488 break; | 1488 break; |
| 1489 default: | 1489 default: |
| 1490 break; | 1490 break; |
| 1491 } | 1491 } |
| 1492 } | 1492 } |
| 1493 assert(refPtr == unlinkedConst.references.length); | 1493 assert(refPtr == unlinkedConst.references.length); |
| 1494 } | 1494 } |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 | 2262 |
| 2263 void _doInvokeConstructor() { | 2263 void _doInvokeConstructor() { |
| 2264 int numNamed = _getNextInt(); | 2264 int numNamed = _getNextInt(); |
| 2265 int numPositional = _getNextInt(); | 2265 int numPositional = _getNextInt(); |
| 2266 // TODO(paulberry): don't just pop the args; use their types | 2266 // TODO(paulberry): don't just pop the args; use their types |
| 2267 // to infer the type of type arguments. | 2267 // to infer the type of type arguments. |
| 2268 stack.length -= numNamed + numPositional; | 2268 stack.length -= numNamed + numPositional; |
| 2269 strPtr += numNamed; | 2269 strPtr += numNamed; |
| 2270 EntityRef ref = _getNextRef(); | 2270 EntityRef ref = _getNextRef(); |
| 2271 ConstructorElementForLink element = | 2271 ConstructorElementForLink element = |
| 2272 unit._resolveRef(ref.reference).asConstructor; | 2272 unit.resolveRef(ref.reference).asConstructor; |
| 2273 if (element != null) { | 2273 if (element != null) { |
| 2274 ClassElementForLink_Class enclosingClass = element.enclosingClass; | 2274 ClassElementForLink_Class enclosingClass = element.enclosingClass; |
| 2275 stack.add(enclosingClass.buildType((int i) { | 2275 stack.add(enclosingClass.buildType((int i) { |
| 2276 // Type argument explicitly specified. | 2276 // Type argument explicitly specified. |
| 2277 if (i < ref.typeArguments.length) { | 2277 if (i < ref.typeArguments.length) { |
| 2278 return unit.resolveTypeRef( | 2278 return unit.resolveTypeRef( |
| 2279 ref.typeArguments[i], variable._typeParameterContext); | 2279 ref.typeArguments[i], variable._typeParameterContext); |
| 2280 } | 2280 } |
| 2281 // In strong mode, type argument defaults to bound (if any). | 2281 // In strong mode, type argument defaults to bound (if any). |
| 2282 if (linker.strongMode) { | 2282 if (linker.strongMode) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 }()); | 2317 }()); |
| 2318 } | 2318 } |
| 2319 | 2319 |
| 2320 void _doInvokeMethodRef() { | 2320 void _doInvokeMethodRef() { |
| 2321 int numNamed = _getNextInt(); | 2321 int numNamed = _getNextInt(); |
| 2322 int numPositional = _getNextInt(); | 2322 int numPositional = _getNextInt(); |
| 2323 List<String> namedArgNames = _getNextStrings(numNamed); | 2323 List<String> namedArgNames = _getNextStrings(numNamed); |
| 2324 List<DartType> namedArgTypeList = _popList(numNamed); | 2324 List<DartType> namedArgTypeList = _popList(numNamed); |
| 2325 List<DartType> positionalArgTypes = _popList(numPositional); | 2325 List<DartType> positionalArgTypes = _popList(numPositional); |
| 2326 EntityRef ref = _getNextRef(); | 2326 EntityRef ref = _getNextRef(); |
| 2327 ReferenceableElementForLink element = unit._resolveRef(ref.reference); | 2327 ReferenceableElementForLink element = unit.resolveRef(ref.reference); |
| 2328 stack.add(() { | 2328 stack.add(() { |
| 2329 DartType rawType = element.asStaticType; | 2329 DartType rawType = element.asStaticType; |
| 2330 if (rawType is FunctionType) { | 2330 if (rawType is FunctionType) { |
| 2331 FunctionType inferredType = _inferExecutableType(rawType, numNamed, | 2331 FunctionType inferredType = _inferExecutableType(rawType, numNamed, |
| 2332 numPositional, namedArgNames, namedArgTypeList, positionalArgTypes); | 2332 numPositional, namedArgNames, namedArgTypeList, positionalArgTypes); |
| 2333 if (inferredType != null) { | 2333 if (inferredType != null) { |
| 2334 return inferredType.returnType; | 2334 return inferredType.returnType; |
| 2335 } | 2335 } |
| 2336 } | 2336 } |
| 2337 return DynamicTypeImpl.instance; | 2337 return DynamicTypeImpl.instance; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 EntityRef ref = _getNextRef(); | 2383 EntityRef ref = _getNextRef(); |
| 2384 if (ref.paramReference != 0) { | 2384 if (ref.paramReference != 0) { |
| 2385 stack.add(typeProvider.typeType); | 2385 stack.add(typeProvider.typeType); |
| 2386 } else { | 2386 } else { |
| 2387 // Synthetic function types can't be directly referred | 2387 // Synthetic function types can't be directly referred |
| 2388 // to by expressions. | 2388 // to by expressions. |
| 2389 assert(ref.syntheticReturnType == null); | 2389 assert(ref.syntheticReturnType == null); |
| 2390 // Nor can implicit function types derived from | 2390 // Nor can implicit function types derived from |
| 2391 // function-typed parameters. | 2391 // function-typed parameters. |
| 2392 assert(ref.implicitFunctionTypeIndices.isEmpty); | 2392 assert(ref.implicitFunctionTypeIndices.isEmpty); |
| 2393 ReferenceableElementForLink element = unit._resolveRef(ref.reference); | 2393 ReferenceableElementForLink element = unit.resolveRef(ref.reference); |
| 2394 stack.add(element.asStaticType); | 2394 stack.add(element.asStaticType); |
| 2395 } | 2395 } |
| 2396 } | 2396 } |
| 2397 | 2397 |
| 2398 int _getNextInt() { | 2398 int _getNextInt() { |
| 2399 return unlinkedConst.ints[intPtr++]; | 2399 return unlinkedConst.ints[intPtr++]; |
| 2400 } | 2400 } |
| 2401 | 2401 |
| 2402 EntityRef _getNextRef() => unlinkedConst.references[refPtr++]; | 2402 EntityRef _getNextRef() => unlinkedConst.references[refPtr++]; |
| 2403 | 2403 |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 } | 2905 } |
| 2906 return new FunctionTypeImpl.elementWithNameAndArgs( | 2906 return new FunctionTypeImpl.elementWithNameAndArgs( |
| 2907 this, name, typeArguments, true); | 2907 this, name, typeArguments, true); |
| 2908 } else { | 2908 } else { |
| 2909 return _type ??= new FunctionTypeImpl.forTypedef(this); | 2909 return _type ??= new FunctionTypeImpl.forTypedef(this); |
| 2910 } | 2910 } |
| 2911 } | 2911 } |
| 2912 | 2912 |
| 2913 @override | 2913 @override |
| 2914 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 2914 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 2915 |
| 2916 @override |
| 2917 String toString() => '$enclosingElement.$name'; |
| 2915 } | 2918 } |
| 2916 | 2919 |
| 2917 /** | 2920 /** |
| 2918 * Specialization of [DependencyWalker] for linking library cycles. | 2921 * Specialization of [DependencyWalker] for linking library cycles. |
| 2919 */ | 2922 */ |
| 2920 class LibraryCycleDependencyWalker extends DependencyWalker<LibraryCycleNode> { | 2923 class LibraryCycleDependencyWalker extends DependencyWalker<LibraryCycleNode> { |
| 2921 @override | 2924 @override |
| 2922 void evaluate(LibraryCycleNode v) { | 2925 void evaluate(LibraryCycleNode v) { |
| 2923 v.link(); | 2926 v.link(); |
| 2924 } | 2927 } |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3583 return DynamicTypeImpl.instance; | 3586 return DynamicTypeImpl.instance; |
| 3584 } | 3587 } |
| 3585 | 3588 |
| 3586 @override | 3589 @override |
| 3587 TypeInferenceNode get asTypeInferenceNode => _target.asTypeInferenceNode; | 3590 TypeInferenceNode get asTypeInferenceNode => _target.asTypeInferenceNode; |
| 3588 | 3591 |
| 3589 @override | 3592 @override |
| 3590 ReferenceableElementForLink getContainedName(String name) { | 3593 ReferenceableElementForLink getContainedName(String name) { |
| 3591 return new NonstaticMemberElementForLink(_library, this, name); | 3594 return new NonstaticMemberElementForLink(_library, this, name); |
| 3592 } | 3595 } |
| 3596 |
| 3597 @override |
| 3598 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 3599 |
| 3600 @override |
| 3601 String toString() => '$_target.(dynamic)$_name'; |
| 3593 } | 3602 } |
| 3594 | 3603 |
| 3595 /** | 3604 /** |
| 3596 * Element representing a function or method parameter resynthesized | 3605 * Element representing a function or method parameter resynthesized |
| 3597 * from a summary during linking. | 3606 * from a summary during linking. |
| 3598 */ | 3607 */ |
| 3599 class ParameterElementForLink implements ParameterElementImpl { | 3608 class ParameterElementForLink implements ParameterElementImpl { |
| 3600 /** | 3609 /** |
| 3601 * The unlinked representation of the parameter in the summary. | 3610 * The unlinked representation of the parameter in the summary. |
| 3602 */ | 3611 */ |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4046 | 4055 |
| 4047 @override | 4056 @override |
| 4048 String toString() => '$enclosingElement.$name'; | 4057 String toString() => '$enclosingElement.$name'; |
| 4049 } | 4058 } |
| 4050 | 4059 |
| 4051 /** | 4060 /** |
| 4052 * Base class representing an element which can be the target of a reference. | 4061 * Base class representing an element which can be the target of a reference. |
| 4053 * When used as a mixin, implements the default behavior shared by most | 4062 * When used as a mixin, implements the default behavior shared by most |
| 4054 * elements. | 4063 * elements. |
| 4055 */ | 4064 */ |
| 4056 class ReferenceableElementForLink { | 4065 abstract class ReferenceableElementForLink implements Element { |
| 4057 /** | 4066 /** |
| 4058 * If this element can be used in a constructor invocation context, | 4067 * If this element can be used in a constructor invocation context, |
| 4059 * return the associated constructor (which may be `this` or some | 4068 * return the associated constructor (which may be `this` or some |
| 4060 * other element). Otherwise return `null`. | 4069 * other element). Otherwise return `null`. |
| 4061 */ | 4070 */ |
| 4062 ConstructorElementForLink get asConstructor => null; | 4071 ConstructorElementForLink get asConstructor => null; |
| 4063 | 4072 |
| 4064 /** | 4073 /** |
| 4065 * If this element can be used in a getter context to refer to a | 4074 * If this element can be used in a getter context to refer to a |
| 4066 * constant variable, return the [ConstVariableNode] for the | 4075 * constant variable, return the [ConstVariableNode] for the |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4121 SpecialTypeElementForLink(this.linker, this.type); | 4130 SpecialTypeElementForLink(this.linker, this.type); |
| 4122 | 4131 |
| 4123 @override | 4132 @override |
| 4124 DartType get asStaticType => linker.typeProvider.typeType; | 4133 DartType get asStaticType => linker.typeProvider.typeType; |
| 4125 | 4134 |
| 4126 @override | 4135 @override |
| 4127 DartType buildType( | 4136 DartType buildType( |
| 4128 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { | 4137 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { |
| 4129 return type; | 4138 return type; |
| 4130 } | 4139 } |
| 4140 |
| 4141 @override |
| 4142 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4143 |
| 4144 @override |
| 4145 String toString() => type.toString(); |
| 4131 } | 4146 } |
| 4132 | 4147 |
| 4133 /** | 4148 /** |
| 4134 * Element representing a synthetic variable resynthesized from a summary during | 4149 * Element representing a synthetic variable resynthesized from a summary during |
| 4135 * linking. | 4150 * linking. |
| 4136 */ | 4151 */ |
| 4137 class SyntheticVariableElementForLink implements PropertyInducingElementImpl { | 4152 class SyntheticVariableElementForLink implements PropertyInducingElementImpl { |
| 4138 PropertyAccessorElementForLink_Executable _getter; | 4153 PropertyAccessorElementForLink_Executable _getter; |
| 4139 PropertyAccessorElementForLink_Executable _setter; | 4154 PropertyAccessorElementForLink_Executable _setter; |
| 4140 | 4155 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4179 ElementKind get kind => ElementKind.FUNCTION; | 4194 ElementKind get kind => ElementKind.FUNCTION; |
| 4180 | 4195 |
| 4181 @override | 4196 @override |
| 4182 FunctionElementForLink_Local getLocalFunction(int index) { | 4197 FunctionElementForLink_Local getLocalFunction(int index) { |
| 4183 // TODO(paulberry): implement. | 4198 // TODO(paulberry): implement. |
| 4184 return null; | 4199 return null; |
| 4185 } | 4200 } |
| 4186 | 4201 |
| 4187 @override | 4202 @override |
| 4188 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 4203 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4204 |
| 4205 @override |
| 4206 String toString() => '$enclosingElement.$name'; |
| 4189 } | 4207 } |
| 4190 | 4208 |
| 4191 /** | 4209 /** |
| 4192 * Element representing a top level variable resynthesized from a | 4210 * Element representing a top level variable resynthesized from a |
| 4193 * summary during linking. | 4211 * summary during linking. |
| 4194 */ | 4212 */ |
| 4195 class TopLevelVariableElementForLink extends VariableElementForLink | 4213 class TopLevelVariableElementForLink extends VariableElementForLink |
| 4196 implements TopLevelVariableElement { | 4214 implements TopLevelVariableElement { |
| 4197 TopLevelVariableElementForLink(CompilationUnitElementForLink enclosingElement, | 4215 TopLevelVariableElementForLink(CompilationUnitElementForLink enclosingElement, |
| 4198 UnlinkedVariable unlinkedVariable) | 4216 UnlinkedVariable unlinkedVariable) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4274 } | 4292 } |
| 4275 int refPtr = 0; | 4293 int refPtr = 0; |
| 4276 | 4294 |
| 4277 for (UnlinkedConstOperation operation in unlinkedConst.operations) { | 4295 for (UnlinkedConstOperation operation in unlinkedConst.operations) { |
| 4278 switch (operation) { | 4296 switch (operation) { |
| 4279 case UnlinkedConstOperation.pushReference: | 4297 case UnlinkedConstOperation.pushReference: |
| 4280 EntityRef ref = unlinkedConst.references[refPtr++]; | 4298 EntityRef ref = unlinkedConst.references[refPtr++]; |
| 4281 // TODO(paulberry): cache these resolved references for | 4299 // TODO(paulberry): cache these resolved references for |
| 4282 // later use by evaluate(). | 4300 // later use by evaluate(). |
| 4283 TypeInferenceNode dependency = | 4301 TypeInferenceNode dependency = |
| 4284 compilationUnit._resolveRef(ref.reference).asTypeInferenceNode; | 4302 compilationUnit.resolveRef(ref.reference).asTypeInferenceNode; |
| 4285 if (dependency != null) { | 4303 if (dependency != null) { |
| 4286 dependencies.add(dependency); | 4304 dependencies.add(dependency); |
| 4287 } | 4305 } |
| 4288 break; | 4306 break; |
| 4289 case UnlinkedConstOperation.makeTypedList: | 4307 case UnlinkedConstOperation.makeTypedList: |
| 4290 case UnlinkedConstOperation.invokeConstructor: | 4308 case UnlinkedConstOperation.invokeConstructor: |
| 4291 refPtr++; | 4309 refPtr++; |
| 4292 break; | 4310 break; |
| 4293 case UnlinkedConstOperation.makeTypedMap: | 4311 case UnlinkedConstOperation.makeTypedMap: |
| 4294 refPtr += 2; | 4312 refPtr += 2; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4484 } | 4502 } |
| 4485 | 4503 |
| 4486 /** | 4504 /** |
| 4487 * Singleton element used for unresolved references. | 4505 * Singleton element used for unresolved references. |
| 4488 */ | 4506 */ |
| 4489 class UndefinedElementForLink extends Object with ReferenceableElementForLink { | 4507 class UndefinedElementForLink extends Object with ReferenceableElementForLink { |
| 4490 static final UndefinedElementForLink instance = | 4508 static final UndefinedElementForLink instance = |
| 4491 new UndefinedElementForLink._(); | 4509 new UndefinedElementForLink._(); |
| 4492 | 4510 |
| 4493 UndefinedElementForLink._(); | 4511 UndefinedElementForLink._(); |
| 4512 |
| 4513 @override |
| 4514 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4494 } | 4515 } |
| 4495 | 4516 |
| 4496 /** | 4517 /** |
| 4497 * Element representing a top level variable resynthesized from a | 4518 * Element representing a top level variable resynthesized from a |
| 4498 * summary during linking. | 4519 * summary during linking. |
| 4499 */ | 4520 */ |
| 4500 abstract class VariableElementForLink | 4521 abstract class VariableElementForLink |
| 4501 implements NonParameterVariableElementImpl, PropertyInducingElement { | 4522 implements NonParameterVariableElementImpl, PropertyInducingElement { |
| 4502 /** | 4523 /** |
| 4503 * The unlinked representation of the variable in the summary. | 4524 * The unlinked representation of the variable in the summary. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4639 * there are no type parameters in scope. | 4660 * there are no type parameters in scope. |
| 4640 */ | 4661 */ |
| 4641 TypeParameterizedElementMixin get _typeParameterContext; | 4662 TypeParameterizedElementMixin get _typeParameterContext; |
| 4642 | 4663 |
| 4643 @override | 4664 @override |
| 4644 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 4665 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4645 | 4666 |
| 4646 @override | 4667 @override |
| 4647 String toString() => '$enclosingElement.$name'; | 4668 String toString() => '$enclosingElement.$name'; |
| 4648 } | 4669 } |
| OLD | NEW |