Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1124)

Side by Side Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 2541603002: Support for AwaitExpression in unlinked expressions. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 = linker.typeSystem
2372 .mostSpecificTypeArgument(type, linker.typeProvider.futureType);
2373 typeArgument = _dynamicIfNull(typeArgument);
2374 stack.add(typeArgument);
Paul Berry 2016/11/29 19:15:57 Do we need to flatten futures here? The spec says
scheglov 2016/11/29 19:39:13 Done.
2375 }
2376
2366 void _doConditional() { 2377 void _doConditional() {
2367 DartType elseType = stack.removeLast(); 2378 DartType elseType = stack.removeLast();
2368 DartType thenType = stack.removeLast(); 2379 DartType thenType = stack.removeLast();
2369 stack.removeLast(); 2380 stack.removeLast();
2370 DartType type = _leastUpperBound(thenType, elseType); 2381 DartType type = _leastUpperBound(thenType, elseType);
2371 type = _dynamicIfNull(type); 2382 type = _dynamicIfNull(type);
2372 stack.add(type); 2383 stack.add(type);
2373 } 2384 }
2374 2385
2375 void _doExtractIndex() { 2386 void _doExtractIndex() {
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 _linkedLibrary.exportDependencies.map(_getDependency).toList(); 3417 _linkedLibrary.exportDependencies.map(_getDependency).toList();
3407 3418
3408 @override 3419 @override
3409 String get identifier => _absoluteUri.toString(); 3420 String get identifier => _absoluteUri.toString();
3410 3421
3411 @override 3422 @override
3412 List<LibraryElementForLink> get importedLibraries => _importedLibraries ??= 3423 List<LibraryElementForLink> get importedLibraries => _importedLibraries ??=
3413 _linkedLibrary.importDependencies.map(_getDependency).toList(); 3424 _linkedLibrary.importDependencies.map(_getDependency).toList();
3414 3425
3415 @override 3426 @override
3416 bool get isDartAsync => _absoluteUri == 'dart:async'; 3427 bool get isDartAsync => _absoluteUri.toString() == 'dart:async';
3417 3428
3418 @override 3429 @override
3419 bool get isDartCore => _absoluteUri == 'dart:core'; 3430 bool get isDartCore => _absoluteUri.toString() == 'dart:core';
3420 3431
3421 /** 3432 /**
3422 * If this library is part of the build unit being linked, return the library 3433 * If this library is part of the build unit being linked, return the library
3423 * cycle it is part of. Otherwise return `null`. 3434 * cycle it is part of. Otherwise return `null`.
3424 */ 3435 */
3425 LibraryCycleForLink get libraryCycleForLink; 3436 LibraryCycleForLink get libraryCycleForLink;
3426 3437
3427 @override 3438 @override
3428 String get name { 3439 String get name {
3429 return _definingUnlinkedUnit.libraryName; 3440 return _definingUnlinkedUnit.libraryName;
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 * there are no type parameters in scope. 5107 * there are no type parameters in scope.
5097 */ 5108 */
5098 TypeParameterizedElementMixin get _typeParameterContext; 5109 TypeParameterizedElementMixin get _typeParameterContext;
5099 5110
5100 @override 5111 @override
5101 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 5112 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
5102 5113
5103 @override 5114 @override
5104 String toString() => '$enclosingElement.$name'; 5115 String toString() => '$enclosingElement.$name';
5105 } 5116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698