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

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

Issue 2941033002: Finish strong mode cleaning of dart2js. (Closed)
Patch Set: Created 3 years, 6 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 library dart2js.serialization.constants; 5 library dart2js.serialization.constants;
6 6
7 import '../constants/constructors.dart'; 7 import '../constants/constructors.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../elements/elements.dart' 9 import '../elements/elements.dart'
10 show ConstructorElement, FieldElement, LocalVariableElement, MethodElement; 10 show ConstructorElement, FieldElement, LocalVariableElement, MethodElement;
11 import '../elements/entities.dart' show FieldEntity;
11 import '../elements/operators.dart'; 12 import '../elements/operators.dart';
12 import '../elements/resolution_types.dart'; 13 import '../elements/resolution_types.dart';
13 import '../universe/call_structure.dart' show CallStructure; 14 import '../universe/call_structure.dart' show CallStructure;
14 import 'keys.dart'; 15 import 'keys.dart';
15 import 'serialization.dart'; 16 import 'serialization.dart';
16 17
17 /// Visitor that serializes a [ConstantExpression] by encoding it into an 18 /// Visitor that serializes a [ConstantExpression] by encoding it into an
18 /// [ObjectEncoder]. 19 /// [ObjectEncoder].
19 /// 20 ///
20 /// This class is called from the [Serializer] when a [ConstantExpression] needs 21 /// This class is called from the [Serializer] when a [ConstantExpression] needs
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 @override 319 @override
319 void visitGenerative( 320 void visitGenerative(
320 GenerativeConstantConstructor constructor, ObjectEncoder encoder) { 321 GenerativeConstantConstructor constructor, ObjectEncoder encoder) {
321 ResolutionInterfaceType type = constructor.type; 322 ResolutionInterfaceType type = constructor.type;
322 encoder.setType(Key.TYPE, type); 323 encoder.setType(Key.TYPE, type);
323 MapEncoder defaults = encoder.createMap(Key.DEFAULTS); 324 MapEncoder defaults = encoder.createMap(Key.DEFAULTS);
324 constructor.defaultValues.forEach((key, e) { 325 constructor.defaultValues.forEach((key, e) {
325 defaults.setConstant('$key', e); 326 defaults.setConstant('$key', e);
326 }); 327 });
327 ListEncoder fields = encoder.createList(Key.FIELDS); 328 ListEncoder fields = encoder.createList(Key.FIELDS);
328 constructor.fieldMap.forEach((FieldElement f, ConstantExpression e) { 329 constructor.fieldMap.forEach((FieldEntity _f, ConstantExpression e) {
330 FieldElement f = _f;
329 ObjectEncoder fieldSerializer = fields.createObject(); 331 ObjectEncoder fieldSerializer = fields.createObject();
330 fieldSerializer.setElement(Key.FIELD, f); 332 fieldSerializer.setElement(Key.FIELD, f);
331 fieldSerializer.setConstant(Key.CONSTANT, e); 333 fieldSerializer.setConstant(Key.CONSTANT, e);
332 }); 334 });
333 if (constructor.superConstructorInvocation != null) { 335 if (constructor.superConstructorInvocation != null) {
334 encoder.setConstant( 336 encoder.setConstant(
335 Key.CONSTRUCTOR, constructor.superConstructorInvocation); 337 Key.CONSTRUCTOR, constructor.superConstructorInvocation);
336 } 338 }
337 } 339 }
338 340
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 type, readDefaults(), readFields(), readConstructorInvocation()); 420 type, readDefaults(), readFields(), readConstructorInvocation());
419 case ConstantConstructorKind.REDIRECTING_GENERATIVE: 421 case ConstantConstructorKind.REDIRECTING_GENERATIVE:
420 return new RedirectingGenerativeConstantConstructor( 422 return new RedirectingGenerativeConstantConstructor(
421 readDefaults(), readConstructorInvocation()); 423 readDefaults(), readConstructorInvocation());
422 case ConstantConstructorKind.REDIRECTING_FACTORY: 424 case ConstantConstructorKind.REDIRECTING_FACTORY:
423 return new RedirectingFactoryConstantConstructor( 425 return new RedirectingFactoryConstantConstructor(
424 readConstructorInvocation()); 426 readConstructorInvocation());
425 } 427 }
426 } 428 }
427 } 429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698