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

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

Issue 2514353005: Add support for "??" to summaries. (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 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 stack.add(BottomTypeImpl.instance); 2258 stack.add(BottomTypeImpl.instance);
2259 break; 2259 break;
2260 case UnlinkedExprOperation.pushLocalFunctionReference: 2260 case UnlinkedExprOperation.pushLocalFunctionReference:
2261 int popCount = _getNextInt(); 2261 int popCount = _getNextInt();
2262 assert(popCount == 0); // TODO(paulberry): handle the nonzero case. 2262 assert(popCount == 0); // TODO(paulberry): handle the nonzero case.
2263 stack.add(function.functions[_getNextInt()].type); 2263 stack.add(function.functions[_getNextInt()].type);
2264 break; 2264 break;
2265 case UnlinkedExprOperation.pushParameter: 2265 case UnlinkedExprOperation.pushParameter:
2266 stack.add(_findParameterType(_getNextString())); 2266 stack.add(_findParameterType(_getNextString()));
2267 break; 2267 break;
2268 case UnlinkedExprOperation.ifNull:
2269 _doIfNull();
2270 break;
2268 default: 2271 default:
2269 // TODO(paulberry): implement. 2272 // TODO(paulberry): implement.
2270 throw new UnimplementedError('$operation'); 2273 throw new UnimplementedError('$operation');
2271 } 2274 }
2272 } 2275 }
2273 assert(intPtr == unlinkedConst.ints.length); 2276 assert(intPtr == unlinkedConst.ints.length);
2274 assert(refPtr == unlinkedConst.references.length); 2277 assert(refPtr == unlinkedConst.references.length);
2275 assert(strPtr == unlinkedConst.strings.length); 2278 assert(strPtr == unlinkedConst.strings.length);
2276 assert(assignmentOperatorPtr == unlinkedConst.assignmentOperators.length); 2279 assert(assignmentOperatorPtr == unlinkedConst.assignmentOperators.length);
2277 assert(stack.length == 1); 2280 assert(stack.length == 1);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 } else { 2400 } else {
2398 // Method tear-off 2401 // Method tear-off
2399 return element.type; 2402 return element.type;
2400 } 2403 }
2401 } 2404 }
2402 } 2405 }
2403 return DynamicTypeImpl.instance; 2406 return DynamicTypeImpl.instance;
2404 }()); 2407 }());
2405 } 2408 }
2406 2409
2410 void _doIfNull() {
2411 DartType secondType = stack.removeLast();
2412 DartType firstType = stack.removeLast();
2413 DartType type = _leastUpperBound(firstType, secondType);
2414 type = _dynamicIfNull(type);
2415 stack.add(type);
2416 }
2417
2407 void _doInvokeConstructor() { 2418 void _doInvokeConstructor() {
2408 int numNamed = _getNextInt(); 2419 int numNamed = _getNextInt();
2409 int numPositional = _getNextInt(); 2420 int numPositional = _getNextInt();
2410 // TODO(paulberry): don't just pop the args; use their types 2421 // TODO(paulberry): don't just pop the args; use their types
2411 // to infer the type of type arguments. 2422 // to infer the type of type arguments.
2412 stack.length -= numNamed + numPositional; 2423 stack.length -= numNamed + numPositional;
2413 strPtr += numNamed; 2424 strPtr += numNamed;
2414 EntityRef ref = _getNextRef(); 2425 EntityRef ref = _getNextRef();
2415 ClassElementForLink_Class element = 2426 ClassElementForLink_Class element =
2416 unit.resolveConstructorClassRef(ref.reference).asClass; 2427 unit.resolveConstructorClassRef(ref.reference).asClass;
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5079 * there are no type parameters in scope. 5090 * there are no type parameters in scope.
5080 */ 5091 */
5081 TypeParameterizedElementMixin get _typeParameterContext; 5092 TypeParameterizedElementMixin get _typeParameterContext;
5082 5093
5083 @override 5094 @override
5084 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 5095 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
5085 5096
5086 @override 5097 @override
5087 String toString() => '$enclosingElement.$name'; 5098 String toString() => '$enclosingElement.$name';
5088 } 5099 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698