OLD | NEW |
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 /// Implementation of the element model used for deserialiation. | 5 /// Implementation of the element model used for deserialiation. |
6 /// | 6 /// |
7 /// These classes are created by [ElementDeserializer] triggered by the | 7 /// These classes are created by [ElementDeserializer] triggered by the |
8 /// [Deserializer]. | 8 /// [Deserializer]. |
9 | 9 |
10 library dart2js.serialization.modelz; | 10 library dart2js.serialization.modelz; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 @override | 76 @override |
77 LibraryElement get implementationLibrary => library; | 77 LibraryElement get implementationLibrary => library; |
78 | 78 |
79 @override | 79 @override |
80 bool get isAbstract => false; | 80 bool get isAbstract => false; |
81 | 81 |
82 @override | 82 @override |
83 bool get isClassMember => false; | 83 bool get isClassMember => false; |
84 | 84 |
85 @override | 85 @override |
86 bool get isClosure => _unsupported('isClosure'); | 86 bool get isClosure => false; |
87 | 87 |
88 @override | 88 @override |
89 bool get isConst => _unsupported('isConst'); | 89 bool get isConst => _unsupported('isConst'); |
90 | 90 |
91 @override | 91 @override |
92 bool get isDeferredLoaderGetter => false; | 92 bool get isDeferredLoaderGetter => false; |
93 | 93 |
94 @override | 94 @override |
95 bool get isFinal => _unsupported('isFinal'); | 95 bool get isFinal => _unsupported('isFinal'); |
96 | 96 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 Iterable<ImportElement> get imports { | 469 Iterable<ImportElement> get imports { |
470 if (_imports == null) { | 470 if (_imports == null) { |
471 _imports = _decoder.getElements(Key.IMPORTS, isOptional: true); | 471 _imports = _decoder.getElements(Key.IMPORTS, isOptional: true); |
472 } | 472 } |
473 return _imports; | 473 return _imports; |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 class ScriptZ implements Script { | 477 class ScriptZ implements Script { |
478 final Uri resourceUri; | 478 final Uri resourceUri; |
| 479 SourceFile _file; |
479 | 480 |
480 ScriptZ(this.resourceUri); | 481 ScriptZ(this.resourceUri); |
481 | 482 |
482 @override | 483 @override |
483 Script copyWithFile(SourceFile file) { | 484 Script copyWithFile(SourceFile file) { |
484 throw new UnsupportedError('ScriptZ.copyWithFile'); | 485 throw new UnsupportedError('ScriptZ.copyWithFile'); |
485 } | 486 } |
486 | 487 |
487 @override | 488 @override |
488 SourceFile get file => throw new UnsupportedError('ScriptZ.file'); | 489 SourceFile get file { |
| 490 if (_file == null) { |
| 491 throw new UnsupportedError('ScriptZ.file'); |
| 492 } |
| 493 return _file; |
| 494 } |
| 495 |
| 496 void set file(SourceFile value) { |
| 497 _file = value; |
| 498 } |
489 | 499 |
490 @override | 500 @override |
491 bool get isSynthesized => throw new UnsupportedError('ScriptZ.isSynthesized'); | 501 bool get isSynthesized => throw new UnsupportedError('ScriptZ.isSynthesized'); |
492 | 502 |
493 @override | 503 @override |
494 String get name => resourceUri.toString(); | 504 String get name { |
| 505 if (_file != null) { |
| 506 return _file.filename; |
| 507 } |
| 508 return resourceUri.toString(); |
| 509 } |
495 | 510 |
496 // TODO(johnniwinther): Support the distinction between [readableUri] and | 511 // TODO(johnniwinther): Support the distinction between [readableUri] and |
497 // [resourceUri]; needed for platform libraries. | 512 // [resourceUri]; needed for platform libraries. |
498 @override | 513 @override |
499 Uri get readableUri => resourceUri; | 514 Uri get readableUri => resourceUri; |
500 | 515 |
501 @override | 516 @override |
502 String get text => throw new UnsupportedError('ScriptZ.text'); | 517 String get text { |
| 518 if (_file != null) { |
| 519 return _file.slowText(); |
| 520 } |
| 521 throw new UnsupportedError('ScriptZ.text'); |
| 522 } |
503 } | 523 } |
504 | 524 |
505 class CompilationUnitElementZ extends DeserializedElementZ | 525 class CompilationUnitElementZ extends DeserializedElementZ |
506 with LibraryMemberMixin, CompilationUnitElementCommon | 526 with LibraryMemberMixin, CompilationUnitElementCommon |
507 implements CompilationUnitElement { | 527 implements CompilationUnitElement { |
508 List<Element> _members; | 528 List<Element> _members; |
509 Script _script; | 529 Script _script; |
510 | 530 |
511 CompilationUnitElementZ(ObjectDecoder decoder) : super(decoder); | 531 CompilationUnitElementZ(ObjectDecoder decoder) : super(decoder); |
512 | 532 |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 } | 2009 } |
1990 | 2010 |
1991 @override | 2011 @override |
1992 ElementKind get kind => ElementKind.PREFIX; | 2012 ElementKind get kind => ElementKind.PREFIX; |
1993 | 2013 |
1994 @override | 2014 @override |
1995 Element lookupLocalMember(String memberName) { | 2015 Element lookupLocalMember(String memberName) { |
1996 return _unsupported('lookupLocalMember'); | 2016 return _unsupported('lookupLocalMember'); |
1997 } | 2017 } |
1998 } | 2018 } |
OLD | NEW |