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

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

Issue 2620363002: Introduce LibraryEntity (Closed)
Patch Set: Created 3 years, 11 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 '../common.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../elements/resolution_types.dart'; 9 import '../elements/resolution_types.dart';
10 import '../diagnostics/messages.dart'; 10 import '../diagnostics/messages.dart';
11 import '../elements/elements.dart'; 11 import '../elements/elements.dart';
12 import '../elements/modelx.dart' show WrappedMessage; 12 import '../elements/modelx.dart' show WrappedMessage;
13 import '../resolution/access_semantics.dart'; 13 import '../resolution/access_semantics.dart';
14 import '../resolution/operators.dart'; 14 import '../resolution/operators.dart';
15 import '../resolution/send_structure.dart'; 15 import '../resolution/send_structure.dart';
16 import '../universe/call_structure.dart'; 16 import '../universe/call_structure.dart';
17 import '../universe/selector.dart'; 17 import '../universe/selector.dart';
18 import 'keys.dart'; 18 import 'keys.dart';
19 import 'serialization.dart'; 19 import 'serialization.dart';
20 20
21 /// Serialize [name] into [encoder]. 21 /// Serialize [name] into [encoder].
22 void serializeName(Name name, ObjectEncoder encoder) { 22 void serializeName(Name name, ObjectEncoder encoder) {
23 encoder.setString(Key.NAME, name.text); 23 encoder.setString(Key.NAME, name.text);
24 encoder.setBool(Key.IS_SETTER, name.isSetter); 24 encoder.setBool(Key.IS_SETTER, name.isSetter);
25 if (name.library != null) { 25 if (name.library != null) {
26 encoder.setElement(Key.LIBRARY, name.library); 26 LibraryElement library = name.library;
27 encoder.setElement(Key.LIBRARY, library);
27 } 28 }
28 } 29 }
29 30
30 /// Deserialize a [Name] from [decoder]. 31 /// Deserialize a [Name] from [decoder].
31 Name deserializeName(ObjectDecoder decoder) { 32 Name deserializeName(ObjectDecoder decoder) {
32 String name = decoder.getString(Key.NAME); 33 String name = decoder.getString(Key.NAME);
33 bool isSetter = decoder.getBool(Key.IS_SETTER); 34 bool isSetter = decoder.getBool(Key.IS_SETTER);
34 LibraryElement library = decoder.getElement(Key.LIBRARY, isOptional: true); 35 LibraryElement library = decoder.getElement(Key.LIBRARY, isOptional: true);
35 return new Name(name, library, isSetter: isSetter); 36 return new Name(name, library, isSetter: isSetter);
36 } 37 }
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 ObjectDecoder sourceSpanDecoder = 582 ObjectDecoder sourceSpanDecoder =
582 object.getObject(Key.SOURCE_SPAN, isOptional: true); 583 object.getObject(Key.SOURCE_SPAN, isOptional: true);
583 if (sourceSpanDecoder != null) { 584 if (sourceSpanDecoder != null) {
584 sourceSpan = deserializeSourceSpan(sourceSpanDecoder); 585 sourceSpan = deserializeSourceSpan(sourceSpanDecoder);
585 } 586 }
586 MessageKind messageKind = object.getEnum(Key.KIND, MessageKind.values); 587 MessageKind messageKind = object.getEnum(Key.KIND, MessageKind.values);
587 Map<String, dynamic> messageArguments = 588 Map<String, dynamic> messageArguments =
588 deserializeMessageArguments(object, Key.ARGUMENTS); 589 deserializeMessageArguments(object, Key.ARGUMENTS);
589 return new WrappedMessage(sourceSpan, messageKind, messageArguments); 590 return new WrappedMessage(sourceSpan, messageKind, messageArguments);
590 } 591 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698