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 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 break; | 2221 break; |
2222 case UnlinkedExprOperation.assignToRef: | 2222 case UnlinkedExprOperation.assignToRef: |
2223 _doAssignToRef(); | 2223 _doAssignToRef(); |
2224 break; | 2224 break; |
2225 case UnlinkedExprOperation.assignToProperty: | 2225 case UnlinkedExprOperation.assignToProperty: |
2226 _doAssignToProperty(); | 2226 _doAssignToProperty(); |
2227 break; | 2227 break; |
2228 case UnlinkedExprOperation.assignToIndex: | 2228 case UnlinkedExprOperation.assignToIndex: |
2229 _doAssignToIndex(); | 2229 _doAssignToIndex(); |
2230 break; | 2230 break; |
| 2231 case UnlinkedExprOperation.await: |
| 2232 _doAwait(); |
| 2233 break; |
2231 case UnlinkedExprOperation.extractIndex: | 2234 case UnlinkedExprOperation.extractIndex: |
2232 _doExtractIndex(); | 2235 _doExtractIndex(); |
2233 break; | 2236 break; |
2234 case UnlinkedExprOperation.invokeMethodRef: | 2237 case UnlinkedExprOperation.invokeMethodRef: |
2235 _doInvokeMethodRef(); | 2238 _doInvokeMethodRef(); |
2236 break; | 2239 break; |
2237 case UnlinkedExprOperation.invokeMethod: | 2240 case UnlinkedExprOperation.invokeMethod: |
2238 _doInvokeMethod(); | 2241 _doInvokeMethod(); |
2239 break; | 2242 break; |
2240 case UnlinkedExprOperation.cascadeSectionBegin: | 2243 case UnlinkedExprOperation.cascadeSectionBegin: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 } else if (isIncrementOrDecrement(operator)) { | 2359 } else if (isIncrementOrDecrement(operator)) { |
2357 // TODO(scheglov) implement | 2360 // TODO(scheglov) implement |
2358 stack.add(DynamicTypeImpl.instance); | 2361 stack.add(DynamicTypeImpl.instance); |
2359 } else { | 2362 } else { |
2360 stack.removeLast(); | 2363 stack.removeLast(); |
2361 // TODO(scheglov) implement | 2364 // TODO(scheglov) implement |
2362 stack.add(DynamicTypeImpl.instance); | 2365 stack.add(DynamicTypeImpl.instance); |
2363 } | 2366 } |
2364 } | 2367 } |
2365 | 2368 |
| 2369 void _doAwait() { |
| 2370 DartType type = stack.removeLast(); |
| 2371 DartType typeArgument = type?.flattenFutures(linker.typeSystem); |
| 2372 typeArgument = _dynamicIfNull(typeArgument); |
| 2373 stack.add(typeArgument); |
| 2374 } |
| 2375 |
2366 void _doConditional() { | 2376 void _doConditional() { |
2367 DartType elseType = stack.removeLast(); | 2377 DartType elseType = stack.removeLast(); |
2368 DartType thenType = stack.removeLast(); | 2378 DartType thenType = stack.removeLast(); |
2369 stack.removeLast(); | 2379 stack.removeLast(); |
2370 DartType type = _leastUpperBound(thenType, elseType); | 2380 DartType type = _leastUpperBound(thenType, elseType); |
2371 type = _dynamicIfNull(type); | 2381 type = _dynamicIfNull(type); |
2372 stack.add(type); | 2382 stack.add(type); |
2373 } | 2383 } |
2374 | 2384 |
2375 void _doExtractIndex() { | 2385 void _doExtractIndex() { |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 _linkedLibrary.exportDependencies.map(_getDependency).toList(); | 3416 _linkedLibrary.exportDependencies.map(_getDependency).toList(); |
3407 | 3417 |
3408 @override | 3418 @override |
3409 String get identifier => _absoluteUri.toString(); | 3419 String get identifier => _absoluteUri.toString(); |
3410 | 3420 |
3411 @override | 3421 @override |
3412 List<LibraryElementForLink> get importedLibraries => _importedLibraries ??= | 3422 List<LibraryElementForLink> get importedLibraries => _importedLibraries ??= |
3413 _linkedLibrary.importDependencies.map(_getDependency).toList(); | 3423 _linkedLibrary.importDependencies.map(_getDependency).toList(); |
3414 | 3424 |
3415 @override | 3425 @override |
3416 bool get isDartAsync => _absoluteUri == 'dart:async'; | 3426 bool get isDartAsync => _absoluteUri.toString() == 'dart:async'; |
3417 | 3427 |
3418 @override | 3428 @override |
3419 bool get isDartCore => _absoluteUri == 'dart:core'; | 3429 bool get isDartCore => _absoluteUri.toString() == 'dart:core'; |
3420 | 3430 |
3421 /** | 3431 /** |
3422 * If this library is part of the build unit being linked, return the library | 3432 * If this library is part of the build unit being linked, return the library |
3423 * cycle it is part of. Otherwise return `null`. | 3433 * cycle it is part of. Otherwise return `null`. |
3424 */ | 3434 */ |
3425 LibraryCycleForLink get libraryCycleForLink; | 3435 LibraryCycleForLink get libraryCycleForLink; |
3426 | 3436 |
3427 @override | 3437 @override |
3428 String get name { | 3438 String get name { |
3429 return _definingUnlinkedUnit.libraryName; | 3439 return _definingUnlinkedUnit.libraryName; |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5096 * there are no type parameters in scope. | 5106 * there are no type parameters in scope. |
5097 */ | 5107 */ |
5098 TypeParameterizedElementMixin get _typeParameterContext; | 5108 TypeParameterizedElementMixin get _typeParameterContext; |
5099 | 5109 |
5100 @override | 5110 @override |
5101 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 5111 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
5102 | 5112 |
5103 @override | 5113 @override |
5104 String toString() => '$enclosingElement.$name'; | 5114 String toString() => '$enclosingElement.$name'; |
5105 } | 5115 } |
OLD | NEW |