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

Side by Side Diff: pkg/kernel/lib/binary/ast_from_binary.dart

Issue 2983413002: Resynthesize constructor initializers from Kernel. (Closed)
Patch Set: Created 3 years, 4 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 library kernel.ast_from_binary; 4 library kernel.ast_from_binary;
5 5
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../transformations/flags.dart'; 10 import '../transformations/flags.dart';
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 node.annotations = annotations; 619 node.annotations = annotations;
620 node.function = function; 620 node.function = function;
621 node.function?.parent = node; 621 node.function?.parent = node;
622 node.transformerFlags = transformerFlags; 622 node.transformerFlags = transformerFlags;
623 } 623 }
624 return node; 624 return node;
625 } 625 }
626 626
627 Initializer readInitializer() { 627 Initializer readInitializer() {
628 int tag = readByte(); 628 int tag = readByte();
629 bool isSynthetic = readByte() == 1;
629 switch (tag) { 630 switch (tag) {
630 case Tag.InvalidInitializer: 631 case Tag.InvalidInitializer:
631 return new InvalidInitializer(); 632 return new InvalidInitializer();
632 case Tag.FieldInitializer: 633 case Tag.FieldInitializer:
633 return new FieldInitializer.byReference( 634 var reference = readMemberReference();
634 readMemberReference(), readExpression()); 635 var value = readExpression();
636 return new FieldInitializer.byReference(reference, value)
637 ..isSynthetic = isSynthetic;
635 case Tag.SuperInitializer: 638 case Tag.SuperInitializer:
636 return new SuperInitializer.byReference( 639 var reference = readMemberReference();
637 readMemberReference(), readArguments()); 640 var arguments = readArguments();
641 return new SuperInitializer.byReference(reference, arguments)
642 ..isSynthetic = isSynthetic;
638 case Tag.RedirectingInitializer: 643 case Tag.RedirectingInitializer:
639 return new RedirectingInitializer.byReference( 644 return new RedirectingInitializer.byReference(
640 readMemberReference(), readArguments()); 645 readMemberReference(), readArguments());
641 case Tag.LocalInitializer: 646 case Tag.LocalInitializer:
642 return new LocalInitializer(readAndPushVariableDeclaration()); 647 return new LocalInitializer(readAndPushVariableDeclaration());
643 default: 648 default:
644 throw fail('Invalid initializer tag: $tag'); 649 throw fail('Invalid initializer tag: $tag');
645 } 650 }
646 } 651 }
647 652
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 ..fileOffset = offset 1247 ..fileOffset = offset
1243 ..fileEqualsOffset = fileEqualsOffset; 1248 ..fileEqualsOffset = fileEqualsOffset;
1244 } 1249 }
1245 1250
1246 int readOffset() { 1251 int readOffset() {
1247 // Offset is saved as unsigned, 1252 // Offset is saved as unsigned,
1248 // but actually ranges from -1 and up (thus the -1) 1253 // but actually ranges from -1 and up (thus the -1)
1249 return readUInt() - 1; 1254 return readUInt() - 1;
1250 } 1255 }
1251 } 1256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698