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

Side by Side Diff: pkg/compiler/lib/src/serialization/modelz.dart

Issue 2110323003: Support serialization of loadLibrary (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: dartfmt Created 4 years, 5 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 /// 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 @override 451 @override
452 String get libraryName { 452 String get libraryName {
453 return _decoder.getString(Key.LIBRARY_NAME); 453 return _decoder.getString(Key.LIBRARY_NAME);
454 } 454 }
455 455
456 @override 456 @override
457 bool get exportsHandled => true; 457 bool get exportsHandled => true;
458 458
459 void _ensureExports() { 459 void _ensureExports() {
460 if (_exportsMap == null) { 460 if (_exportsMap == null) {
461 _exportsMap = new ListedContainer(_decoder.getElements(Key.EXPORT_SCOPE)); 461 _exportsMap = new ListedContainer(
462 _decoder.getElements(Key.EXPORT_SCOPE, isOptional: true));
462 } 463 }
463 } 464 }
464 465
465 @override 466 @override
466 void forEachExport(f(Element element)) { 467 void forEachExport(f(Element element)) {
467 _ensureExports(); 468 _ensureExports();
468 _exportsMap.forEach(f); 469 _exportsMap.forEach(f);
469 } 470 }
470 471
471 @override 472 @override
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 Export get node => _unsupported('node'); 2251 Export get node => _unsupported('node');
2251 2252
2252 String toString() => 'Z$kind($uri)'; 2253 String toString() => 'Z$kind($uri)';
2253 } 2254 }
2254 2255
2255 class PrefixElementZ extends DeserializedElementZ 2256 class PrefixElementZ extends DeserializedElementZ
2256 with LibraryMemberMixin 2257 with LibraryMemberMixin
2257 implements PrefixElement { 2258 implements PrefixElement {
2258 bool _isDeferred; 2259 bool _isDeferred;
2259 ImportElement _deferredImport; 2260 ImportElement _deferredImport;
2261 GetterElement _loadLibrary;
2260 2262
2261 PrefixElementZ(ObjectDecoder decoder) : super(decoder); 2263 PrefixElementZ(ObjectDecoder decoder) : super(decoder);
2262 2264
2263 @override 2265 @override
2264 accept(ElementVisitor visitor, arg) => visitor.visitPrefixElement(this, arg); 2266 accept(ElementVisitor visitor, arg) => visitor.visitPrefixElement(this, arg);
2265 2267
2266 void _ensureDeferred() { 2268 void _ensureDeferred() {
2267 if (_isDeferred == null) { 2269 if (_isDeferred == null) {
2268 _isDeferred = _decoder.getBool(Key.IS_DEFERRED); 2270 _isDeferred = _decoder.getBool(Key.IS_DEFERRED);
2269 _deferredImport = _decoder.getElement(Key.IMPORT, isOptional: true); 2271 if (_isDeferred) {
2272 _deferredImport = _decoder.getElement(Key.IMPORT);
2273 _loadLibrary = _decoder.getElement(Key.GETTER);
2274 }
2270 } 2275 }
2271 } 2276 }
2272 2277
2273 @override 2278 @override
2274 ImportElement get deferredImport { 2279 ImportElement get deferredImport {
2275 _ensureDeferred(); 2280 _ensureDeferred();
2276 return _deferredImport; 2281 return _deferredImport;
2277 } 2282 }
2278 2283
2279 @override 2284 @override
2280 bool get isDeferred { 2285 bool get isDeferred {
2281 _ensureDeferred(); 2286 _ensureDeferred();
2282 return _isDeferred; 2287 return _isDeferred;
2283 } 2288 }
2284 2289
2285 @override 2290 @override
2291 GetterElement get loadLibrary {
2292 return _loadLibrary;
2293 }
2294
2295 @override
2286 ElementKind get kind => ElementKind.PREFIX; 2296 ElementKind get kind => ElementKind.PREFIX;
2287 2297
2288 @override 2298 @override
2289 Element lookupLocalMember(String memberName) { 2299 Element lookupLocalMember(String memberName) {
2290 return _unsupported('lookupLocalMember'); 2300 return _unsupported('lookupLocalMember');
2291 } 2301 }
2292 } 2302 }
2293 2303
2294 class MetadataAnnotationZ implements MetadataAnnotation { 2304 class MetadataAnnotationZ implements MetadataAnnotation {
2295 final Element annotatedElement; 2305 final Element annotatedElement;
2296 final SourceSpan sourcePosition; 2306 final SourceSpan sourcePosition;
2297 final ConstantExpression constant; 2307 final ConstantExpression constant;
2298 2308
2299 MetadataAnnotationZ( 2309 MetadataAnnotationZ(
2300 this.annotatedElement, this.sourcePosition, this.constant); 2310 this.annotatedElement, this.sourcePosition, this.constant);
2301 2311
2302 @override 2312 @override
2303 MetadataAnnotation ensureResolved(Resolution resolution) { 2313 MetadataAnnotation ensureResolved(Resolution resolution) {
2304 // Do nothing. 2314 // Do nothing.
2305 } 2315 }
2306 2316
2307 @override 2317 @override
2308 Node get node => throw new UnsupportedError('${this}.node'); 2318 Node get node => throw new UnsupportedError('${this}.node');
2309 2319
2310 @override 2320 @override
2311 bool get hasNode => false; 2321 bool get hasNode => false;
2312 2322
2313 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; 2323 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})';
2314 } 2324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698