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

Side by Side Diff: lib/dartdoc/frog/library.dart

Issue 10559030: Remove uses of string + from API document generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class LibraryImport { 5 class LibraryImport {
6 final String prefix; 6 final String prefix;
7 final Library library; 7 final Library library;
8 final SourceSpan span; 8 final SourceSpan span;
9 LibraryImport(this.library, [this.prefix, this.span]); 9 LibraryImport(this.library, [this.prefix, this.span]);
10 } 10 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 world.warning(message, node.span); 208 world.warning(message, node.span);
209 return world.varType; 209 return world.varType;
210 } 210 }
211 } 211 }
212 return ret; 212 return ret;
213 } 213 }
214 214
215 static String _getDottedName(NameTypeReference type) { 215 static String _getDottedName(NameTypeReference type) {
216 if (type.names != null) { 216 if (type.names != null) {
217 var names = map(type.names, (n) => n.name); 217 var names = map(type.names, (n) => n.name);
218 return type.name.name + '.' + Strings.join(names, '.'); 218 return '${type.name.name}.${Strings.join(names, ".")}';
219 } else { 219 } else {
220 return type.name.name; 220 return type.name.name;
221 } 221 }
222 } 222 }
223 223
224 Member lookup(String name, SourceSpan span) { 224 Member lookup(String name, SourceSpan span) {
225 return _topNames[name]; 225 return _topNames[name];
226 } 226 }
227 227
228 resolve() { 228 resolve() {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 break; 381 break;
382 382
383 case "import": 383 case "import":
384 seenImport = true; 384 seenImport = true;
385 name = getFirstStringArg(node); 385 name = getFirstStringArg(node);
386 var prefix = tryGetNamedStringArg(node, 'prefix'); 386 var prefix = tryGetNamedStringArg(node, 'prefix');
387 if (node.arguments.length > 2 || 387 if (node.arguments.length > 2 ||
388 node.arguments.length == 2 && prefix == null) { 388 node.arguments.length == 2 && prefix == null) {
389 world.error( 389 world.error(
390 'expected at most one "name" argument and one optional "prefix"' 390 'expected at most one "name" argument and one optional "prefix"'
391 + ' but found ${node.arguments.length}', node.span); 391 ' but found ${node.arguments.length}', node.span);
392 } else if (prefix != null && prefix.indexOf('.') >= 0) { 392 } else if (prefix != null && prefix.indexOf('.') >= 0) {
393 world.error('library prefix canot contain "."', node.span); 393 world.error('library prefix canot contain "."', node.span);
394 } else if (seenSource || seenResource) { 394 } else if (seenSource || seenResource) {
395 world.error('#imports must come before any #source or #resource', 395 world.error('#imports must come before any #source or #resource',
396 node.span); 396 node.span);
397 } 397 }
398 398
399 // Empty prefix and no prefix are equivalent 399 // Empty prefix and no prefix are equivalent
400 if (prefix == '') prefix = null; 400 if (prefix == '') prefix = null;
401 401
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 String tryGetNamedStringArg(DirectiveDefinition node, String argName) { 462 String tryGetNamedStringArg(DirectiveDefinition node, String argName) {
463 var args = node.arguments.filter( 463 var args = node.arguments.filter(
464 (a) => a.label != null && a.label.name == argName); 464 (a) => a.label != null && a.label.name == argName);
465 465
466 if (args.length == 0) { 466 if (args.length == 0) {
467 return null; 467 return null;
468 } 468 }
469 if (args.length > 1) { 469 if (args.length > 1) {
470 world.error('expected at most one "${argName}" argument but found ' 470 world.error('expected at most one "${argName}" argument but found '
471 + node.arguments.length, node.span); 471 '${node.arguments.length}', node.span);
472 } 472 }
473 // Even though the collection has one arg, this is the easiest way to get 473 // Even though the collection has one arg, this is the easiest way to get
474 // the first item. 474 // the first item.
475 for (var arg in args) { 475 for (var arg in args) {
476 return _parseStringArgument(arg); 476 return _parseStringArgument(arg);
477 } 477 }
478 } 478 }
479 479
480 String _parseStringArgument(ArgumentNode arg) { 480 String _parseStringArgument(ArgumentNode arg) {
481 var expr = arg.value; 481 var expr = arg.value;
(...skipping 18 matching lines...) Expand all
500 500
501 void visitFunctionDefinition(FunctionDefinition node) { 501 void visitFunctionDefinition(FunctionDefinition node) {
502 currentType.addMethod(node.name.name, node); 502 currentType.addMethod(node.name.name, node);
503 } 503 }
504 504
505 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { 505 void visitFunctionTypeDefinition(FunctionTypeDefinition node) {
506 var type = library.addType(node.func.name.name, node, false); 506 var type = library.addType(node.func.name.name, node, false);
507 type.addMethod(':call', node.func); 507 type.addMethod(':call', node.func);
508 } 508 }
509 } 509 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698