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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2683683002: Prevent null reference when SDK lacks FutureOr<T>. (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 9491 matching lines...) Expand 10 before | Expand all | Expand 10 after
9502 _numType = _getType(coreNamespace, "num"); 9502 _numType = _getType(coreNamespace, "num");
9503 _objectType = _getType(coreNamespace, "Object"); 9503 _objectType = _getType(coreNamespace, "Object");
9504 _stackTraceType = _getType(coreNamespace, "StackTrace"); 9504 _stackTraceType = _getType(coreNamespace, "StackTrace");
9505 _streamType = _getType(asyncNamespace, "Stream"); 9505 _streamType = _getType(asyncNamespace, "Stream");
9506 _stringType = _getType(coreNamespace, "String"); 9506 _stringType = _getType(coreNamespace, "String");
9507 _symbolType = _getType(coreNamespace, "Symbol"); 9507 _symbolType = _getType(coreNamespace, "Symbol");
9508 _typeType = _getType(coreNamespace, "Type"); 9508 _typeType = _getType(coreNamespace, "Type");
9509 _undefinedType = UndefinedTypeImpl.instance; 9509 _undefinedType = UndefinedTypeImpl.instance;
9510 _futureDynamicType = _futureType.instantiate(<DartType>[_dynamicType]); 9510 _futureDynamicType = _futureType.instantiate(<DartType>[_dynamicType]);
9511 _futureNullType = _futureType.instantiate(<DartType>[_nullType]); 9511 _futureNullType = _futureType.instantiate(<DartType>[_nullType]);
9512 _futureOrNullType = _futureOrType.instantiate(<DartType>[_nullType]);
9513 _iterableDynamicType = _iterableType.instantiate(<DartType>[_dynamicType]); 9512 _iterableDynamicType = _iterableType.instantiate(<DartType>[_dynamicType]);
9514 _streamDynamicType = _streamType.instantiate(<DartType>[_dynamicType]); 9513 _streamDynamicType = _streamType.instantiate(<DartType>[_dynamicType]);
9515 // FutureOr<T> is still fairly new, so if we're analyzing an SDK that 9514 // FutureOr<T> is still fairly new, so if we're analyzing an SDK that
9516 // doesn't have it yet, create an element for it. 9515 // doesn't have it yet, create an element for it.
9517 _futureOrType ??= createPlaceholderFutureOr(_futureType, _objectType); 9516 _futureOrType ??= createPlaceholderFutureOr(_futureType, _objectType);
9517 _futureOrNullType = _futureOrType.instantiate(<DartType>[_nullType]);
9518 } 9518 }
9519 9519
9520 /** 9520 /**
9521 * Create an [InterfaceType] that can be used for `FutureOr<T>` if the SDK 9521 * Create an [InterfaceType] that can be used for `FutureOr<T>` if the SDK
9522 * being analyzed does not contain its own `FutureOr<T>`. This ensures that 9522 * being analyzed does not contain its own `FutureOr<T>`. This ensures that
9523 * we can analyze older SDKs. 9523 * we can analyze older SDKs.
9524 */ 9524 */
9525 static InterfaceType createPlaceholderFutureOr( 9525 static InterfaceType createPlaceholderFutureOr(
9526 InterfaceType futureType, InterfaceType objectType) { 9526 InterfaceType futureType, InterfaceType objectType) {
9527 var compilationUnit = 9527 var compilationUnit =
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
10899 return null; 10899 return null;
10900 } 10900 }
10901 if (identical(node.staticElement, variable)) { 10901 if (identical(node.staticElement, variable)) {
10902 if (node.inSetterContext()) { 10902 if (node.inSetterContext()) {
10903 result = true; 10903 result = true;
10904 } 10904 }
10905 } 10905 }
10906 return null; 10906 return null;
10907 } 10907 }
10908 } 10908 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698