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

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

Issue 2658123004: Resynthesize invalid types as 'dynamic'. (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 | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 summary_resynthesizer; 5 library summary_resynthesizer;
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_ast_factory.dart'; 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 * is returned. 1241 * is returned.
1242 */ 1242 */
1243 DartType buildType(bool instantiateToBoundsAllowed, int numTypeArguments, 1243 DartType buildType(bool instantiateToBoundsAllowed, int numTypeArguments,
1244 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { 1244 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) {
1245 DartType result = 1245 DartType result =
1246 (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty) 1246 (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty)
1247 ? type 1247 ? type
1248 : _buildType(instantiateToBoundsAllowed, numTypeArguments, 1248 : _buildType(instantiateToBoundsAllowed, numTypeArguments,
1249 getTypeArgument, implicitFunctionTypeIndices); 1249 getTypeArgument, implicitFunctionTypeIndices);
1250 if (result == null) { 1250 if (result == null) {
1251 // TODO(paulberry): figure out how to handle this case (which should 1251 return DynamicTypeImpl.instance;
1252 // only occur in the event of erroneous code).
1253 throw new UnimplementedError();
1254 } 1252 }
1255 return result; 1253 return result;
1256 } 1254 }
1257 1255
1258 /** 1256 /**
1259 * If this reference refers to a type, build a [DartType]. Otherwise return 1257 * If this reference refers to a type, build a [DartType]. Otherwise return
1260 * `null`. If [numTypeArguments] is the same as the [numTypeParameters], 1258 * `null`. If [numTypeArguments] is the same as the [numTypeParameters],
1261 * the type is instantiated with type arguments returned by [getTypeArgument], 1259 * the type is instantiated with type arguments returned by [getTypeArgument],
1262 * otherwise it is instantiated with type parameter bounds (if strong mode), 1260 * otherwise it is instantiated with type parameter bounds (if strong mode),
1263 * or with `dynamic` type arguments. 1261 * or with `dynamic` type arguments.
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 static String _getElementIdentifier(String name, ReferenceKind kind) { 1887 static String _getElementIdentifier(String name, ReferenceKind kind) {
1890 if (kind == ReferenceKind.topLevelPropertyAccessor || 1888 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1891 kind == ReferenceKind.propertyAccessor) { 1889 kind == ReferenceKind.propertyAccessor) {
1892 if (!name.endsWith('=')) { 1890 if (!name.endsWith('=')) {
1893 return name + '?'; 1891 return name + '?';
1894 } 1892 }
1895 } 1893 }
1896 return name; 1894 return name;
1897 } 1895 }
1898 } 1896 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698