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 part of serialization; | 5 part of serialization; |
6 | 6 |
7 // TODO(alanknight): We should have an example and tests for subclassing | 7 // TODO(alanknight): We should have an example and tests for subclassing |
8 // serialization rule rather than using the hard-coded ClosureToMap rule. And | 8 // serialization rule rather than using the hard-coded ClosureToMap rule. And |
9 // possibly an abstract superclass that's designed to be subclassed that way. | 9 // possibly an abstract superclass that's designed to be subclassed that way. |
10 /** | 10 /** |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 var separatorIndex = qualifiedName.lastIndexOf("."); | 401 var separatorIndex = qualifiedName.lastIndexOf("."); |
402 var type = qualifiedName.substring(separatorIndex + 1); | 402 var type = qualifiedName.substring(separatorIndex + 1); |
403 var lookup = r.objectNamed(type, (x) => null); | 403 var lookup = r.objectNamed(type, (x) => null); |
404 if (lookup != null) return lookup; | 404 if (lookup != null) return lookup; |
405 var name = qualifiedName.substring(0, separatorIndex); | 405 var name = qualifiedName.substring(0, separatorIndex); |
406 // This is very ugly. The library name for an unnamed library is its URI. | 406 // This is very ugly. The library name for an unnamed library is its URI. |
407 // That can't be constructed as a Symbol, so we can't use findLibrary. | 407 // That can't be constructed as a Symbol, so we can't use findLibrary. |
408 // So follow one or the other path depending if it has a colon, which we | 408 // So follow one or the other path depending if it has a colon, which we |
409 // assume is in any URI and can't be in a Symbol. | 409 // assume is in any URI and can't be in a Symbol. |
410 if (name.contains(":")) { | 410 if (name.contains(":")) { |
411 var uri = new Uri(name); | 411 var uri = Uri.parse(name); |
412 var libMirror = currentMirrorSystem().libraries[uri]; | 412 var libMirror = currentMirrorSystem().libraries[uri]; |
413 return libMirror.classes[new Symbol(type)]; | 413 return libMirror.classes[new Symbol(type)]; |
414 } else { | 414 } else { |
415 var symbol = new Symbol(name); | 415 var symbol = new Symbol(name); |
416 var typeSymbol = new Symbol(type); | 416 var typeSymbol = new Symbol(type); |
417 var libMirror = currentMirrorSystem().findLibrary(symbol).firstWhere( | 417 var libMirror = currentMirrorSystem().findLibrary(symbol).firstWhere( |
418 (lib) => lib.classes[typeSymbol] != null); | 418 (lib) => lib.classes[typeSymbol] != null); |
419 return libMirror.classes[typeSymbol]; | 419 return libMirror.classes[typeSymbol]; |
420 } | 420 } |
421 } | 421 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 removeWhere(x) => _throw(); | 601 removeWhere(x) => _throw(); |
602 retainWhere(x) => _throw(); | 602 retainWhere(x) => _throw(); |
603 replaceRange(x, y, z) => _throw(); | 603 replaceRange(x, y, z) => _throw(); |
604 getRange(x, y) => _throw(); | 604 getRange(x, y) => _throw(); |
605 setRange(x, y, z, [a = 0]) => _throw(); | 605 setRange(x, y, z, [a = 0]) => _throw(); |
606 setAll(x, y) => _throw(); | 606 setAll(x, y) => _throw(); |
607 removeRange(x, y) => _throw(); | 607 removeRange(x, y) => _throw(); |
608 get reversed => _throw(); | 608 get reversed => _throw(); |
609 void set length(x) => _throw(); | 609 void set length(x) => _throw(); |
610 } | 610 } |
OLD | NEW |