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

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

Issue 1901683002: Support deserialization of ResolutionImpact for members of unnamed mixin applications (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 dart2js.serialization.util; 5 library dart2js.serialization.util;
6 6
7 import '../common.dart';
7 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
8 import '../dart_types.dart'; 9 import '../dart_types.dart';
9 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
10 import '../resolution/access_semantics.dart'; 11 import '../resolution/access_semantics.dart';
11 import '../resolution/operators.dart'; 12 import '../resolution/operators.dart';
12 import '../resolution/send_structure.dart'; 13 import '../resolution/send_structure.dart';
13 import '../universe/call_structure.dart'; 14 import '../universe/call_structure.dart';
14 import '../universe/selector.dart'; 15 import '../universe/selector.dart';
15 import 'keys.dart'; 16 import 'keys.dart';
16 import 'serialization.dart'; 17 import 'serialization.dart';
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 case AccessKind.COMPOUND: 468 case AccessKind.COMPOUND:
468 CompoundAccessKind compoundAccessKind = 469 CompoundAccessKind compoundAccessKind =
469 decoder.getEnum(Key.SUB_KIND, CompoundAccessKind.values); 470 decoder.getEnum(Key.SUB_KIND, CompoundAccessKind.values);
470 Element getter = decoder.getElement(Key.GETTER); 471 Element getter = decoder.getElement(Key.GETTER);
471 Element setter = decoder.getElement(Key.SETTER); 472 Element setter = decoder.getElement(Key.SETTER);
472 return new CompoundAccessSemantics(compoundAccessKind, getter, setter); 473 return new CompoundAccessSemantics(compoundAccessKind, getter, setter);
473 case AccessKind.CONSTANT: 474 case AccessKind.CONSTANT:
474 throw new UnsupportedError('Unsupported access kind: $kind'); 475 throw new UnsupportedError('Unsupported access kind: $kind');
475 } 476 }
476 } 477 }
478
479 /// Serialize a reference from [context] to an [element] which might be a member
480 /// of an unnamed mixin application. If it is, [element] is by serialized
481 /// indirectly by name in the [nameKey] of [encoder], otherwise [element] is
482 /// serialized directly in [elementKey] in [encoder].
483 void serializeElementReference(Element context, Key elementKey, Key nameKey,
484 ObjectEncoder encoder, Element element) {
485 if (element.isGenerativeConstructor &&
486 element.enclosingClass.isUnnamedMixinApplication) {
487 assert(invariant(element, element.isConstructor,
488 message: "Unexpected reference of forwarding constructor "
489 "${element} from $context."));
490 encoder.setString(nameKey, element.name);
491 } else {
492 encoder.setElement(elementKey, element);
493 }
494 }
495
496 /// Deserialize a reference from [context] to an [Element] which might be a
497 /// member of an unnamed mixin application. If it is, the [Element] is by
498 /// deserialized indirectly by name from [nameKey] in [decoder], otherwise
499 /// the [Element] is deserialized directly from [elementKey] in [encoder].
500 Element deserializeElementReference(
501 Element context, Key elementKey, Key nameKey, ObjectDecoder decoder,
502 {bool isOptional: false}) {
503 Element element = decoder.getElement(elementKey, isOptional: true);
504 if (element == null) {
505 String elementName = decoder.getString(nameKey, isOptional: isOptional);
506 if (elementName == null) {
507 return null;
508 }
509 assert(invariant(NO_LOCATION_SPANNABLE, context.isConstructor,
510 message: "Unexpected reference of forwarding constructor "
511 "'${elementName}' from $context."));
512 ClassElement superclass = context.enclosingClass.superclass;
513 element = superclass.lookupConstructor(elementName);
514 assert(invariant(NO_LOCATION_SPANNABLE, element != null,
515 message: "Unresolved reference of forwarding constructor "
516 "'${elementName}' from $context."));
517 }
518 return element;
519 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart ('k') | pkg/compiler/lib/src/serialization/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698