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

Side by Side Diff: pkg/analyzer/tool/summary/generate.dart

Issue 2624283003: Revert "Add support for generic function type syntax, part 1" (TBR) (Closed)
Patch Set: Created 3 years, 11 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
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 /** 5 /**
6 * This file contains code to generate serialization/deserialization logic for 6 * This file contains code to generate serialization/deserialization logic for
7 * summaries based on an "IDL" description of the summary format (written in 7 * summaries based on an "IDL" description of the summary format (written in
8 * stylized Dart). 8 * stylized Dart).
9 * 9 *
10 * For each class in the "IDL" input, two corresponding classes are generated: 10 * For each class in the "IDL" input, two corresponding classes are generated:
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 _idl.classes[clsName] = cls; 261 _idl.classes[clsName] = cls;
262 String expectedBase = 'base.SummaryClass'; 262 String expectedBase = 'base.SummaryClass';
263 if (decl.extendsClause == null || 263 if (decl.extendsClause == null ||
264 decl.extendsClause.superclass.name.name != expectedBase) { 264 decl.extendsClause.superclass.name.name != expectedBase) {
265 throw new Exception( 265 throw new Exception(
266 'Class `$clsName` needs to extend `$expectedBase`'); 266 'Class `$clsName` needs to extend `$expectedBase`');
267 } 267 }
268 for (ClassMember classMember in decl.members) { 268 for (ClassMember classMember in decl.members) {
269 if (classMember is MethodDeclaration && classMember.isGetter) { 269 if (classMember is MethodDeclaration && classMember.isGetter) {
270 String desc = '$clsName.${classMember.name.name}'; 270 String desc = '$clsName.${classMember.name.name}';
271 if (classMember.returnType is! TypeName) { 271 TypeName type = classMember.returnType;
272 if (classMember.returnType == null) { 272 if (type == null) {
273 throw new Exception('Class member needs a type: $desc'); 273 throw new Exception('Class member needs a type: $desc');
274 }
275 throw new Exception('Class member needs a class type: $desc');
276 } 274 }
277 TypeName type = classMember.returnType;
278 bool isList = false; 275 bool isList = false;
279 if (type.name.name == 'List' && 276 if (type.name.name == 'List' &&
280 type.typeArguments != null && 277 type.typeArguments != null &&
281 type.typeArguments.arguments.length == 1) { 278 type.typeArguments.arguments.length == 1) {
282 isList = true; 279 isList = true;
283 type = type.typeArguments.arguments[0]; 280 type = type.typeArguments.arguments[0];
284 } 281 }
285 if (type.typeArguments != null) { 282 if (type.typeArguments != null) {
286 throw new Exception('Cannot handle type arguments in `$type`'); 283 throw new Exception('Cannot handle type arguments in `$type`');
287 } 284 }
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 return token.lexeme.split('\n').map((String line) { 1024 return token.lexeme.split('\n').map((String line) {
1028 if (line.startsWith(indent)) { 1025 if (line.startsWith(indent)) {
1029 line = line.substring(indent.length); 1026 line = line.substring(indent.length);
1030 } 1027 }
1031 return line; 1028 return line;
1032 }).join('\n'); 1029 }).join('\n');
1033 } 1030 }
1034 return null; 1031 return null;
1035 } 1032 }
1036 } 1033 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/dart_test.dart ('k') | pkg/dev_compiler/lib/src/compiler/ast_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698