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

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

Issue 2780513004: [Kernel] Remove code from the old type propagation. (Closed)
Patch Set: Remove empty status file section Created 3 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
« no previous file with comments | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 String readStringReference() { 127 String readStringReference() {
128 return _stringTable[readUInt()]; 128 return _stringTable[readUInt()];
129 } 129 }
130 130
131 String readStringOrNullIfEmpty() { 131 String readStringOrNullIfEmpty() {
132 var string = readStringReference(); 132 var string = readStringReference();
133 return string.isEmpty ? null : string; 133 return string.isEmpty ? null : string;
134 } 134 }
135 135
136 InferredValue readOptionalInferredValue() {
137 if (readAndCheckOptionTag()) {
138 Reference baseClass = readClassReference(allowNull: true);
139 BaseClassKind baseClassKind = BaseClassKind.values[readByte()];
140 int valueBits = readByte();
141 return new InferredValue.byReference(baseClass, baseClassKind, valueBits);
142 }
143 return null;
144 }
145
146 bool readAndCheckOptionTag() { 136 bool readAndCheckOptionTag() {
147 int tag = readByte(); 137 int tag = readByte();
148 if (tag == Tag.Nothing) { 138 if (tag == Tag.Nothing) {
149 return false; 139 return false;
150 } else if (tag == Tag.Something) { 140 } else if (tag == Tag.Something) {
151 return true; 141 return true;
152 } else { 142 } else {
153 throw fail('Invalid Option tag: $tag'); 143 throw fail('Invalid Option tag: $tag');
154 } 144 }
155 } 145 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 node = new Field(null, reference: reference); 436 node = new Field(null, reference: reference);
447 } 437 }
448 int fileOffset = readOffset(); 438 int fileOffset = readOffset();
449 int fileEndOffset = readOffset(); 439 int fileEndOffset = readOffset();
450 int flags = readByte(); 440 int flags = readByte();
451 var name = readName(); 441 var name = readName();
452 var fileUri = readUriReference(); 442 var fileUri = readUriReference();
453 var annotations = readAnnotationList(node); 443 var annotations = readAnnotationList(node);
454 debugPath.add(node.name?.name ?? 'field'); 444 debugPath.add(node.name?.name ?? 'field');
455 var type = readDartType(); 445 var type = readDartType();
456 var inferredValue = readOptionalInferredValue();
457 var initializer = readExpressionOption(); 446 var initializer = readExpressionOption();
458 int transformerFlags = getAndResetTransformerFlags(); 447 int transformerFlags = getAndResetTransformerFlags();
459 debugPath.removeLast(); 448 debugPath.removeLast();
460 if (shouldWriteData) { 449 if (shouldWriteData) {
461 node.fileOffset = fileOffset; 450 node.fileOffset = fileOffset;
462 node.fileEndOffset = fileEndOffset; 451 node.fileEndOffset = fileEndOffset;
463 node.flags = flags; 452 node.flags = flags;
464 node.name = name; 453 node.name = name;
465 node.fileUri = fileUri; 454 node.fileUri = fileUri;
466 node.annotations = annotations; 455 node.annotations = annotations;
467 node.type = type; 456 node.type = type;
468 node.inferredValue = inferredValue;
469 node.initializer = initializer; 457 node.initializer = initializer;
470 node.initializer?.parent = node; 458 node.initializer?.parent = node;
471 node.transformerFlags = transformerFlags; 459 node.transformerFlags = transformerFlags;
472 } 460 }
473 return node; 461 return node;
474 } 462 }
475 463
476 Constructor readConstructor() { 464 Constructor readConstructor() {
477 int tag = readByte(); 465 int tag = readByte();
478 assert(tag == Tag.Constructor); 466 assert(tag == Tag.Constructor);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 int endOffset = readOffset(); 563 int endOffset = readOffset();
576 AsyncMarker asyncMarker = AsyncMarker.values[readByte()]; 564 AsyncMarker asyncMarker = AsyncMarker.values[readByte()];
577 AsyncMarker dartAsyncMarker = AsyncMarker.values[readByte()]; 565 AsyncMarker dartAsyncMarker = AsyncMarker.values[readByte()];
578 int typeParameterStackHeight = typeParameterStack.length; 566 int typeParameterStackHeight = typeParameterStack.length;
579 var typeParameters = readAndPushTypeParameterList(); 567 var typeParameters = readAndPushTypeParameterList();
580 var requiredParameterCount = readUInt(); 568 var requiredParameterCount = readUInt();
581 int variableStackHeight = variableStack.length; 569 int variableStackHeight = variableStack.length;
582 var positional = readAndPushVariableDeclarationList(); 570 var positional = readAndPushVariableDeclarationList();
583 var named = readAndPushVariableDeclarationList(); 571 var named = readAndPushVariableDeclarationList();
584 var returnType = readDartType(); 572 var returnType = readDartType();
585 var inferredReturnValue = readOptionalInferredValue();
586 int oldLabelStackBase = labelStackBase; 573 int oldLabelStackBase = labelStackBase;
587 labelStackBase = labelStack.length; 574 labelStackBase = labelStack.length;
588 var body = readStatementOption(); 575 var body = readStatementOption();
589 labelStackBase = oldLabelStackBase; 576 labelStackBase = oldLabelStackBase;
590 variableStack.length = variableStackHeight; 577 variableStack.length = variableStackHeight;
591 typeParameterStack.length = typeParameterStackHeight; 578 typeParameterStack.length = typeParameterStackHeight;
592 return new FunctionNode(body, 579 return new FunctionNode(body,
593 typeParameters: typeParameters, 580 typeParameters: typeParameters,
594 requiredParameterCount: requiredParameterCount, 581 requiredParameterCount: requiredParameterCount,
595 positionalParameters: positional, 582 positionalParameters: positional,
596 namedParameters: named, 583 namedParameters: named,
597 returnType: returnType, 584 returnType: returnType,
598 inferredReturnValue: inferredReturnValue,
599 asyncMarker: asyncMarker, 585 asyncMarker: asyncMarker,
600 dartAsyncMarker: dartAsyncMarker) 586 dartAsyncMarker: dartAsyncMarker)
601 ..fileOffset = offset 587 ..fileOffset = offset
602 ..fileEndOffset = endOffset; 588 ..fileEndOffset = endOffset;
603 } 589 }
604 590
605 void pushVariableDeclaration(VariableDeclaration variable) { 591 void pushVariableDeclaration(VariableDeclaration variable) {
606 variableStack.add(variable); 592 variableStack.add(variable);
607 } 593 }
608 594
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 variableStack.add(variable); 1106 variableStack.add(variable);
1121 return variable; 1107 return variable;
1122 } 1108 }
1123 1109
1124 VariableDeclaration readVariableDeclaration() { 1110 VariableDeclaration readVariableDeclaration() {
1125 int offset = readOffset(); 1111 int offset = readOffset();
1126 int fileEqualsOffset = readOffset(); 1112 int fileEqualsOffset = readOffset();
1127 int flags = readByte(); 1113 int flags = readByte();
1128 return new VariableDeclaration(readStringOrNullIfEmpty(), 1114 return new VariableDeclaration(readStringOrNullIfEmpty(),
1129 type: readDartType(), 1115 type: readDartType(),
1130 inferredValue: readOptionalInferredValue(),
1131 initializer: readExpressionOption(), 1116 initializer: readExpressionOption(),
1132 isFinal: flags & 0x1 != 0, 1117 isFinal: flags & 0x1 != 0,
1133 isConst: flags & 0x2 != 0) 1118 isConst: flags & 0x2 != 0)
1134 ..fileOffset = offset 1119 ..fileOffset = offset
1135 ..fileEqualsOffset = fileEqualsOffset; 1120 ..fileEqualsOffset = fileEqualsOffset;
1136 } 1121 }
1137 1122
1138 int readOffset() { 1123 int readOffset() {
1139 // Offset is saved as unsigned, 1124 // Offset is saved as unsigned,
1140 // but actually ranges from -1 and up (thus the -1) 1125 // but actually ranges from -1 and up (thus the -1)
1141 return readUInt() - 1; 1126 return readUInt() - 1;
1142 } 1127 }
1143 } 1128 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698