| OLD | NEW |
| 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 #library('mirrors.dart2js'); | 5 #library('mirrors.dart2js'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 #import('dart:uri'); | 8 #import('dart:uri'); |
| 9 | 9 |
| 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 String get canonicalName => simpleName; | 486 String get canonicalName => simpleName; |
| 487 | 487 |
| 488 /** | 488 /** |
| 489 * Returns the library name (for libraries with a #library tag) or the script | 489 * Returns the library name (for libraries with a #library tag) or the script |
| 490 * file name (for scripts without a #library tag). The latter case is used to | 490 * file name (for scripts without a #library tag). The latter case is used to |
| 491 * provide a 'library name' for scripts, to use for instance in dartdoc. | 491 * provide a 'library name' for scripts, to use for instance in dartdoc. |
| 492 */ | 492 */ |
| 493 String get simpleName { | 493 String get simpleName { |
| 494 if (_library.libraryTag !== null) { | 494 if (_library.libraryTag !== null) { |
| 495 return _library.libraryTag.argument.dartString.slowToString(); | 495 // TODO(ahe): Remove StringNode check when old syntax is removed. |
| 496 StringNode name = _library.libraryTag.name.asStringNode(); |
| 497 if (name !== null) { |
| 498 return name.dartString.slowToString(); |
| 499 } else { |
| 500 return _library.libraryTag.name.toString(); |
| 501 } |
| 496 } else { | 502 } else { |
| 497 // Use the file name as script name. | 503 // Use the file name as script name. |
| 498 String path = _library.uri.path; | 504 String path = _library.uri.path; |
| 499 return path.substring(path.lastIndexOf('/') + 1); | 505 return path.substring(path.lastIndexOf('/') + 1); |
| 500 } | 506 } |
| 501 } | 507 } |
| 502 | 508 |
| 503 String get qualifiedName => simpleName; | 509 String get qualifiedName => simpleName; |
| 504 | 510 |
| 505 void _ensureTypes() { | 511 void _ensureTypes() { |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 if (node !== null) { | 1391 if (node !== null) { |
| 1386 var span = system.compiler.spanFromNode(node, script.uri); | 1392 var span = system.compiler.spanFromNode(node, script.uri); |
| 1387 return new Dart2JsLocation(script, span); | 1393 return new Dart2JsLocation(script, span); |
| 1388 } else { | 1394 } else { |
| 1389 var span = system.compiler.spanFromElement(_variable); | 1395 var span = system.compiler.spanFromElement(_variable); |
| 1390 return new Dart2JsLocation(script, span); | 1396 return new Dart2JsLocation(script, span); |
| 1391 } | 1397 } |
| 1392 } | 1398 } |
| 1393 } | 1399 } |
| 1394 | 1400 |
| OLD | NEW |