mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:01:19 +00:00
[dart2js] Refactor serialization/deserialization implementations (6/6)
Rename DataSource -> DataSourceReader and SourceReader -> DataSource to more accurately reflect these classes' new roles. 'Writer' and 'Reader' are used for the higher level class that composes serialization operations. The 'Sink' and 'Source' handle the low-level conversions to/from the storage format. Change-Id: I384b5f134beb040676f8e1ef4fba056e0c40358f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238243 Reviewed-by: Joshua Litt <joshualitt@google.com> Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
This commit is contained in:
parent
f0b1143bc6
commit
49c1a91587
|
@ -16,11 +16,11 @@ import 'serialization/serialization.dart';
|
|||
abstract class ClosureData {
|
||||
/// Deserializes a [ClosureData] object from [source].
|
||||
factory ClosureData.readFromDataSource(
|
||||
JsToElementMap elementMap, DataSource source) =
|
||||
JsToElementMap elementMap, DataSourceReader source) =
|
||||
ClosureDataImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [ClosureData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Look up information about the variables that have been mutated and are
|
||||
/// used inside the scope of [node].
|
||||
|
@ -66,7 +66,7 @@ class ScopeInfo {
|
|||
const ScopeInfo();
|
||||
|
||||
/// Deserializes a [ScopeInfo] object from [source].
|
||||
factory ScopeInfo.readFromDataSource(DataSource source) {
|
||||
factory ScopeInfo.readFromDataSource(DataSourceReader source) {
|
||||
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
|
||||
switch (kind) {
|
||||
case ScopeInfoKind.scopeInfo:
|
||||
|
@ -82,7 +82,7 @@ class ScopeInfo {
|
|||
}
|
||||
|
||||
/// Serializes this [ScopeInfo] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
throw UnsupportedError('${runtimeType}.writeToDataSink');
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class CapturedScope extends ScopeInfo {
|
|||
const CapturedScope();
|
||||
|
||||
/// Deserializes a [CapturedScope] object from [source].
|
||||
factory CapturedScope.readFromDataSource(DataSource source) {
|
||||
factory CapturedScope.readFromDataSource(DataSourceReader source) {
|
||||
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
|
||||
switch (kind) {
|
||||
case ScopeInfoKind.scopeInfo:
|
||||
|
@ -173,7 +173,7 @@ class CapturedLoopScope extends CapturedScope {
|
|||
const CapturedLoopScope();
|
||||
|
||||
/// Deserializes a [CapturedLoopScope] object from [source].
|
||||
factory CapturedLoopScope.readFromDataSource(DataSource source) {
|
||||
factory CapturedLoopScope.readFromDataSource(DataSourceReader source) {
|
||||
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
|
||||
switch (kind) {
|
||||
case ScopeInfoKind.scopeInfo:
|
||||
|
@ -241,7 +241,8 @@ class ClosureRepresentationInfo extends ScopeInfo {
|
|||
const ClosureRepresentationInfo();
|
||||
|
||||
/// Deserializes a [ClosureRepresentationInfo] object from [source].
|
||||
factory ClosureRepresentationInfo.readFromDataSource(DataSource source) {
|
||||
factory ClosureRepresentationInfo.readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
|
||||
switch (kind) {
|
||||
case ScopeInfoKind.scopeInfo:
|
||||
|
|
|
@ -40,10 +40,10 @@ import '../world.dart';
|
|||
class CodegenImpact extends WorldImpact {
|
||||
const CodegenImpact();
|
||||
|
||||
factory CodegenImpact.readFromDataSource(DataSource source) =
|
||||
factory CodegenImpact.readFromDataSource(DataSourceReader source) =
|
||||
_CodegenImpact.readFromDataSource;
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
throw UnsupportedError('CodegenImpact.writeToDataSink');
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact {
|
|||
this._oneShotInterceptors)
|
||||
: super.internal(dynamicUses, staticUses, typeUses, constantUses);
|
||||
|
||||
factory _CodegenImpact.readFromDataSource(DataSource source) {
|
||||
factory _CodegenImpact.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberEntity member = source.readMember();
|
||||
Set<DynamicUse> dynamicUses = source
|
||||
|
@ -165,7 +165,7 @@ class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMember(member);
|
||||
sink.writeList(dynamicUses, (DynamicUse use) => use.writeToDataSink(sink),
|
||||
|
@ -502,7 +502,7 @@ class CodegenResult {
|
|||
/// deserialization are collected in [modularNames] and [modularExpressions]
|
||||
/// to avoid the need for visiting the [code] node post deserialization.
|
||||
factory CodegenResult.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
List<ModularName> modularNames,
|
||||
List<ModularExpression> modularExpressions) {
|
||||
source.begin(tag);
|
||||
|
@ -517,7 +517,7 @@ class CodegenResult {
|
|||
/// The [modularNames] and [modularExpressions] fields are not directly
|
||||
/// serializes because these are embedded in the [code] node and collected
|
||||
/// through this during deserialization.
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeJsNodeOrNull(code);
|
||||
impact.writeToDataSink(sink);
|
||||
|
@ -635,7 +635,7 @@ class ModularName extends js.Name implements js.AstContainer {
|
|||
|
||||
ModularName(this.kind, {this.data, this.set});
|
||||
|
||||
factory ModularName.readFromDataSource(DataSource source) {
|
||||
factory ModularName.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ModularNameKind kind = source.readEnum(ModularNameKind.values);
|
||||
Object data;
|
||||
|
@ -678,7 +678,7 @@ class ModularName extends js.Name implements js.AstContainer {
|
|||
return ModularName(kind, data: data, set: set);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeEnum(kind);
|
||||
switch (kind) {
|
||||
|
@ -884,7 +884,7 @@ class ModularExpression extends js.DeferredExpression
|
|||
|
||||
ModularExpression(this.kind, this.data);
|
||||
|
||||
factory ModularExpression.readFromDataSource(DataSource source) {
|
||||
factory ModularExpression.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ModularExpressionKind kind = source.readEnum(ModularExpressionKind.values);
|
||||
Object data;
|
||||
|
@ -900,7 +900,7 @@ class ModularExpression extends js.DeferredExpression
|
|||
return ModularExpression(kind, data);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeEnum(kind);
|
||||
switch (kind) {
|
||||
|
@ -1107,13 +1107,13 @@ class JsNodeTags {
|
|||
static const String deferredHolderExpression = 'js-deferredHolderExpression';
|
||||
}
|
||||
|
||||
/// Visitor that serializes a [js.Node] into a [DataSink].
|
||||
/// Visitor that serializes a [js.Node] into a [DataSinkWriter].
|
||||
class JsNodeSerializer implements js.NodeVisitor<void> {
|
||||
final DataSink sink;
|
||||
final DataSinkWriter sink;
|
||||
|
||||
JsNodeSerializer._(this.sink);
|
||||
|
||||
static void writeToDataSink(DataSink sink, js.Node node) {
|
||||
static void writeToDataSink(DataSinkWriter sink, js.Node node) {
|
||||
sink.begin(JsNodeTags.tag);
|
||||
JsNodeSerializer serializer = JsNodeSerializer._(sink);
|
||||
serializer.visit(node);
|
||||
|
@ -1775,19 +1775,19 @@ class JsNodeSerializer implements js.NodeVisitor<void> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Helper class that deserializes a [js.Node] from [DataSource].
|
||||
/// Helper class that deserializes a [js.Node] from [DataSourceReader].
|
||||
///
|
||||
/// Deserialized [ModularName]s and [ModularExpression]s are collected in the
|
||||
/// [modularNames] and [modularExpressions] lists.
|
||||
class JsNodeDeserializer {
|
||||
final DataSource source;
|
||||
final DataSourceReader source;
|
||||
final List<ModularName> modularNames;
|
||||
final List<ModularExpression> modularExpressions;
|
||||
|
||||
JsNodeDeserializer._(this.source, this.modularNames, this.modularExpressions);
|
||||
|
||||
static js.Node readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
List<ModularName> modularNames,
|
||||
List<ModularExpression> modularExpressions) {
|
||||
source.begin(JsNodeTags.tag);
|
||||
|
@ -2229,24 +2229,24 @@ class CodegenReaderImpl implements CodegenReader {
|
|||
this.closedWorld, this.modularNames, this.modularExpressions);
|
||||
|
||||
@override
|
||||
AbstractValue readAbstractValue(DataSource source) {
|
||||
AbstractValue readAbstractValue(DataSourceReader source) {
|
||||
return closedWorld.abstractValueDomain
|
||||
.readAbstractValueFromDataSource(source);
|
||||
}
|
||||
|
||||
@override
|
||||
js.Node readJsNode(DataSource source) {
|
||||
js.Node readJsNode(DataSourceReader source) {
|
||||
return JsNodeDeserializer.readFromDataSource(
|
||||
source, modularNames, modularExpressions);
|
||||
}
|
||||
|
||||
@override
|
||||
OutputUnit readOutputUnitReference(DataSource source) {
|
||||
OutputUnit readOutputUnitReference(DataSourceReader source) {
|
||||
return closedWorld.outputUnitData.outputUnits[source.readInt()];
|
||||
}
|
||||
|
||||
@override
|
||||
TypeRecipe readTypeRecipe(DataSource source) {
|
||||
TypeRecipe readTypeRecipe(DataSourceReader source) {
|
||||
return TypeRecipe.readFromDataSource(source);
|
||||
}
|
||||
}
|
||||
|
@ -2257,22 +2257,22 @@ class CodegenWriterImpl implements CodegenWriter {
|
|||
CodegenWriterImpl(this.closedWorld);
|
||||
|
||||
@override
|
||||
void writeAbstractValue(DataSink sink, AbstractValue value) {
|
||||
void writeAbstractValue(DataSinkWriter sink, AbstractValue value) {
|
||||
closedWorld.abstractValueDomain.writeAbstractValueToDataSink(sink, value);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeJsNode(DataSink sink, js.Node node) {
|
||||
void writeJsNode(DataSinkWriter sink, js.Node node) {
|
||||
JsNodeSerializer.writeToDataSink(sink, node);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeOutputUnitReference(DataSink sink, OutputUnit value) {
|
||||
void writeOutputUnitReference(DataSinkWriter sink, OutputUnit value) {
|
||||
sink.writeInt(closedWorld.outputUnitData.outputUnits.indexOf(value));
|
||||
}
|
||||
|
||||
@override
|
||||
void writeTypeRecipe(DataSink sink, TypeRecipe recipe) {
|
||||
void writeTypeRecipe(DataSinkWriter sink, TypeRecipe recipe) {
|
||||
recipe.writeToDataSink(sink);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ class OutputUnitData {
|
|||
}
|
||||
|
||||
/// Deserializes an [OutputUnitData] object from [source].
|
||||
factory OutputUnitData.readFromDataSource(DataSource source) {
|
||||
factory OutputUnitData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
bool isProgramSplit = source.readBool();
|
||||
List<OutputUnit> outputUnits = source.readList(() {
|
||||
|
@ -205,7 +205,7 @@ class OutputUnitData {
|
|||
}
|
||||
|
||||
/// Serializes this [OutputUnitData] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeBool(isProgramSplit);
|
||||
Map<OutputUnit, int> outputUnitIndices = {};
|
||||
|
|
|
@ -350,7 +350,7 @@ class ParameterStructure {
|
|||
}
|
||||
|
||||
/// Deserializes a [ParameterStructure] object from [source].
|
||||
factory ParameterStructure.readFromDataSource(DataSource source) {
|
||||
factory ParameterStructure.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
int requiredPositionalParameters = source.readInt();
|
||||
int positionalParameters = source.readInt();
|
||||
|
@ -368,7 +368,7 @@ class ParameterStructure {
|
|||
}
|
||||
|
||||
/// Serializes this [ParameterStructure] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(requiredPositionalParameters);
|
||||
sink.writeInt(positionalParameters);
|
||||
|
|
|
@ -24,7 +24,7 @@ import 'entities.dart';
|
|||
/// implemented directly but other entity systems, for instance based directly
|
||||
/// on kernel ir without the need for [Element].
|
||||
|
||||
extension on DataSource {
|
||||
extension on DataSourceReader {
|
||||
List<DartType> _readDartTypes(
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
int count = readInt();
|
||||
|
@ -36,7 +36,7 @@ extension on DataSource {
|
|||
}
|
||||
}
|
||||
|
||||
extension on DataSink {
|
||||
extension on DataSinkWriter {
|
||||
void _writeDartTypes(
|
||||
List<DartType> types, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
writeInt(types.length);
|
||||
|
@ -49,8 +49,8 @@ extension on DataSink {
|
|||
abstract class DartType {
|
||||
const DartType();
|
||||
|
||||
factory DartType.readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory DartType.readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DartTypeKind kind = source.readEnum(DartTypeKind.values);
|
||||
switch (kind) {
|
||||
case DartTypeKind.none:
|
||||
|
@ -86,7 +86,7 @@ abstract class DartType {
|
|||
}
|
||||
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables);
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables);
|
||||
|
||||
/// Returns the base type if this is a [LegacyType] or [NullableType] and
|
||||
/// returns this type otherwise.
|
||||
|
@ -204,8 +204,8 @@ class LegacyType extends DartType {
|
|||
|
||||
const LegacyType._(this.baseType);
|
||||
|
||||
factory LegacyType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory LegacyType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DartType baseType =
|
||||
DartType.readFromDataSource(source, functionTypeVariables);
|
||||
return LegacyType._(baseType);
|
||||
|
@ -213,7 +213,7 @@ class LegacyType extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.legacyType);
|
||||
baseType.writeToDataSink(sink, functionTypeVariables);
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ class NullableType extends DartType {
|
|||
|
||||
const NullableType._(this.baseType);
|
||||
|
||||
factory NullableType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory NullableType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DartType baseType =
|
||||
DartType.readFromDataSource(source, functionTypeVariables);
|
||||
return NullableType._(baseType);
|
||||
|
@ -268,7 +268,7 @@ class NullableType extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.nullableType);
|
||||
baseType.writeToDataSink(sink, functionTypeVariables);
|
||||
}
|
||||
|
@ -321,8 +321,8 @@ class InterfaceType extends DartType {
|
|||
return InterfaceType._allocate(element, typeArguments);
|
||||
}
|
||||
|
||||
factory InterfaceType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory InterfaceType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
ClassEntity element = source.readClass();
|
||||
List<DartType> typeArguments = source._readDartTypes(functionTypeVariables);
|
||||
return InterfaceType._(element, typeArguments);
|
||||
|
@ -330,7 +330,7 @@ class InterfaceType extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.interfaceType);
|
||||
sink.writeClass(element);
|
||||
sink._writeDartTypes(typeArguments, functionTypeVariables);
|
||||
|
@ -393,15 +393,15 @@ class TypeVariableType extends DartType {
|
|||
|
||||
const TypeVariableType._(this.element);
|
||||
|
||||
factory TypeVariableType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory TypeVariableType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
TypeVariableEntity element = source.readTypeVariable();
|
||||
return TypeVariableType._(element);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.typeVariable);
|
||||
sink.writeTypeVariable(element);
|
||||
}
|
||||
|
@ -449,8 +449,8 @@ class FunctionTypeVariable extends DartType {
|
|||
|
||||
FunctionTypeVariable._(this.index);
|
||||
|
||||
factory FunctionTypeVariable._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory FunctionTypeVariable._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
int index = source.readInt();
|
||||
assert(0 <= index && index < functionTypeVariables.length);
|
||||
return functionTypeVariables[index];
|
||||
|
@ -458,7 +458,7 @@ class FunctionTypeVariable extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
int index = functionTypeVariables.indexOf(this);
|
||||
if (index == -1) {
|
||||
// TODO(johnniwinther): Avoid free variables.
|
||||
|
@ -498,14 +498,14 @@ class FunctionTypeVariable extends DartType {
|
|||
class NeverType extends DartType {
|
||||
const NeverType._();
|
||||
|
||||
factory NeverType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory NeverType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
return const NeverType._();
|
||||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.neverType);
|
||||
}
|
||||
|
||||
|
@ -526,13 +526,13 @@ class NeverType extends DartType {
|
|||
class VoidType extends DartType {
|
||||
const VoidType._();
|
||||
|
||||
factory VoidType._readFromDataSource(DataSource source,
|
||||
factory VoidType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) =>
|
||||
const VoidType._();
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.voidType);
|
||||
}
|
||||
|
||||
|
@ -553,13 +553,13 @@ class VoidType extends DartType {
|
|||
class DynamicType extends DartType {
|
||||
const DynamicType._();
|
||||
|
||||
factory DynamicType._readFromDataSource(DataSource source,
|
||||
factory DynamicType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) =>
|
||||
const DynamicType._();
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.dynamicType);
|
||||
}
|
||||
|
||||
|
@ -580,13 +580,13 @@ class DynamicType extends DartType {
|
|||
class ErasedType extends DartType {
|
||||
const ErasedType._();
|
||||
|
||||
factory ErasedType._readFromDataSource(DataSource source,
|
||||
factory ErasedType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) =>
|
||||
const ErasedType._();
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.erasedType);
|
||||
}
|
||||
|
||||
|
@ -618,13 +618,13 @@ class ErasedType extends DartType {
|
|||
class AnyType extends DartType {
|
||||
const AnyType._();
|
||||
|
||||
factory AnyType._readFromDataSource(DataSource source,
|
||||
factory AnyType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) =>
|
||||
const AnyType._();
|
||||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.anyType);
|
||||
}
|
||||
|
||||
|
@ -706,8 +706,8 @@ class FunctionType extends DartType {
|
|||
typeVariables);
|
||||
}
|
||||
|
||||
factory FunctionType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory FunctionType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
int typeVariableCount = source.readInt();
|
||||
List<FunctionTypeVariable> typeVariables =
|
||||
List<FunctionTypeVariable>.generate(
|
||||
|
@ -745,7 +745,7 @@ class FunctionType extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.functionType);
|
||||
functionTypeVariables = List<FunctionTypeVariable>.of(functionTypeVariables)
|
||||
..addAll(typeVariables);
|
||||
|
@ -851,8 +851,8 @@ class FutureOrType extends DartType {
|
|||
|
||||
const FutureOrType._(this.typeArgument);
|
||||
|
||||
factory FutureOrType._readFromDataSource(
|
||||
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
factory FutureOrType._readFromDataSource(DataSourceReader source,
|
||||
List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DartType typeArgument =
|
||||
DartType.readFromDataSource(source, functionTypeVariables);
|
||||
return FutureOrType._(typeArgument);
|
||||
|
@ -860,7 +860,7 @@ class FutureOrType extends DartType {
|
|||
|
||||
@override
|
||||
void writeToDataSink(
|
||||
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
DataSinkWriter sink, List<FunctionTypeVariable> functionTypeVariables) {
|
||||
sink.writeEnum(DartTypeKind.futureOr);
|
||||
typeArgument.writeToDataSink(sink, functionTypeVariables);
|
||||
}
|
||||
|
|
|
@ -632,8 +632,8 @@ abstract class AbstractValueDomain {
|
|||
String getCompactText(AbstractValue value);
|
||||
|
||||
/// Deserializes an [AbstractValue] for this domain from [source].
|
||||
AbstractValue readAbstractValueFromDataSource(DataSource source);
|
||||
AbstractValue readAbstractValueFromDataSource(DataSourceReader source);
|
||||
|
||||
/// Serializes this [value] for this domain to [sink].
|
||||
void writeAbstractValueToDataSink(DataSink sink, AbstractValue value);
|
||||
void writeAbstractValueToDataSink(DataSinkWriter sink, AbstractValue value);
|
||||
}
|
||||
|
|
|
@ -1354,7 +1354,7 @@ class KernelGlobalTypeInferenceElementData
|
|||
|
||||
/// Deserializes a [GlobalTypeInferenceElementData] object from [source].
|
||||
factory KernelGlobalTypeInferenceElementData.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
return source.inMemberContext(context, () {
|
||||
|
@ -1381,7 +1381,7 @@ class KernelGlobalTypeInferenceElementData
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
sink.inMemberContext(context, () {
|
||||
sink.begin(tag);
|
||||
|
|
|
@ -74,14 +74,14 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
//TODO(coam)
|
||||
@override
|
||||
void writeAbstractValueToDataSink(
|
||||
DataSink sink, covariant PowersetValue value) {
|
||||
DataSinkWriter sink, covariant PowersetValue value) {
|
||||
_abstractValueDomain.writeAbstractValueToDataSink(
|
||||
sink, value._abstractValue);
|
||||
}
|
||||
|
||||
//TODO(coam)
|
||||
@override
|
||||
AbstractValue readAbstractValueFromDataSource(DataSource source) {
|
||||
AbstractValue readAbstractValueFromDataSource(DataSourceReader source) {
|
||||
int powersetBits = _powersetBitsDomain.powersetTop;
|
||||
AbstractValue abstractValue =
|
||||
_abstractValueDomain.readAbstractValueFromDataSource(source);
|
||||
|
|
|
@ -58,13 +58,13 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
void writeAbstractValueToDataSink(
|
||||
DataSink sink, covariant WrappedAbstractValue value) {
|
||||
DataSinkWriter sink, covariant WrappedAbstractValue value) {
|
||||
_abstractValueDomain.writeAbstractValueToDataSink(
|
||||
sink, value._abstractValue);
|
||||
}
|
||||
|
||||
@override
|
||||
AbstractValue readAbstractValueFromDataSource(DataSource source) =>
|
||||
AbstractValue readAbstractValueFromDataSource(DataSourceReader source) =>
|
||||
WrappedAbstractValue(
|
||||
_abstractValueDomain.readAbstractValueFromDataSource(source));
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
AbstractValue get dynamicType => const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
void writeAbstractValueToDataSink(DataSink sink, AbstractValue value) {}
|
||||
void writeAbstractValueToDataSink(DataSinkWriter sink, AbstractValue value) {}
|
||||
|
||||
@override
|
||||
AbstractValue readAbstractValueFromDataSource(DataSource source) =>
|
||||
AbstractValue readAbstractValueFromDataSource(DataSourceReader source) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
|
|
|
@ -32,7 +32,7 @@ class ContainerTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Deserializes a [ContainerTypeMask] object from [source].
|
||||
factory ContainerTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
TypeMask forwardTo = TypeMask.readFromDataSource(source, domain);
|
||||
ir.TreeNode allocationNode = source.readTreeNodeOrNull();
|
||||
|
@ -46,7 +46,7 @@ class ContainerTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Serializes this [ContainerTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.container);
|
||||
sink.begin(tag);
|
||||
forwardTo.writeToDataSink(sink);
|
||||
|
|
|
@ -29,7 +29,7 @@ class DictionaryTypeMask extends MapTypeMask {
|
|||
|
||||
/// Deserializes a [DictionaryTypeMask] object from [source].
|
||||
factory DictionaryTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
TypeMask forwardTo = TypeMask.readFromDataSource(source, domain);
|
||||
ir.TreeNode allocationNode = source.readTreeNodeOrNull();
|
||||
|
@ -45,7 +45,7 @@ class DictionaryTypeMask extends MapTypeMask {
|
|||
|
||||
/// Serializes this [DictionaryTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.dictionary);
|
||||
sink.begin(tag);
|
||||
forwardTo.writeToDataSink(sink);
|
||||
|
|
|
@ -123,7 +123,7 @@ class FlatTypeMask extends TypeMask {
|
|||
|
||||
/// Deserializes a [FlatTypeMask] object from [source].
|
||||
factory FlatTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
ClassEntity base = source.readClassOrNull();
|
||||
int flags = source.readInt();
|
||||
|
@ -133,7 +133,7 @@ class FlatTypeMask extends TypeMask {
|
|||
|
||||
/// Serializes this [FlatTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.flat);
|
||||
sink.begin(tag);
|
||||
sink.writeClassOrNull(base);
|
||||
|
|
|
@ -32,7 +32,7 @@ class MapTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Deserializes a [MapTypeMask] object from [source].
|
||||
factory MapTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
TypeMask forwardTo = TypeMask.readFromDataSource(source, domain);
|
||||
ir.TreeNode allocationNode = source.readTreeNodeOrNull();
|
||||
|
@ -46,7 +46,7 @@ class MapTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Serializes this [MapTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.map);
|
||||
sink.begin(tag);
|
||||
forwardTo.writeToDataSink(sink);
|
||||
|
|
|
@ -974,13 +974,14 @@ class CommonMasks implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
TypeMask readAbstractValueFromDataSource(DataSource source) {
|
||||
TypeMask readAbstractValueFromDataSource(DataSourceReader source) {
|
||||
return source
|
||||
.readCached<TypeMask>(() => TypeMask.readFromDataSource(source, this));
|
||||
}
|
||||
|
||||
@override
|
||||
void writeAbstractValueToDataSink(DataSink sink, covariant TypeMask value) {
|
||||
void writeAbstractValueToDataSink(
|
||||
DataSinkWriter sink, covariant TypeMask value) {
|
||||
sink.writeCached<TypeMask>(
|
||||
value, (TypeMask value) => value.writeToDataSink(sink));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class SetTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Deserializes a [SetTypeMask] object from [source].
|
||||
factory SetTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
TypeMask forwardTo = TypeMask.readFromDataSource(source, domain);
|
||||
ir.TreeNode allocationNode = source.readTreeNodeOrNull();
|
||||
|
@ -42,7 +42,7 @@ class SetTypeMask extends AllocationTypeMask {
|
|||
|
||||
/// Serializes this [SetTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.set);
|
||||
sink.begin(tag);
|
||||
forwardTo.writeToDataSink(sink);
|
||||
|
|
|
@ -242,7 +242,8 @@ abstract class TypeMask implements AbstractValue {
|
|||
}
|
||||
|
||||
/// Deserializes a [TypeMask] object from [source].
|
||||
factory TypeMask.readFromDataSource(DataSource source, CommonMasks domain) {
|
||||
factory TypeMask.readFromDataSource(
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
TypeMaskKind kind = source.readEnum(TypeMaskKind.values);
|
||||
switch (kind) {
|
||||
case TypeMaskKind.flat:
|
||||
|
@ -264,7 +265,7 @@ abstract class TypeMask implements AbstractValue {
|
|||
}
|
||||
|
||||
/// Serializes this [TypeMask] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// If [mask] is forwarding, returns the first non-forwarding [TypeMask] in
|
||||
/// [mask]'s forwarding chain.
|
||||
|
|
|
@ -39,7 +39,7 @@ class UnionTypeMask extends TypeMask {
|
|||
|
||||
/// Deserializes a [UnionTypeMask] object from [source].
|
||||
factory UnionTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
List<FlatTypeMask> disjointMasks =
|
||||
source.readList(() => TypeMask.readFromDataSource(source, domain));
|
||||
|
@ -52,7 +52,7 @@ class UnionTypeMask extends TypeMask {
|
|||
|
||||
/// Serializes this [UnionTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.union);
|
||||
sink.begin(tag);
|
||||
sink.writeList(
|
||||
|
|
|
@ -17,7 +17,7 @@ class ValueTypeMask extends ForwardingTypeMask {
|
|||
|
||||
/// Deserializes a [ValueTypeMask] object from [source].
|
||||
factory ValueTypeMask.readFromDataSource(
|
||||
DataSource source, CommonMasks domain) {
|
||||
DataSourceReader source, CommonMasks domain) {
|
||||
source.begin(tag);
|
||||
TypeMask forwardTo = TypeMask.readFromDataSource(source, domain);
|
||||
ConstantValue constant = source.readConstant();
|
||||
|
@ -27,7 +27,7 @@ class ValueTypeMask extends ForwardingTypeMask {
|
|||
|
||||
/// Serializes this [ValueTypeMask] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(TypeMaskKind.value);
|
||||
sink.begin(tag);
|
||||
forwardTo.writeToDataSink(sink);
|
||||
|
|
|
@ -34,12 +34,14 @@ import '../inferrer/inferrer_engine.dart';
|
|||
/// based queries (the runtime value could be anything).
|
||||
abstract class GlobalTypeInferenceMemberResult {
|
||||
/// Deserializes a [GlobalTypeInferenceMemberResult] object from [source].
|
||||
factory GlobalTypeInferenceMemberResult.readFromDataSource(DataSource source,
|
||||
ir.Member context, AbstractValueDomain abstractValueDomain) =
|
||||
factory GlobalTypeInferenceMemberResult.readFromDataSource(
|
||||
DataSourceReader source,
|
||||
ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) =
|
||||
GlobalTypeInferenceMemberResultImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [GlobalTypeInferenceMemberResult] to [sink].
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain);
|
||||
|
||||
/// The inferred type when this result belongs to a field, null otherwise.
|
||||
|
@ -73,12 +75,14 @@ abstract class GlobalTypeInferenceMemberResult {
|
|||
/// a single element.
|
||||
abstract class GlobalTypeInferenceElementData {
|
||||
/// Deserializes a [GlobalTypeInferenceElementData] object from [source].
|
||||
factory GlobalTypeInferenceElementData.readFromDataSource(DataSource source,
|
||||
ir.Member context, AbstractValueDomain abstractValueDomain) =
|
||||
factory GlobalTypeInferenceElementData.readFromDataSource(
|
||||
DataSourceReader source,
|
||||
ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) =
|
||||
KernelGlobalTypeInferenceElementData.readFromDataSource;
|
||||
|
||||
/// Serializes this [GlobalTypeInferenceElementData] to [sink].
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain);
|
||||
|
||||
/// Compresses the inner representation by removing [AbstractValue] mappings
|
||||
|
@ -110,7 +114,7 @@ abstract class TypesInferrer {
|
|||
abstract class GlobalTypeInferenceResults {
|
||||
/// Deserializes a [GlobalTypeInferenceResults] object from [source].
|
||||
factory GlobalTypeInferenceResults.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
JsToElementMap elementMap,
|
||||
JClosedWorld closedWorld,
|
||||
GlobalLocalsMap globalLocalsMap,
|
||||
|
@ -124,7 +128,7 @@ abstract class GlobalTypeInferenceResults {
|
|||
}
|
||||
|
||||
/// Serializes this [GlobalTypeInferenceResults] to [sink].
|
||||
void writeToDataSink(DataSink sink, JsToElementMap elementMap);
|
||||
void writeToDataSink(DataSinkWriter sink, JsToElementMap elementMap);
|
||||
|
||||
JClosedWorld get closedWorld;
|
||||
|
||||
|
@ -239,7 +243,7 @@ class GlobalTypeInferenceResultsImpl implements GlobalTypeInferenceResults {
|
|||
_trivialParameterResult = closedWorld.abstractValueDomain.dynamicType;
|
||||
|
||||
factory GlobalTypeInferenceResultsImpl.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
JsToElementMap elementMap,
|
||||
JClosedWorld closedWorld,
|
||||
GlobalLocalsMap globalLocalsMap,
|
||||
|
@ -275,7 +279,7 @@ class GlobalTypeInferenceResultsImpl implements GlobalTypeInferenceResults {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, JsToElementMap elementMap) {
|
||||
void writeToDataSink(DataSinkWriter sink, JsToElementMap elementMap) {
|
||||
sink.writeBool(false); // Is _not_ trivial.
|
||||
sink.begin(tag);
|
||||
sink.writeMemberMap(
|
||||
|
@ -436,7 +440,7 @@ class GlobalTypeInferenceMemberResultImpl
|
|||
{this.throwsAlways, this.isCalledOnce});
|
||||
|
||||
factory GlobalTypeInferenceMemberResultImpl.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
source.begin(tag);
|
||||
|
@ -456,7 +460,7 @@ class GlobalTypeInferenceMemberResultImpl
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
sink.begin(tag);
|
||||
sink.writeValueOrNull(_data, (GlobalTypeInferenceElementData data) {
|
||||
|
@ -497,7 +501,7 @@ class TrivialGlobalTypeInferenceResults implements GlobalTypeInferenceResults {
|
|||
_trivialParameterResult = closedWorld.abstractValueDomain.dynamicType;
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, JsToElementMap elementMap) {
|
||||
void writeToDataSink(DataSinkWriter sink, JsToElementMap elementMap) {
|
||||
sink.writeBool(true); // Is trivial.
|
||||
}
|
||||
|
||||
|
@ -557,7 +561,7 @@ class TrivialGlobalTypeInferenceMemberResult
|
|||
bool get isCalledOnce => false;
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
throw UnsupportedError(
|
||||
"TrivialGlobalTypeInferenceMemberResult.writeToDataSink");
|
||||
|
@ -598,7 +602,7 @@ class DeadFieldGlobalTypeInferenceResult
|
|||
bool get isCalledOnce => false;
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
throw UnsupportedError(
|
||||
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
|
||||
|
@ -639,7 +643,7 @@ class DeadMethodGlobalTypeInferenceResult
|
|||
bool get isCalledOnce => false;
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink, ir.Member context,
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context,
|
||||
AbstractValueDomain abstractValueDomain) {
|
||||
throw UnsupportedError(
|
||||
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
|
||||
|
|
|
@ -33,7 +33,8 @@ class PositionSourceInformation extends SourceInformation {
|
|||
PositionSourceInformation(
|
||||
this.startPosition, this.innerPosition, this.inliningContext);
|
||||
|
||||
factory PositionSourceInformation.readFromDataSource(DataSource source) {
|
||||
factory PositionSourceInformation.readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
SourceLocation startPosition = source.readCached<SourceLocation>(
|
||||
() => SourceLocation.readFromDataSource(source));
|
||||
|
@ -47,7 +48,7 @@ class PositionSourceInformation extends SourceInformation {
|
|||
startPosition, innerPosition, inliningContext);
|
||||
}
|
||||
|
||||
void writeToDataSinkInternal(DataSink sink) {
|
||||
void writeToDataSinkInternal(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeCached(
|
||||
startPosition,
|
||||
|
|
|
@ -18,7 +18,7 @@ import 'position_information.dart';
|
|||
abstract class SourceInformation extends JavaScriptNodeSourceInformation {
|
||||
const SourceInformation();
|
||||
|
||||
static SourceInformation readFromDataSource(DataSource source) {
|
||||
static SourceInformation readFromDataSource(DataSourceReader source) {
|
||||
int hasSourceInformation = source.readInt();
|
||||
if (hasSourceInformation == 0) {
|
||||
return null;
|
||||
|
@ -31,7 +31,7 @@ abstract class SourceInformation extends JavaScriptNodeSourceInformation {
|
|||
}
|
||||
|
||||
static void writeToDataSink(
|
||||
DataSink sink, SourceInformation sourceInformation) {
|
||||
DataSinkWriter sink, SourceInformation sourceInformation) {
|
||||
if (sourceInformation == null) {
|
||||
sink.writeInt(0);
|
||||
} else if (sourceInformation is SourceMappedMarker) {
|
||||
|
@ -82,7 +82,7 @@ class FrameContext {
|
|||
|
||||
FrameContext(this.callInformation, this.inlinedMethodName);
|
||||
|
||||
factory FrameContext.readFromDataSource(DataSource source) {
|
||||
factory FrameContext.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
SourceInformation callInformation = source.readCached<SourceInformation>(
|
||||
() => SourceInformation.readFromDataSource(source));
|
||||
|
@ -91,7 +91,7 @@ class FrameContext {
|
|||
return FrameContext(callInformation, inlinedMethodName);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeCached<SourceInformation>(
|
||||
callInformation,
|
||||
|
@ -273,7 +273,7 @@ abstract class SourceLocation {
|
|||
/// The name associated with this source location, if any.
|
||||
String get sourceName;
|
||||
|
||||
static SourceLocation readFromDataSource(DataSource source) {
|
||||
static SourceLocation readFromDataSource(DataSourceReader source) {
|
||||
int hasSourceLocation = source.readInt();
|
||||
if (hasSourceLocation == 0) {
|
||||
return null;
|
||||
|
@ -292,7 +292,8 @@ abstract class SourceLocation {
|
|||
}
|
||||
}
|
||||
|
||||
static void writeToDataSink(DataSink sink, SourceLocation sourceLocation) {
|
||||
static void writeToDataSink(
|
||||
DataSinkWriter sink, SourceLocation sourceLocation) {
|
||||
if (sourceLocation == null) {
|
||||
sink.writeInt(0);
|
||||
} else if (sourceLocation is NoSourceLocationMarker) {
|
||||
|
|
|
@ -699,7 +699,7 @@ class ImpactBuilderData {
|
|||
ImpactBuilderData(this.node, this.impactData, this.typeMapsForTesting,
|
||||
this.cachedStaticTypes);
|
||||
|
||||
factory ImpactBuilderData.fromDataSource(DataSource source) {
|
||||
factory ImpactBuilderData.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
var node = source.readMemberNode();
|
||||
var data = ImpactData.fromDataSource(source);
|
||||
|
@ -708,7 +708,7 @@ class ImpactBuilderData {
|
|||
return ImpactBuilderData(node, data, const {}, cache);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
impactData.toDataSink(sink);
|
||||
|
|
|
@ -530,7 +530,7 @@ class ImpactData {
|
|||
|
||||
ImpactData();
|
||||
|
||||
ImpactData.fromDataSource(DataSource source) {
|
||||
ImpactData.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
_superInitializers = source.readList(
|
||||
() => _SuperInitializer.fromDataSource(source),
|
||||
|
@ -628,7 +628,7 @@ class ImpactData {
|
|||
source.end(tag);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
|
||||
sink.writeList(
|
||||
|
@ -1065,7 +1065,7 @@ class _CallStructure {
|
|||
typeArguments, positionalArguments, namedArguments);
|
||||
}
|
||||
|
||||
factory _CallStructure.fromDataSource(DataSource source) {
|
||||
factory _CallStructure.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
List<ir.DartType> typeArguments = source.readDartTypeNodes();
|
||||
int positionalArguments = source.readInt();
|
||||
|
@ -1075,7 +1075,7 @@ class _CallStructure {
|
|||
typeArguments, positionalArguments, namedArguments);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNodes(typeArguments);
|
||||
sink.writeInt(positionalArguments);
|
||||
|
@ -1093,7 +1093,7 @@ class _SuperInitializer {
|
|||
|
||||
_SuperInitializer(this.source, this.target, this.callStructure);
|
||||
|
||||
factory _SuperInitializer.fromDataSource(DataSource source) {
|
||||
factory _SuperInitializer.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Constructor sourceConstructor = source.readMemberNode();
|
||||
ir.Constructor targetConstructor = source.readMemberNode();
|
||||
|
@ -1103,7 +1103,7 @@ class _SuperInitializer {
|
|||
sourceConstructor, targetConstructor, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(source);
|
||||
sink.writeMemberNode(target);
|
||||
|
@ -1120,7 +1120,7 @@ class _SuperInvocation {
|
|||
|
||||
_SuperInvocation(this.target, this.callStructure);
|
||||
|
||||
factory _SuperInvocation.fromDataSource(DataSource source) {
|
||||
factory _SuperInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member member = source.readMemberNode();
|
||||
_CallStructure callStructure = _CallStructure.fromDataSource(source);
|
||||
|
@ -1128,7 +1128,7 @@ class _SuperInvocation {
|
|||
return _SuperInvocation(member, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(target);
|
||||
callStructure.toDataSink(sink);
|
||||
|
@ -1145,7 +1145,7 @@ class _InstanceAccess {
|
|||
|
||||
_InstanceAccess(this.receiverType, this.classRelation, this.target);
|
||||
|
||||
factory _InstanceAccess.fromDataSource(DataSource source) {
|
||||
factory _InstanceAccess.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType receiverType = source.readDartTypeNode();
|
||||
ClassRelation classRelation = source.readEnum(ClassRelation.values);
|
||||
|
@ -1154,7 +1154,7 @@ class _InstanceAccess {
|
|||
return _InstanceAccess(receiverType, classRelation, target);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(receiverType);
|
||||
sink.writeEnum(classRelation);
|
||||
|
@ -1172,7 +1172,7 @@ class _DynamicAccess {
|
|||
|
||||
_DynamicAccess(this.receiverType, this.classRelation, this.name);
|
||||
|
||||
factory _DynamicAccess.fromDataSource(DataSource source) {
|
||||
factory _DynamicAccess.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType receiverType = source.readDartTypeNode();
|
||||
ClassRelation classRelation = source.readEnum(ClassRelation.values);
|
||||
|
@ -1181,7 +1181,7 @@ class _DynamicAccess {
|
|||
return _DynamicAccess(receiverType, classRelation, name);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(receiverType);
|
||||
sink.writeEnum(classRelation);
|
||||
|
@ -1198,7 +1198,7 @@ class _FunctionInvocation {
|
|||
|
||||
_FunctionInvocation(this.receiverType, this.callStructure);
|
||||
|
||||
factory _FunctionInvocation.fromDataSource(DataSource source) {
|
||||
factory _FunctionInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType receiverType = source.readDartTypeNode();
|
||||
_CallStructure callStructure = _CallStructure.fromDataSource(source);
|
||||
|
@ -1206,7 +1206,7 @@ class _FunctionInvocation {
|
|||
return _FunctionInvocation(receiverType, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(receiverType);
|
||||
callStructure.toDataSink(sink);
|
||||
|
@ -1225,7 +1225,7 @@ class _InstanceInvocation {
|
|||
_InstanceInvocation(
|
||||
this.receiverType, this.classRelation, this.target, this.callStructure);
|
||||
|
||||
factory _InstanceInvocation.fromDataSource(DataSource source) {
|
||||
factory _InstanceInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType receiverType = source.readDartTypeNode();
|
||||
ClassRelation classRelation = source.readEnum(ClassRelation.values);
|
||||
|
@ -1236,7 +1236,7 @@ class _InstanceInvocation {
|
|||
receiverType, classRelation, target, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(receiverType);
|
||||
sink.writeEnum(classRelation);
|
||||
|
@ -1257,7 +1257,7 @@ class _DynamicInvocation {
|
|||
_DynamicInvocation(
|
||||
this.receiverType, this.classRelation, this.name, this.callStructure);
|
||||
|
||||
factory _DynamicInvocation.fromDataSource(DataSource source) {
|
||||
factory _DynamicInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType receiverType = source.readDartTypeNode();
|
||||
ClassRelation classRelation = source.readEnum(ClassRelation.values);
|
||||
|
@ -1267,7 +1267,7 @@ class _DynamicInvocation {
|
|||
return _DynamicInvocation(receiverType, classRelation, name, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(receiverType);
|
||||
sink.writeEnum(classRelation);
|
||||
|
@ -1285,7 +1285,7 @@ class _LocalFunctionInvocation {
|
|||
|
||||
_LocalFunctionInvocation(this.localFunction, this.callStructure);
|
||||
|
||||
factory _LocalFunctionInvocation.fromDataSource(DataSource source) {
|
||||
factory _LocalFunctionInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.FunctionDeclaration localFunction = source.readTreeNode();
|
||||
_CallStructure callStructure = _CallStructure.fromDataSource(source);
|
||||
|
@ -1293,7 +1293,7 @@ class _LocalFunctionInvocation {
|
|||
return _LocalFunctionInvocation(localFunction, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNode(localFunction);
|
||||
callStructure.toDataSink(sink);
|
||||
|
@ -1310,7 +1310,7 @@ class _StaticInvocation {
|
|||
|
||||
_StaticInvocation(this.target, this.callStructure, this.import);
|
||||
|
||||
factory _StaticInvocation.fromDataSource(DataSource source) {
|
||||
factory _StaticInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Procedure target = source.readMemberNode();
|
||||
_CallStructure callStructure = _CallStructure.fromDataSource(source);
|
||||
|
@ -1319,7 +1319,7 @@ class _StaticInvocation {
|
|||
return _StaticInvocation(target, callStructure, import);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(target);
|
||||
callStructure.toDataSink(sink);
|
||||
|
@ -1341,7 +1341,7 @@ class _ConstructorInvocation {
|
|||
this.constructor, this.type, this.callStructure, this.import,
|
||||
{this.isConst});
|
||||
|
||||
factory _ConstructorInvocation.fromDataSource(DataSource source) {
|
||||
factory _ConstructorInvocation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member constructor = source.readMemberNode();
|
||||
ir.InterfaceType type = source.readDartTypeNode();
|
||||
|
@ -1353,7 +1353,7 @@ class _ConstructorInvocation {
|
|||
isConst: isConst);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(constructor);
|
||||
sink.writeDartTypeNode(type);
|
||||
|
@ -1393,7 +1393,7 @@ class _TypeUse {
|
|||
|
||||
_TypeUse(this.type, this.kind);
|
||||
|
||||
factory _TypeUse.fromDataSource(DataSource source) {
|
||||
factory _TypeUse.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType type = source.readDartTypeNode();
|
||||
_TypeUseKind kind = source.readEnum(_TypeUseKind.values);
|
||||
|
@ -1401,7 +1401,7 @@ class _TypeUse {
|
|||
return _TypeUse(type, kind);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(type);
|
||||
sink.writeEnum(kind);
|
||||
|
@ -1428,7 +1428,7 @@ class _RedirectingInitializer {
|
|||
|
||||
_RedirectingInitializer(this.constructor, this.callStructure);
|
||||
|
||||
factory _RedirectingInitializer.fromDataSource(DataSource source) {
|
||||
factory _RedirectingInitializer.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Constructor constructor = source.readMemberNode();
|
||||
_CallStructure callStructure = _CallStructure.fromDataSource(source);
|
||||
|
@ -1436,7 +1436,7 @@ class _RedirectingInitializer {
|
|||
return _RedirectingInitializer(constructor, callStructure);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(constructor);
|
||||
callStructure.toDataSink(sink);
|
||||
|
@ -1452,7 +1452,7 @@ class _TypeLiteral {
|
|||
|
||||
_TypeLiteral(this.type, this.import);
|
||||
|
||||
factory _TypeLiteral.fromDataSource(DataSource source) {
|
||||
factory _TypeLiteral.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType type = source.readDartTypeNode();
|
||||
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
|
||||
|
@ -1460,7 +1460,7 @@ class _TypeLiteral {
|
|||
return _TypeLiteral(type, import);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(type);
|
||||
sink.writeLibraryDependencyNodeOrNull(import);
|
||||
|
@ -1476,7 +1476,7 @@ class _GenericInstantiation {
|
|||
|
||||
_GenericInstantiation(this.expressionType, this.typeArguments);
|
||||
|
||||
factory _GenericInstantiation.fromDataSource(DataSource source) {
|
||||
factory _GenericInstantiation.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.FunctionType expressionType = source.readDartTypeNode();
|
||||
List<ir.DartType> typeArguments = source.readDartTypeNodes();
|
||||
|
@ -1484,7 +1484,7 @@ class _GenericInstantiation {
|
|||
return _GenericInstantiation(expressionType, typeArguments);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(expressionType);
|
||||
sink.writeDartTypeNodes(typeArguments);
|
||||
|
@ -1500,7 +1500,7 @@ class _StaticAccess {
|
|||
|
||||
_StaticAccess(this.target, this.import);
|
||||
|
||||
factory _StaticAccess.fromDataSource(DataSource source) {
|
||||
factory _StaticAccess.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member target = source.readMemberNode();
|
||||
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
|
||||
|
@ -1508,7 +1508,7 @@ class _StaticAccess {
|
|||
return _StaticAccess(target, import);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(target);
|
||||
sink.writeLibraryDependencyNodeOrNull(import);
|
||||
|
@ -1526,7 +1526,7 @@ class _MapLiteral {
|
|||
|
||||
_MapLiteral(this.keyType, this.valueType, {this.isConst, this.isEmpty});
|
||||
|
||||
factory _MapLiteral.fromDataSource(DataSource source) {
|
||||
factory _MapLiteral.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType keyType = source.readDartTypeNode();
|
||||
ir.DartType valueType = source.readDartTypeNode();
|
||||
|
@ -1536,7 +1536,7 @@ class _MapLiteral {
|
|||
return _MapLiteral(keyType, valueType, isConst: isConst, isEmpty: isEmpty);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(keyType);
|
||||
sink.writeDartTypeNode(valueType);
|
||||
|
@ -1555,7 +1555,7 @@ class _ContainerLiteral {
|
|||
|
||||
_ContainerLiteral(this.elementType, {this.isConst, this.isEmpty});
|
||||
|
||||
factory _ContainerLiteral.fromDataSource(DataSource source) {
|
||||
factory _ContainerLiteral.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.DartType elementType = source.readDartTypeNode();
|
||||
bool isConst = source.readBool();
|
||||
|
@ -1564,7 +1564,7 @@ class _ContainerLiteral {
|
|||
return _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartTypeNode(elementType);
|
||||
sink.writeBool(isConst);
|
||||
|
@ -1585,7 +1585,7 @@ class _RuntimeTypeUse {
|
|||
|
||||
_RuntimeTypeUse(this.node, this.kind, this.receiverType, this.argumentType);
|
||||
|
||||
factory _RuntimeTypeUse.fromDataSource(DataSource source) {
|
||||
factory _RuntimeTypeUse.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.TreeNode node = source.readTreeNode();
|
||||
RuntimeTypeUseKind kind = source.readEnum(RuntimeTypeUseKind.values);
|
||||
|
@ -1595,7 +1595,7 @@ class _RuntimeTypeUse {
|
|||
return _RuntimeTypeUse(node, kind, receiverType, argumentType);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNode(node);
|
||||
sink.writeEnum(kind);
|
||||
|
|
|
@ -54,7 +54,7 @@ class ModuleData {
|
|||
|
||||
ModuleData(this.impactData);
|
||||
|
||||
factory ModuleData.fromDataSource(DataSource source) {
|
||||
factory ModuleData.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
var impactData = source
|
||||
.readMemberNodeMap(() => ImpactBuilderData.fromDataSource(source));
|
||||
|
@ -62,7 +62,7 @@ class ModuleData {
|
|||
return ModuleData(impactData);
|
||||
}
|
||||
|
||||
void toDataSink(DataSink sink) {
|
||||
void toDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNodeMap<ImpactBuilderData>(
|
||||
impactData, (e) => e.toDataSink(sink));
|
||||
|
|
|
@ -16,7 +16,7 @@ class StaticTypeCache {
|
|||
[this._expressionTypes = const {}, this._forInIteratorTypes]);
|
||||
|
||||
factory StaticTypeCache.readFromDataSource(
|
||||
DataSource source, ir.Member context) {
|
||||
DataSourceReader source, ir.Member context) {
|
||||
return source.inMemberContext(context, () {
|
||||
source.begin(tag);
|
||||
Map<ir.Expression, ir.DartType> expressionTypes =
|
||||
|
@ -28,7 +28,7 @@ class StaticTypeCache {
|
|||
});
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink, ir.Member context) {
|
||||
void writeToDataSink(DataSinkWriter sink, ir.Member context) {
|
||||
sink.inMemberContext(context, () {
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNodeMapInContext(_expressionTypes, sink.writeDartTypeNode);
|
||||
|
|
|
@ -256,11 +256,11 @@ EnumSet<PragmaAnnotation> processMemberAnnotations(
|
|||
abstract class AnnotationsData {
|
||||
/// Deserializes a [AnnotationsData] object from [source].
|
||||
factory AnnotationsData.readFromDataSource(
|
||||
CompilerOptions options, DataSource source) =
|
||||
CompilerOptions options, DataSourceReader source) =
|
||||
AnnotationsDataImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [AnnotationsData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns `true` if [member] has an `@pragma('dart2js:assumeDynamic')`
|
||||
/// annotation.
|
||||
|
@ -356,7 +356,7 @@ class AnnotationsDataImpl implements AnnotationsData {
|
|||
options.defaultIndexBoundsCheckPolicy;
|
||||
|
||||
factory AnnotationsDataImpl.readFromDataSource(
|
||||
CompilerOptions options, DataSource source) {
|
||||
CompilerOptions options, DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Map<MemberEntity, EnumSet<PragmaAnnotation>> pragmaAnnotations =
|
||||
source.readMemberMap(
|
||||
|
@ -366,7 +366,7 @@ class AnnotationsDataImpl implements AnnotationsData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberMap(pragmaAnnotations,
|
||||
(MemberEntity member, EnumSet<PragmaAnnotation> set) {
|
||||
|
|
|
@ -15,11 +15,11 @@ import 'backend_impact.dart';
|
|||
|
||||
abstract class BackendUsage {
|
||||
/// Deserializes a [BackendUsage] object from [source].
|
||||
factory BackendUsage.readFromDataSource(DataSource source) =
|
||||
factory BackendUsage.readFromDataSource(DataSourceReader source) =
|
||||
BackendUsageImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [BackendUsage] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
bool needToInitializeIsolateAffinityTag;
|
||||
bool needToInitializeDispatchProperty;
|
||||
|
@ -356,7 +356,7 @@ class BackendUsageImpl implements BackendUsage {
|
|||
this._helperClassesUsed = helperClassesUsed,
|
||||
this._runtimeTypeUses = runtimeTypeUses;
|
||||
|
||||
factory BackendUsageImpl.readFromDataSource(DataSource source) {
|
||||
factory BackendUsageImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Set<FunctionEntity> globalFunctionDependencies =
|
||||
source.readMembers<FunctionEntity>().toSet();
|
||||
|
@ -396,7 +396,7 @@ class BackendUsageImpl implements BackendUsage {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMembers(_globalFunctionDependencies);
|
||||
sink.writeClasses(_globalClassDependencies);
|
||||
|
|
|
@ -56,7 +56,7 @@ class DeferredHolderExpression extends js.DeferredExpression
|
|||
DeferredHolderExpressionKind.globalObjectForStaticState, null);
|
||||
}
|
||||
|
||||
factory DeferredHolderExpression.readFromDataSource(DataSource source) {
|
||||
factory DeferredHolderExpression.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
var kind = source.readEnum(DeferredHolderExpressionKind.values);
|
||||
Object data;
|
||||
|
@ -79,7 +79,7 @@ class DeferredHolderExpression extends js.DeferredExpression
|
|||
return DeferredHolderExpression(kind, data);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeEnum(kind);
|
||||
switch (kind) {
|
||||
|
|
|
@ -252,7 +252,7 @@ class JFieldAnalysis {
|
|||
|
||||
/// Deserializes a [JFieldAnalysis] object from [source].
|
||||
factory JFieldAnalysis.readFromDataSource(
|
||||
DataSource source, CompilerOptions options) {
|
||||
DataSourceReader source, CompilerOptions options) {
|
||||
source.begin(tag);
|
||||
Map<FieldEntity, FieldAnalysisData> fieldData = source.readMemberMap(
|
||||
(MemberEntity member) => FieldAnalysisData.fromDataSource(source));
|
||||
|
@ -261,7 +261,7 @@ class JFieldAnalysis {
|
|||
}
|
||||
|
||||
/// Serializes this [JFieldAnalysis] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberMap(
|
||||
_fieldData,
|
||||
|
@ -602,7 +602,7 @@ class FieldAnalysisData {
|
|||
this.eagerCreationIndex = null,
|
||||
this.eagerFieldDependenciesForTesting = null});
|
||||
|
||||
factory FieldAnalysisData.fromDataSource(DataSource source) {
|
||||
factory FieldAnalysisData.fromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
|
||||
ConstantValue initialValue = source.readConstantOrNull();
|
||||
|
@ -624,7 +624,7 @@ class FieldAnalysisData {
|
|||
eagerFieldDependenciesForTesting: eagerFieldDependencies);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeConstantOrNull(initialValue);
|
||||
sink.writeBool(isInitializedInAllocator);
|
||||
|
|
|
@ -16,7 +16,7 @@ import 'annotations.dart';
|
|||
abstract class InferredData {
|
||||
/// Deserializes a [InferredData] object from [source].
|
||||
factory InferredData.readFromDataSource(
|
||||
DataSource source, JClosedWorld closedWorld) {
|
||||
DataSourceReader source, JClosedWorld closedWorld) {
|
||||
bool isTrivial = source.readBool();
|
||||
if (isTrivial) {
|
||||
return TrivialInferredData();
|
||||
|
@ -26,7 +26,7 @@ abstract class InferredData {
|
|||
}
|
||||
|
||||
/// Serializes this [InferredData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns the side effects of executing [element].
|
||||
SideEffects getSideEffectsOfElement(FunctionEntity element);
|
||||
|
@ -100,7 +100,7 @@ class InferredDataImpl implements InferredData {
|
|||
this._functionsThatMightBePassedToApply);
|
||||
|
||||
factory InferredDataImpl.readFromDataSource(
|
||||
DataSource source, JClosedWorld closedWorld) {
|
||||
DataSourceReader source, JClosedWorld closedWorld) {
|
||||
source.begin(tag);
|
||||
Set<MemberEntity> functionsCalledInLoop = source.readMembers().toSet();
|
||||
Map<FunctionEntity, SideEffects> sideEffects = source.readMemberMap(
|
||||
|
@ -122,7 +122,7 @@ class InferredDataImpl implements InferredData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeBool(false); // Is _not_ trivial.
|
||||
sink.begin(tag);
|
||||
sink.writeMembers(_functionsCalledInLoop);
|
||||
|
@ -302,7 +302,7 @@ class TrivialInferredData implements InferredData {
|
|||
final SideEffects _allSideEffects = SideEffects();
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeBool(true); // Is trivial.
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ import 'native_data.dart';
|
|||
abstract class InterceptorData {
|
||||
/// Deserializes a [InterceptorData] object from [source].
|
||||
factory InterceptorData.readFromDataSource(
|
||||
DataSource source,
|
||||
DataSourceReader source,
|
||||
NativeData nativeData,
|
||||
CommonElements commonElements) = InterceptorDataImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [InterceptorData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns `true` if [cls] is an intercepted class.
|
||||
bool isInterceptedClass(ClassEntity element);
|
||||
|
@ -110,8 +110,8 @@ class InterceptorDataImpl implements InterceptorData {
|
|||
this.interceptedClasses,
|
||||
this.classesMixedIntoInterceptedClasses);
|
||||
|
||||
factory InterceptorDataImpl.readFromDataSource(
|
||||
DataSource source, NativeData nativeData, CommonElements commonElements) {
|
||||
factory InterceptorDataImpl.readFromDataSource(DataSourceReader source,
|
||||
NativeData nativeData, CommonElements commonElements) {
|
||||
source.begin(tag);
|
||||
int interceptedMembersCount = source.readInt();
|
||||
Map<String, Set<MemberEntity>> interceptedMembers = {};
|
||||
|
@ -129,7 +129,7 @@ class InterceptorDataImpl implements InterceptorData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(interceptedMembers.length);
|
||||
interceptedMembers.forEach((String name, Set<MemberEntity> members) {
|
||||
|
|
|
@ -200,7 +200,7 @@ class NativeBasicData {
|
|||
|
||||
/// Deserializes a [NativeBasicData] object from [source].
|
||||
factory NativeBasicData.readFromDataSource(
|
||||
DataSource source, ElementEnvironment elementEnvironment) {
|
||||
DataSourceReader source, ElementEnvironment elementEnvironment) {
|
||||
source.begin(tag);
|
||||
bool isAllowInteropUsed = source.readBool();
|
||||
Map<ClassEntity, NativeClassTag> nativeClassTagInfo =
|
||||
|
@ -228,7 +228,7 @@ class NativeBasicData {
|
|||
}
|
||||
|
||||
/// Serializes this [NativeBasicData] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeBool(isAllowInteropUsed);
|
||||
sink.writeClassMap(_nativeClassTagInfo, (NativeClassTag tag) {
|
||||
|
@ -484,7 +484,7 @@ class NativeData implements NativeBasicData {
|
|||
|
||||
/// Deserializes a [NativeData] object from [source].
|
||||
factory NativeData.readFromDataSource(
|
||||
DataSource source, ElementEnvironment elementEnvironment) {
|
||||
DataSourceReader source, ElementEnvironment elementEnvironment) {
|
||||
source.begin(tag);
|
||||
NativeBasicData nativeBasicData =
|
||||
NativeBasicData.readFromDataSource(source, elementEnvironment);
|
||||
|
@ -506,7 +506,7 @@ class NativeData implements NativeBasicData {
|
|||
|
||||
/// Serializes this [NativeData] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
_nativeBasicData.writeToDataSink(sink);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ class NoSuchMethodData {
|
|||
this._throwingImpls, this._otherImpls, this._forwardingSyntaxImpls);
|
||||
|
||||
/// Deserializes a [NoSuchMethodData] object from [source].
|
||||
factory NoSuchMethodData.readFromDataSource(DataSource source) {
|
||||
factory NoSuchMethodData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Set<FunctionEntity> throwingImpls =
|
||||
source.readMembers<FunctionEntity>().toSet();
|
||||
|
@ -209,7 +209,7 @@ class NoSuchMethodData {
|
|||
}
|
||||
|
||||
/// Serializes this [NoSuchMethodData] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMembers(_throwingImpls);
|
||||
sink.writeMembers(_otherImpls);
|
||||
|
|
|
@ -660,7 +660,7 @@ class _DependencyVisitor extends DartTypeStructuralPredicateVisitor {
|
|||
abstract class RuntimeTypesNeed {
|
||||
/// Deserializes a [RuntimeTypesNeed] object from [source].
|
||||
factory RuntimeTypesNeed.readFromDataSource(
|
||||
DataSource source, ElementEnvironment elementEnvironment) {
|
||||
DataSourceReader source, ElementEnvironment elementEnvironment) {
|
||||
bool isTrivial = source.readBool();
|
||||
if (isTrivial) {
|
||||
return TrivialRuntimeTypesNeed(elementEnvironment);
|
||||
|
@ -669,7 +669,7 @@ abstract class RuntimeTypesNeed {
|
|||
}
|
||||
|
||||
/// Serializes this [RuntimeTypesNeed] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns `true` if [cls] needs type arguments at runtime.
|
||||
///
|
||||
|
@ -742,7 +742,7 @@ class TrivialRuntimeTypesNeed implements RuntimeTypesNeed {
|
|||
const TrivialRuntimeTypesNeed(this._elementEnvironment);
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeBool(true); // Is trivial.
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,7 @@ class RuntimeTypesNeedImpl implements RuntimeTypesNeed {
|
|||
this.instantiationsNeedingTypeArguments);
|
||||
|
||||
factory RuntimeTypesNeedImpl.readFromDataSource(
|
||||
DataSource source, ElementEnvironment elementEnvironment) {
|
||||
DataSourceReader source, ElementEnvironment elementEnvironment) {
|
||||
source.begin(tag);
|
||||
Set<ClassEntity> classesNeedingTypeArguments =
|
||||
source.readClasses<ClassEntity>().toSet();
|
||||
|
@ -822,7 +822,7 @@ class RuntimeTypesNeedImpl implements RuntimeTypesNeed {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeBool(false); // Is _not_ trivial.
|
||||
sink.begin(tag);
|
||||
sink.writeClasses(classesNeedingTypeArguments);
|
||||
|
|
|
@ -101,14 +101,14 @@ class StringReference extends js.DeferredExpression implements js.AstContainer {
|
|||
StringReference(this.constant) : sourceInformation = null;
|
||||
StringReference._(this.constant, this._value, this.sourceInformation);
|
||||
|
||||
factory StringReference.readFromDataSource(DataSource source) {
|
||||
factory StringReference.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
StringConstantValue constant = source.readConstant() as StringConstantValue;
|
||||
source.end(tag);
|
||||
return StringReference(constant);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeConstant(constant);
|
||||
sink.end(tag);
|
||||
|
|
|
@ -117,7 +117,7 @@ class TypeReference extends js.DeferredExpression implements js.AstContainer {
|
|||
TypeReference(this.typeRecipe) : sourceInformation = null;
|
||||
TypeReference._(this.typeRecipe, this._value, this.sourceInformation);
|
||||
|
||||
factory TypeReference.readFromDataSource(DataSource source) {
|
||||
factory TypeReference.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
TypeRecipe recipe = source.readTypeRecipe();
|
||||
bool forLazyInitializer = source.readBool();
|
||||
|
@ -125,7 +125,7 @@ class TypeReference extends js.DeferredExpression implements js.AstContainer {
|
|||
return TypeReference(recipe)..forLazyInitializer = forLazyInitializer;
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeTypeRecipe(typeRecipe);
|
||||
sink.writeBool(forLazyInitializer);
|
||||
|
|
|
@ -51,7 +51,7 @@ class ClosureDataImpl implements ClosureData {
|
|||
|
||||
/// Deserializes a [ClosureData] object from [source].
|
||||
factory ClosureDataImpl.readFromDataSource(
|
||||
JsToElementMap elementMap, DataSource source) {
|
||||
JsToElementMap elementMap, DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
// TODO(johnniwinther): Support shared [ScopeInfo].
|
||||
Map<MemberEntity, ScopeInfo> scopeMap = source.readMemberMap(
|
||||
|
@ -78,7 +78,7 @@ class ClosureDataImpl implements ClosureData {
|
|||
|
||||
/// Serializes this [ClosureData] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMemberMap(_scopeMap,
|
||||
(MemberEntity member, ScopeInfo info) => info.writeToDataSink(sink));
|
||||
|
@ -507,7 +507,7 @@ class JsScopeInfo extends ScopeInfo {
|
|||
return _boxedVariablesCache.containsKey(variable);
|
||||
}
|
||||
|
||||
factory JsScopeInfo.readFromDataSource(DataSource source) {
|
||||
factory JsScopeInfo.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Iterable<ir.VariableDeclaration> localsUsedInTryOrSync =
|
||||
source.readTreeNodes<ir.VariableDeclaration>();
|
||||
|
@ -522,7 +522,7 @@ class JsScopeInfo extends ScopeInfo {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ScopeInfoKind.scopeInfo);
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNodes(_localsUsedInTryOrSync);
|
||||
|
@ -556,7 +556,7 @@ class JsCapturedScope extends JsScopeInfo implements CapturedScope {
|
|||
@override
|
||||
bool get requiresContextBox => _boxedVariables.isNotEmpty;
|
||||
|
||||
factory JsCapturedScope.readFromDataSource(DataSource source) {
|
||||
factory JsCapturedScope.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Iterable<ir.VariableDeclaration> localsUsedInTryOrSync =
|
||||
source.readTreeNodes<ir.VariableDeclaration>();
|
||||
|
@ -571,7 +571,7 @@ class JsCapturedScope extends JsScopeInfo implements CapturedScope {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ScopeInfoKind.capturedScope);
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNodes(_localsUsedInTryOrSync);
|
||||
|
@ -608,7 +608,7 @@ class JsCapturedLoopScope extends JsCapturedScope implements CapturedLoopScope {
|
|||
@override
|
||||
bool get hasBoxedLoopVariables => _boxedLoopVariables.isNotEmpty;
|
||||
|
||||
factory JsCapturedLoopScope.readFromDataSource(DataSource source) {
|
||||
factory JsCapturedLoopScope.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Iterable<ir.VariableDeclaration> localsUsedInTryOrSync =
|
||||
source.readTreeNodes<ir.VariableDeclaration>();
|
||||
|
@ -625,7 +625,7 @@ class JsCapturedLoopScope extends JsCapturedScope implements CapturedLoopScope {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ScopeInfoKind.capturedLoopScope);
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNodes(_localsUsedInTryOrSync);
|
||||
|
@ -705,7 +705,7 @@ class JsClosureClassInfo extends JsScopeInfo
|
|||
_localToFieldMap = {},
|
||||
super.from(boxedVariables, info, enclosingClass);
|
||||
|
||||
factory JsClosureClassInfo.readFromDataSource(DataSource source) {
|
||||
factory JsClosureClassInfo.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Iterable<ir.VariableDeclaration> localsUsedInTryOrSync =
|
||||
source.readTreeNodes<ir.VariableDeclaration>();
|
||||
|
@ -743,7 +743,7 @@ class JsClosureClassInfo extends JsScopeInfo
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ScopeInfoKind.closureRepresentationInfo);
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNodes(_localsUsedInTryOrSync);
|
||||
|
@ -855,7 +855,7 @@ class JClosureClass extends JClass {
|
|||
JClosureClass(JLibrary library, String name)
|
||||
: super(library, name, isAbstract: false);
|
||||
|
||||
factory JClosureClass.readFromDataSource(DataSource source) {
|
||||
factory JClosureClass.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JLibrary library = source.readLibrary();
|
||||
String name = source.readString();
|
||||
|
@ -864,7 +864,7 @@ class JClosureClass extends JClass {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassKind.closure);
|
||||
sink.begin(tag);
|
||||
sink.writeLibrary(library);
|
||||
|
@ -926,7 +926,7 @@ class JClosureField extends JField implements PrivatelyNamedJSEntity {
|
|||
: super(library, enclosingClass, memberName,
|
||||
isAssignable: isAssignable, isConst: isConst, isStatic: false);
|
||||
|
||||
factory JClosureField.readFromDataSource(DataSource source) {
|
||||
factory JClosureField.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JClass cls = source.readClass();
|
||||
String name = source.readString();
|
||||
|
@ -940,7 +940,7 @@ class JClosureField extends JField implements PrivatelyNamedJSEntity {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.closureField);
|
||||
sink.begin(tag);
|
||||
sink.writeClass(enclosingClass);
|
||||
|
@ -975,7 +975,7 @@ class RecordClassData implements JClassData {
|
|||
RecordClassData(
|
||||
this.definition, this.thisType, this.supertype, this.orderedTypeSet);
|
||||
|
||||
factory RecordClassData.readFromDataSource(DataSource source) {
|
||||
factory RecordClassData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ClassDefinition definition = ClassDefinition.readFromDataSource(source);
|
||||
InterfaceType thisType = source.readDartType();
|
||||
|
@ -986,7 +986,7 @@ class RecordClassData implements JClassData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassDataKind.record);
|
||||
sink.begin(tag);
|
||||
definition.writeToDataSink(sink);
|
||||
|
@ -1036,7 +1036,7 @@ class JRecord extends JClass {
|
|||
JRecord(LibraryEntity library, String name)
|
||||
: super(library, name, isAbstract: false);
|
||||
|
||||
factory JRecord.readFromDataSource(DataSource source) {
|
||||
factory JRecord.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JLibrary library = source.readLibrary();
|
||||
String name = source.readString();
|
||||
|
@ -1045,7 +1045,7 @@ class JRecord extends JClass {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassKind.record);
|
||||
sink.begin(tag);
|
||||
sink.writeLibrary(library);
|
||||
|
@ -1075,7 +1075,7 @@ class JRecordField extends JField {
|
|||
Name(name, box.container.library),
|
||||
isStatic: false, isAssignable: true, isConst: isConst);
|
||||
|
||||
factory JRecordField.readFromDataSource(DataSource source) {
|
||||
factory JRecordField.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
String name = source.readString();
|
||||
JClass enclosingClass = source.readClass();
|
||||
|
@ -1085,7 +1085,7 @@ class JRecordField extends JField {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.recordField);
|
||||
sink.begin(tag);
|
||||
sink.writeString(name);
|
||||
|
@ -1118,7 +1118,7 @@ class ClosureClassData extends RecordClassData {
|
|||
InterfaceType supertype, OrderedTypeSet orderedTypeSet)
|
||||
: super(definition, thisType, supertype, orderedTypeSet);
|
||||
|
||||
factory ClosureClassData.readFromDataSource(DataSource source) {
|
||||
factory ClosureClassData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ClassDefinition definition = ClassDefinition.readFromDataSource(source);
|
||||
InterfaceType thisType = source.readDartType();
|
||||
|
@ -1131,7 +1131,7 @@ class ClosureClassData extends RecordClassData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassDataKind.closure);
|
||||
sink.begin(tag);
|
||||
definition.writeToDataSink(sink);
|
||||
|
@ -1153,7 +1153,7 @@ class ClosureClassDefinition implements ClassDefinition {
|
|||
|
||||
ClosureClassDefinition(this.location);
|
||||
|
||||
factory ClosureClassDefinition.readFromDataSource(DataSource source) {
|
||||
factory ClosureClassDefinition.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
SourceSpan location = source.readSourceSpan();
|
||||
source.end(tag);
|
||||
|
@ -1161,7 +1161,7 @@ class ClosureClassDefinition implements ClassDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ClassKind.closure);
|
||||
sink.begin(tag);
|
||||
sink.writeSourceSpan(location);
|
||||
|
@ -1221,7 +1221,7 @@ class ClosureFunctionData extends ClosureMemberData
|
|||
this.classTypeVariableAccess)
|
||||
: super(definition, memberThisType);
|
||||
|
||||
factory ClosureFunctionData.readFromDataSource(DataSource source) {
|
||||
factory ClosureFunctionData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ClosureMemberDefinition definition =
|
||||
MemberDefinition.readFromDataSource(source);
|
||||
|
@ -1236,7 +1236,7 @@ class ClosureFunctionData extends ClosureMemberData
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.closureFunction);
|
||||
sink.begin(tag);
|
||||
definition.writeToDataSink(sink);
|
||||
|
@ -1275,7 +1275,7 @@ class ClosureFieldData extends ClosureMemberData implements JFieldData {
|
|||
ClosureFieldData(MemberDefinition definition, InterfaceType memberThisType)
|
||||
: super(definition, memberThisType);
|
||||
|
||||
factory ClosureFieldData.readFromDataSource(DataSource source) {
|
||||
factory ClosureFieldData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberDefinition definition = MemberDefinition.readFromDataSource(source);
|
||||
InterfaceType memberThisType = source.readDartType(allowNull: true);
|
||||
|
@ -1284,7 +1284,7 @@ class ClosureFieldData extends ClosureMemberData implements JFieldData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.closureField);
|
||||
sink.begin(tag);
|
||||
definition.writeToDataSink(sink);
|
||||
|
@ -1341,7 +1341,7 @@ class ClosureMemberDefinition implements MemberDefinition {
|
|||
kind == MemberKind.closureCall || kind == MemberKind.closureField);
|
||||
|
||||
factory ClosureMemberDefinition.readFromDataSource(
|
||||
DataSource source, MemberKind kind) {
|
||||
DataSourceReader source, MemberKind kind) {
|
||||
source.begin(tag);
|
||||
SourceSpan location = source.readSourceSpan();
|
||||
ir.TreeNode node = source.readTreeNode();
|
||||
|
@ -1350,7 +1350,7 @@ class ClosureMemberDefinition implements MemberDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(kind);
|
||||
sink.begin(tag);
|
||||
sink.writeSourceSpan(location);
|
||||
|
@ -1372,7 +1372,8 @@ class RecordContainerDefinition implements ClassDefinition {
|
|||
|
||||
RecordContainerDefinition(this.location);
|
||||
|
||||
factory RecordContainerDefinition.readFromDataSource(DataSource source) {
|
||||
factory RecordContainerDefinition.readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
SourceSpan location = source.readSourceSpan();
|
||||
source.end(tag);
|
||||
|
@ -1380,7 +1381,7 @@ class RecordContainerDefinition implements ClassDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(ClassKind.record);
|
||||
sink.begin(tag);
|
||||
sink.writeSourceSpan(location);
|
||||
|
|
|
@ -269,7 +269,7 @@ abstract class KernelToLocalsMap {
|
|||
JumpTarget getJumpTargetForWhile(ir.WhileStatement node);
|
||||
|
||||
/// Serializes this [KernelToLocalsMap] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
}
|
||||
|
||||
/// Returns the [ir.FunctionNode] that defines [member] or `null` if [member]
|
||||
|
@ -338,7 +338,7 @@ abstract class MemberDefinition {
|
|||
SourceSpan get location;
|
||||
|
||||
/// Deserializes a [MemberDefinition] object from [source].
|
||||
factory MemberDefinition.readFromDataSource(DataSource source) {
|
||||
factory MemberDefinition.readFromDataSource(DataSourceReader source) {
|
||||
MemberKind kind = source.readEnum(MemberKind.values);
|
||||
switch (kind) {
|
||||
case MemberKind.regular:
|
||||
|
@ -356,7 +356,7 @@ abstract class MemberDefinition {
|
|||
}
|
||||
|
||||
/// Serializes this [MemberDefinition] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
}
|
||||
|
||||
enum ClassKind {
|
||||
|
@ -378,7 +378,7 @@ class RegularMemberDefinition implements MemberDefinition {
|
|||
|
||||
RegularMemberDefinition(this.node);
|
||||
|
||||
factory RegularMemberDefinition.readFromDataSource(DataSource source) {
|
||||
factory RegularMemberDefinition.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member node = source.readMemberNode();
|
||||
source.end(tag);
|
||||
|
@ -386,7 +386,7 @@ class RegularMemberDefinition implements MemberDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(MemberKind.regular);
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
|
@ -418,7 +418,7 @@ class SpecialMemberDefinition implements MemberDefinition {
|
|||
SpecialMemberDefinition(this.node, this.kind);
|
||||
|
||||
factory SpecialMemberDefinition.readFromDataSource(
|
||||
DataSource source, MemberKind kind) {
|
||||
DataSourceReader source, MemberKind kind) {
|
||||
source.begin(tag);
|
||||
ir.TreeNode node = source.readTreeNode();
|
||||
source.end(tag);
|
||||
|
@ -426,7 +426,7 @@ class SpecialMemberDefinition implements MemberDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(kind);
|
||||
sink.begin(tag);
|
||||
sink.writeTreeNode(node);
|
||||
|
@ -454,7 +454,7 @@ abstract class ClassDefinition {
|
|||
SourceSpan get location;
|
||||
|
||||
/// Deserializes a [ClassDefinition] object from [source].
|
||||
factory ClassDefinition.readFromDataSource(DataSource source) {
|
||||
factory ClassDefinition.readFromDataSource(DataSourceReader source) {
|
||||
ClassKind kind = source.readEnum(ClassKind.values);
|
||||
switch (kind) {
|
||||
case ClassKind.regular:
|
||||
|
@ -468,7 +468,7 @@ abstract class ClassDefinition {
|
|||
}
|
||||
|
||||
/// Serializes this [ClassDefinition] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
}
|
||||
|
||||
/// A class directly defined by its [ir.Class] node.
|
||||
|
@ -482,7 +482,7 @@ class RegularClassDefinition implements ClassDefinition {
|
|||
|
||||
RegularClassDefinition(this.node);
|
||||
|
||||
factory RegularClassDefinition.readFromDataSource(DataSource source) {
|
||||
factory RegularClassDefinition.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Class node = source.readClassNode();
|
||||
source.end(tag);
|
||||
|
@ -490,7 +490,7 @@ class RegularClassDefinition implements ClassDefinition {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(kind);
|
||||
sink.begin(tag);
|
||||
sink.writeClassNode(node);
|
||||
|
|
|
@ -293,7 +293,7 @@ class JsKernelToElementMap implements JsToElementMap, IrToElementMap {
|
|||
}
|
||||
|
||||
JsKernelToElementMap.readFromDataSource(this.options, this.reporter,
|
||||
this._environment, ir.Component component, DataSource source) {
|
||||
this._environment, ir.Component component, DataSourceReader source) {
|
||||
_elementEnvironment = JsElementEnvironment(this);
|
||||
_typeConverter = DartTypeConverter(this);
|
||||
_types = KernelDartTypes(this, options);
|
||||
|
@ -430,7 +430,7 @@ class JsKernelToElementMap implements JsToElementMap, IrToElementMap {
|
|||
}
|
||||
|
||||
/// Serializes this [JsToElementMap] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
|
||||
// Serialize the entities before serializing the data.
|
||||
|
@ -2629,7 +2629,7 @@ class ClosedEntityReader extends EntityReader {
|
|||
|
||||
@override
|
||||
IndexedMember readMemberFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
int index = source.readInt();
|
||||
if (index == 0) {
|
||||
return _readLateMemberFromDataSource(source, entityLookup);
|
||||
|
@ -2639,7 +2639,7 @@ class ClosedEntityReader extends EntityReader {
|
|||
}
|
||||
|
||||
IndexedMember _readLateMemberFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
LateMemberKind kind = source.readEnum(LateMemberKind.values);
|
||||
switch (kind) {
|
||||
case LateMemberKind.constructorBody:
|
||||
|
@ -2664,7 +2664,7 @@ class ClosedEntityWriter extends EntityWriter {
|
|||
ClosedEntityWriter(this._earlyMemberIndexLimit);
|
||||
|
||||
@override
|
||||
void writeMemberToDataSink(DataSink sink, IndexedMember value) {
|
||||
void writeMemberToDataSink(DataSinkWriter sink, IndexedMember value) {
|
||||
if (value.memberIndex >= _earlyMemberIndexLimit) {
|
||||
sink.writeInt(0);
|
||||
_writeLateMemberToDataSink(sink, value);
|
||||
|
@ -2673,7 +2673,7 @@ class ClosedEntityWriter extends EntityWriter {
|
|||
}
|
||||
}
|
||||
|
||||
void _writeLateMemberToDataSink(DataSink sink, IndexedMember value) {
|
||||
void _writeLateMemberToDataSink(DataSinkWriter sink, IndexedMember value) {
|
||||
if (value is JConstructorBody) {
|
||||
sink.writeEnum(LateMemberKind.constructorBody);
|
||||
sink.writeMember(value.constructor);
|
||||
|
|
|
@ -30,7 +30,7 @@ class JLibrary extends IndexedLibrary {
|
|||
JLibrary(this.name, this.canonicalUri, this.isNonNullableByDefault);
|
||||
|
||||
/// Deserializes a [JLibrary] object from [source].
|
||||
factory JLibrary.readFromDataSource(DataSource source) {
|
||||
factory JLibrary.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
String name = source.readString();
|
||||
Uri canonicalUri = source.readUri();
|
||||
|
@ -40,7 +40,7 @@ class JLibrary extends IndexedLibrary {
|
|||
}
|
||||
|
||||
/// Serializes this [JLibrary] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeString(name);
|
||||
sink.writeUri(canonicalUri);
|
||||
|
@ -71,7 +71,7 @@ class JClass extends IndexedClass with ClassHierarchyNodesMapKey {
|
|||
JClass(this.library, this.name, {this.isAbstract});
|
||||
|
||||
/// Deserializes a [JClass] object from [source].
|
||||
factory JClass.readFromDataSource(DataSource source) {
|
||||
factory JClass.readFromDataSource(DataSourceReader source) {
|
||||
JClassKind kind = source.readEnum(JClassKind.values);
|
||||
switch (kind) {
|
||||
case JClassKind.node:
|
||||
|
@ -90,7 +90,7 @@ class JClass extends IndexedClass with ClassHierarchyNodesMapKey {
|
|||
}
|
||||
|
||||
/// Serializes this [JClass] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassKind.node);
|
||||
sink.begin(tag);
|
||||
sink.writeLibrary(library);
|
||||
|
@ -135,7 +135,7 @@ abstract class JMember extends IndexedMember {
|
|||
: _isStatic = isStatic;
|
||||
|
||||
/// Deserializes a [JMember] object from [source].
|
||||
factory JMember.readFromDataSource(DataSource source) {
|
||||
factory JMember.readFromDataSource(DataSourceReader source) {
|
||||
JMemberKind kind = source.readEnum(JMemberKind.values);
|
||||
switch (kind) {
|
||||
case JMemberKind.generativeConstructor:
|
||||
|
@ -167,7 +167,7 @@ abstract class JMember extends IndexedMember {
|
|||
}
|
||||
|
||||
/// Serializes this [JMember] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
@override
|
||||
String get name => _name.text;
|
||||
|
@ -272,7 +272,7 @@ class JGenerativeConstructor extends JConstructor {
|
|||
: super(enclosingClass, name, parameterStructure,
|
||||
isExternal: isExternal, isConst: isConst);
|
||||
|
||||
factory JGenerativeConstructor.readFromDataSource(DataSource source) {
|
||||
factory JGenerativeConstructor.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JClass enclosingClass = source.readClass();
|
||||
String name = source.readString();
|
||||
|
@ -287,7 +287,7 @@ class JGenerativeConstructor extends JConstructor {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.generativeConstructor);
|
||||
sink.begin(tag);
|
||||
sink.writeClass(enclosingClass);
|
||||
|
@ -319,7 +319,7 @@ class JFactoryConstructor extends JConstructor {
|
|||
: super(enclosingClass, name, parameterStructure,
|
||||
isExternal: isExternal, isConst: isConst);
|
||||
|
||||
factory JFactoryConstructor.readFromDataSource(DataSource source) {
|
||||
factory JFactoryConstructor.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JClass enclosingClass = source.readClass();
|
||||
String name = source.readString();
|
||||
|
@ -337,7 +337,7 @@ class JFactoryConstructor extends JConstructor {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.factoryConstructor);
|
||||
sink.begin(tag);
|
||||
sink.writeClass(enclosingClass);
|
||||
|
@ -369,7 +369,7 @@ class JConstructorBody extends JFunction implements ConstructorBodyEntity {
|
|||
constructor.memberName, parameterStructure, AsyncMarker.SYNC,
|
||||
isStatic: false, isExternal: false);
|
||||
|
||||
factory JConstructorBody.readFromDataSource(DataSource source) {
|
||||
factory JConstructorBody.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JConstructor constructor = source.readMember();
|
||||
ParameterStructure parameterStructure =
|
||||
|
@ -379,7 +379,7 @@ class JConstructorBody extends JFunction implements ConstructorBodyEntity {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.constructorBody);
|
||||
sink.begin(tag);
|
||||
sink.writeMember(constructor);
|
||||
|
@ -405,7 +405,7 @@ class JMethod extends JFunction {
|
|||
: super(library, enclosingClass, name, parameterStructure, asyncMarker,
|
||||
isStatic: isStatic, isExternal: isExternal);
|
||||
|
||||
factory JMethod.readFromDataSource(DataSource source) {
|
||||
factory JMethod.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberContextKind kind = source.readEnum(MemberContextKind.values);
|
||||
JLibrary library;
|
||||
|
@ -433,7 +433,7 @@ class JMethod extends JFunction {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.method);
|
||||
sink.begin(tag);
|
||||
if (enclosingClass != null) {
|
||||
|
@ -475,7 +475,7 @@ class JGeneratorBody extends JFunction {
|
|||
function.parameterStructure, function.asyncMarker,
|
||||
isStatic: function.isStatic, isExternal: false);
|
||||
|
||||
factory JGeneratorBody.readFromDataSource(DataSource source) {
|
||||
factory JGeneratorBody.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JFunction function = source.readMember();
|
||||
DartType elementType = source.readDartType();
|
||||
|
@ -484,7 +484,7 @@ class JGeneratorBody extends JFunction {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.generatorBody);
|
||||
sink.begin(tag);
|
||||
sink.writeMember(function);
|
||||
|
@ -511,7 +511,7 @@ class JGetter extends JFunction {
|
|||
asyncMarker,
|
||||
isStatic: isStatic, isExternal: isExternal);
|
||||
|
||||
factory JGetter.readFromDataSource(DataSource source) {
|
||||
factory JGetter.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberContextKind kind = source.readEnum(MemberContextKind.values);
|
||||
JLibrary library;
|
||||
|
@ -536,7 +536,7 @@ class JGetter extends JFunction {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.getter);
|
||||
sink.begin(tag);
|
||||
if (enclosingClass != null) {
|
||||
|
@ -575,7 +575,7 @@ class JSetter extends JFunction {
|
|||
AsyncMarker.SYNC,
|
||||
isStatic: isStatic, isExternal: isExternal);
|
||||
|
||||
factory JSetter.readFromDataSource(DataSource source) {
|
||||
factory JSetter.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberContextKind kind = source.readEnum(MemberContextKind.values);
|
||||
JLibrary library;
|
||||
|
@ -599,7 +599,7 @@ class JSetter extends JFunction {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.setter);
|
||||
sink.begin(tag);
|
||||
if (enclosingClass != null) {
|
||||
|
@ -640,7 +640,7 @@ class JField extends JMember implements FieldEntity, IndexedField {
|
|||
{bool isStatic, this.isAssignable, this.isConst})
|
||||
: super(library, enclosingClass, name, isStatic: isStatic);
|
||||
|
||||
factory JField.readFromDataSource(DataSource source) {
|
||||
factory JField.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberContextKind kind = source.readEnum(MemberContextKind.values);
|
||||
JLibrary library;
|
||||
|
@ -664,7 +664,7 @@ class JField extends JMember implements FieldEntity, IndexedField {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.field);
|
||||
sink.begin(tag);
|
||||
if (enclosingClass != null) {
|
||||
|
@ -699,7 +699,7 @@ class JClosureCallMethod extends JMethod {
|
|||
parameterStructure, asyncMarker,
|
||||
isStatic: false, isExternal: false, isAbstract: false);
|
||||
|
||||
factory JClosureCallMethod.readFromDataSource(DataSource source) {
|
||||
factory JClosureCallMethod.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JClass enclosingClass = source.readClass();
|
||||
ParameterStructure parameterStructure =
|
||||
|
@ -710,7 +710,7 @@ class JClosureCallMethod extends JMethod {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.closureCallMethod);
|
||||
sink.begin(tag);
|
||||
sink.writeClass(enclosingClass);
|
||||
|
@ -735,7 +735,7 @@ class JSignatureMethod extends JMethod {
|
|||
ParameterStructure.zeroArguments, AsyncMarker.SYNC,
|
||||
isStatic: false, isExternal: false, isAbstract: false);
|
||||
|
||||
factory JSignatureMethod.readFromDataSource(DataSource source) {
|
||||
factory JSignatureMethod.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JClass cls = source.readClass();
|
||||
source.end(tag);
|
||||
|
@ -743,7 +743,7 @@ class JSignatureMethod extends JMethod {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberKind.signatureMethod);
|
||||
sink.begin(tag);
|
||||
sink.writeClass(enclosingClass);
|
||||
|
@ -772,7 +772,7 @@ class JTypeVariable extends IndexedTypeVariable {
|
|||
JTypeVariable(this.typeDeclaration, this.name, this.index);
|
||||
|
||||
/// Deserializes a [JTypeVariable] object from [source].
|
||||
factory JTypeVariable.readFromDataSource(DataSource source) {
|
||||
factory JTypeVariable.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
JTypeVariableKind kind = source.readEnum(JTypeVariableKind.values);
|
||||
Entity typeDeclaration;
|
||||
|
@ -797,7 +797,7 @@ class JTypeVariable extends IndexedTypeVariable {
|
|||
}
|
||||
|
||||
/// Serializes this [JTypeVariable] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
if (typeDeclaration is IndexedClass) {
|
||||
IndexedClass cls = typeDeclaration;
|
||||
|
|
|
@ -67,7 +67,7 @@ class JLibraryEnv {
|
|||
JLibraryEnv(this.library, this._memberMap, this._setterMap);
|
||||
|
||||
/// Deserializes a [JLibraryEnv] object from [source].
|
||||
factory JLibraryEnv.readFromDataSource(DataSource source) {
|
||||
factory JLibraryEnv.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Library library = source.readLibraryNode();
|
||||
Map<String, ir.Member> memberMap =
|
||||
|
@ -79,7 +79,7 @@ class JLibraryEnv {
|
|||
}
|
||||
|
||||
/// Serializes this [JLibraryEnv] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeLibraryNode(library);
|
||||
sink.writeStringMap(_memberMap, sink.writeMemberNode);
|
||||
|
@ -130,7 +130,7 @@ class JLibraryData {
|
|||
|
||||
JLibraryData(this.library, this.imports);
|
||||
|
||||
factory JLibraryData.readFromDataSource(DataSource source) {
|
||||
factory JLibraryData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Library library = source.readLibraryNode();
|
||||
int importCount = source.readInt();
|
||||
|
@ -147,7 +147,7 @@ class JLibraryData {
|
|||
return JLibraryData(library, imports);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeLibraryNode(library);
|
||||
if (imports == null) {
|
||||
|
@ -174,7 +174,7 @@ enum JClassEnvKind { node, closure, record }
|
|||
/// Member data for a class.
|
||||
abstract class JClassEnv {
|
||||
/// Deserializes a [JClassEnv] object from [source].
|
||||
factory JClassEnv.readFromDataSource(DataSource source) {
|
||||
factory JClassEnv.readFromDataSource(DataSourceReader source) {
|
||||
JClassEnvKind kind = source.readEnum(JClassEnvKind.values);
|
||||
switch (kind) {
|
||||
case JClassEnvKind.node:
|
||||
|
@ -188,7 +188,7 @@ abstract class JClassEnv {
|
|||
}
|
||||
|
||||
/// Serializes this [JClassEnv] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// The [ir.Class] that defined the class, if any.
|
||||
ir.Class get cls;
|
||||
|
@ -244,7 +244,7 @@ class JClassEnvImpl implements JClassEnv {
|
|||
JClassEnvImpl(this.cls, this._constructorMap, this._memberMap,
|
||||
this._setterMap, this._members, this.isMixinApplicationWithMembers);
|
||||
|
||||
factory JClassEnvImpl.readFromDataSource(DataSource source) {
|
||||
factory JClassEnvImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Class cls = source.readClassNode();
|
||||
Map<String, ir.Member> constructorMap =
|
||||
|
@ -261,7 +261,7 @@ class JClassEnvImpl implements JClassEnv {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassEnvKind.node);
|
||||
sink.begin(tag);
|
||||
sink.writeClassNode(cls);
|
||||
|
@ -324,7 +324,7 @@ class RecordEnv implements JClassEnv {
|
|||
|
||||
RecordEnv(this._memberMap);
|
||||
|
||||
factory RecordEnv.readFromDataSource(DataSource source) {
|
||||
factory RecordEnv.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Map<String, IndexedMember> _memberMap =
|
||||
source.readStringMap(() => source.readMember());
|
||||
|
@ -333,7 +333,7 @@ class RecordEnv implements JClassEnv {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassEnvKind.record);
|
||||
sink.begin(tag);
|
||||
sink.writeStringMap(
|
||||
|
@ -386,7 +386,7 @@ class ClosureClassEnv extends RecordEnv {
|
|||
|
||||
ClosureClassEnv(Map<String, MemberEntity> memberMap) : super(memberMap);
|
||||
|
||||
factory ClosureClassEnv.readFromDataSource(DataSource source) {
|
||||
factory ClosureClassEnv.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Map<String, IndexedMember> _memberMap =
|
||||
source.readStringMap(() => source.readMember());
|
||||
|
@ -395,7 +395,7 @@ class ClosureClassEnv extends RecordEnv {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassEnvKind.closure);
|
||||
sink.begin(tag);
|
||||
sink.writeStringMap(
|
||||
|
@ -419,7 +419,7 @@ enum JClassDataKind { node, closure, record }
|
|||
|
||||
abstract class JClassData {
|
||||
/// Deserializes a [JClassData] object from [source].
|
||||
factory JClassData.readFromDataSource(DataSource source) {
|
||||
factory JClassData.readFromDataSource(DataSourceReader source) {
|
||||
JClassDataKind kind = source.readEnum(JClassDataKind.values);
|
||||
switch (kind) {
|
||||
case JClassDataKind.node:
|
||||
|
@ -433,7 +433,7 @@ abstract class JClassData {
|
|||
}
|
||||
|
||||
/// Serializes this [JClassData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
ClassDefinition get definition;
|
||||
|
||||
|
@ -485,7 +485,7 @@ class JClassDataImpl implements JClassData {
|
|||
|
||||
JClassDataImpl(this.cls, this.definition);
|
||||
|
||||
factory JClassDataImpl.readFromDataSource(DataSource source) {
|
||||
factory JClassDataImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Class cls = source.readClassNode();
|
||||
ClassDefinition definition = ClassDefinition.readFromDataSource(source);
|
||||
|
@ -494,7 +494,7 @@ class JClassDataImpl implements JClassData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JClassDataKind.node);
|
||||
sink.begin(tag);
|
||||
sink.writeClassNode(cls);
|
||||
|
@ -538,7 +538,7 @@ abstract class JMemberData {
|
|||
JMemberData();
|
||||
|
||||
/// Deserializes a [JMemberData] object from [source].
|
||||
factory JMemberData.readFromDataSource(DataSource source) {
|
||||
factory JMemberData.readFromDataSource(DataSourceReader source) {
|
||||
JMemberDataKind kind = source.readEnum(JMemberDataKind.values);
|
||||
switch (kind) {
|
||||
case JMemberDataKind.function:
|
||||
|
@ -562,7 +562,7 @@ abstract class JMemberData {
|
|||
}
|
||||
|
||||
/// Serializes this [JMemberData] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
}
|
||||
|
||||
abstract class JMemberDataImpl implements JMemberData {
|
||||
|
@ -689,7 +689,7 @@ class FunctionDataImpl extends JMemberDataImpl
|
|||
MemberDefinition definition, StaticTypeCache staticTypes)
|
||||
: super(node, definition, staticTypes);
|
||||
|
||||
factory FunctionDataImpl.readFromDataSource(DataSource source) {
|
||||
factory FunctionDataImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member node = source.readMemberNode();
|
||||
ir.FunctionNode functionNode;
|
||||
|
@ -709,7 +709,7 @@ class FunctionDataImpl extends JMemberDataImpl
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.function);
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
|
@ -748,7 +748,7 @@ class SignatureFunctionData implements FunctionData {
|
|||
SignatureFunctionData(this.definition, this.memberThisType,
|
||||
this.typeParameters, this.classTypeVariableAccess);
|
||||
|
||||
factory SignatureFunctionData.readFromDataSource(DataSource source) {
|
||||
factory SignatureFunctionData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberDefinition definition = MemberDefinition.readFromDataSource(source);
|
||||
InterfaceType memberThisType = source.readDartType(allowNull: true);
|
||||
|
@ -761,7 +761,7 @@ class SignatureFunctionData implements FunctionData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.signature);
|
||||
sink.begin(tag);
|
||||
definition.writeToDataSink(sink);
|
||||
|
@ -851,7 +851,8 @@ class GeneratorBodyFunctionData extends DelegatedFunctionData {
|
|||
GeneratorBodyFunctionData(FunctionData baseData, this.definition)
|
||||
: super(baseData);
|
||||
|
||||
factory GeneratorBodyFunctionData.readFromDataSource(DataSource source) {
|
||||
factory GeneratorBodyFunctionData.readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
// TODO(johnniwinther): Share the original base data on deserialization.
|
||||
FunctionData baseData = JMemberData.readFromDataSource(source);
|
||||
|
@ -861,7 +862,7 @@ class GeneratorBodyFunctionData extends DelegatedFunctionData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.generatorBody);
|
||||
sink.begin(tag);
|
||||
baseData.writeToDataSink(sink);
|
||||
|
@ -887,7 +888,7 @@ class JConstructorDataImpl extends FunctionDataImpl
|
|||
MemberDefinition definition, StaticTypeCache staticTypes)
|
||||
: super(node, functionNode, definition, staticTypes);
|
||||
|
||||
factory JConstructorDataImpl.readFromDataSource(DataSource source) {
|
||||
factory JConstructorDataImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member node = source.readMemberNode();
|
||||
ir.FunctionNode functionNode;
|
||||
|
@ -907,7 +908,7 @@ class JConstructorDataImpl extends FunctionDataImpl
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.constructor);
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
|
@ -931,7 +932,7 @@ class ConstructorBodyDataImpl extends FunctionDataImpl {
|
|||
MemberDefinition definition, StaticTypeCache staticTypes)
|
||||
: super(node, functionNode, definition, staticTypes);
|
||||
|
||||
factory ConstructorBodyDataImpl.readFromDataSource(DataSource source) {
|
||||
factory ConstructorBodyDataImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member node = source.readMemberNode();
|
||||
ir.FunctionNode functionNode;
|
||||
|
@ -951,7 +952,7 @@ class ConstructorBodyDataImpl extends FunctionDataImpl {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.constructorBody);
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
|
@ -982,7 +983,7 @@ class JFieldDataImpl extends JMemberDataImpl implements JFieldData {
|
|||
ir.Field node, MemberDefinition definition, StaticTypeCache staticTypes)
|
||||
: super(node, definition, staticTypes);
|
||||
|
||||
factory JFieldDataImpl.readFromDataSource(DataSource source) {
|
||||
factory JFieldDataImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.Member node = source.readMemberNode();
|
||||
MemberDefinition definition = MemberDefinition.readFromDataSource(source);
|
||||
|
@ -993,7 +994,7 @@ class JFieldDataImpl extends JMemberDataImpl implements JFieldData {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeEnum(JMemberDataKind.field);
|
||||
sink.begin(tag);
|
||||
sink.writeMemberNode(node);
|
||||
|
@ -1028,14 +1029,14 @@ class JTypeVariableData {
|
|||
|
||||
JTypeVariableData(this.node);
|
||||
|
||||
factory JTypeVariableData.readFromDataSource(DataSource source) {
|
||||
factory JTypeVariableData.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ir.TypeParameter node = source.readTypeParameterNode();
|
||||
source.end(tag);
|
||||
return JTypeVariableData(node);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeTypeParameterNode(node);
|
||||
sink.end(tag);
|
||||
|
|
|
@ -318,12 +318,12 @@ class JsBackendStrategy {
|
|||
if (_compiler.options.testMode) {
|
||||
bool useDataKinds = true;
|
||||
List<Object> data = [];
|
||||
DataSink sink =
|
||||
DataSink(ObjectSinkWriter(data), useDataKinds: useDataKinds);
|
||||
DataSinkWriter sink =
|
||||
DataSinkWriter(ObjectDataSink(data), useDataKinds: useDataKinds);
|
||||
sink.registerCodegenWriter(CodegenWriterImpl(closedWorld));
|
||||
result.writeToDataSink(sink);
|
||||
DataSource source =
|
||||
DataSource(ObjectSourceReader(data), useDataKinds: useDataKinds);
|
||||
DataSourceReader source =
|
||||
DataSourceReader(ObjectDataSource(data), useDataKinds: useDataKinds);
|
||||
List<ModularName> modularNames = [];
|
||||
List<ModularExpression> modularExpression = [];
|
||||
source.registerCodegenReader(
|
||||
|
@ -390,7 +390,7 @@ class JsBackendStrategy {
|
|||
}
|
||||
|
||||
/// Prepare [source] to deserialize modular code generation data.
|
||||
void prepareCodegenReader(DataSource source) {
|
||||
void prepareCodegenReader(DataSourceReader source) {
|
||||
source.registerEntityReader(ClosedEntityReader(_elementMap));
|
||||
source.registerEntityLookup(ClosedEntityLookup(_elementMap));
|
||||
source.registerComponentLookup(
|
||||
|
|
|
@ -126,7 +126,7 @@ class JsClosedWorld implements JClosedWorld {
|
|||
Environment environment,
|
||||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
DataSource source) {
|
||||
DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
|
||||
JsKernelToElementMap elementMap = JsKernelToElementMap.readFromDataSource(
|
||||
|
@ -198,7 +198,7 @@ class JsClosedWorld implements JClosedWorld {
|
|||
}
|
||||
|
||||
/// Serializes this [JsClosedWorld] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
elementMap.writeToDataSink(sink);
|
||||
classHierarchy.writeToDataSink(sink);
|
||||
|
|
|
@ -38,7 +38,7 @@ class GlobalLocalsMap {
|
|||
/// Deserializes a [GlobalLocalsMap] object from [source].
|
||||
factory GlobalLocalsMap.readFromDataSource(
|
||||
MemberEntity Function(MemberEntity) localMapKeyLookup,
|
||||
DataSource source) {
|
||||
DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Map<MemberEntity, KernelToLocalsMap> _localsMaps = {};
|
||||
int mapCount = source.readInt();
|
||||
|
@ -55,7 +55,7 @@ class GlobalLocalsMap {
|
|||
}
|
||||
|
||||
/// Serializes this [GlobalLocalsMap] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
// [KernelToLocalsMap]s are shared between members and their nested
|
||||
// closures, so we reverse [_localsMaps] to ensure that [KernelToLocalsMap]s
|
||||
|
@ -107,7 +107,7 @@ class KernelToLocalsMapImpl implements KernelToLocalsMap {
|
|||
KernelToLocalsMapImpl(this._currentMember);
|
||||
|
||||
/// Deserializes a [KernelToLocalsMapImpl] object from [source].
|
||||
KernelToLocalsMapImpl.readFromDataSource(DataSource source) {
|
||||
KernelToLocalsMapImpl.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
_currentMember = source.readMember();
|
||||
int localsCount = source.readInt();
|
||||
|
@ -143,7 +143,7 @@ class KernelToLocalsMapImpl implements KernelToLocalsMap {
|
|||
|
||||
/// Serializes this [KernelToLocalsMapImpl] to [sink].
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMember(currentMember);
|
||||
sink.writeInt(_locals.size);
|
||||
|
@ -475,7 +475,7 @@ class JJumpTarget extends JumpTarget {
|
|||
this.isContinueTarget = false});
|
||||
|
||||
/// Deserializes a [JJumpTarget] object from [source].
|
||||
factory JJumpTarget.readFromDataSource(DataSource source) {
|
||||
factory JJumpTarget.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberEntity memberContext = source.readMember();
|
||||
int nestingLevel = source.readInt();
|
||||
|
@ -501,7 +501,7 @@ class JJumpTarget extends JumpTarget {
|
|||
}
|
||||
|
||||
/// Serializes this [JJumpTarget] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeMember(memberContext);
|
||||
sink.writeInt(nestingLevel);
|
||||
|
|
|
@ -147,7 +147,7 @@ abstract class TypeRecipe {
|
|||
|
||||
int _computeHashCode();
|
||||
|
||||
factory TypeRecipe.readFromDataSource(DataSource source) {
|
||||
factory TypeRecipe.readFromDataSource(DataSourceReader source) {
|
||||
TypeRecipe recipe;
|
||||
source.begin(tag);
|
||||
_TypeRecipeKind kind = source.readEnum(_TypeRecipeKind.values);
|
||||
|
@ -166,7 +166,7 @@ abstract class TypeRecipe {
|
|||
return recipe;
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeEnum(_kind);
|
||||
_writeToDataSink(sink);
|
||||
|
@ -174,7 +174,7 @@ abstract class TypeRecipe {
|
|||
}
|
||||
|
||||
_TypeRecipeKind get _kind;
|
||||
void _writeToDataSink(DataSink sink);
|
||||
void _writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns `true` is [recipeB] evaluated in an environment described by
|
||||
/// [structureB] gives the same type as [recipeA] evaluated in environment
|
||||
|
@ -203,7 +203,7 @@ class TypeExpressionRecipe extends TypeRecipe {
|
|||
|
||||
TypeExpressionRecipe(this.type);
|
||||
|
||||
static TypeExpressionRecipe _readFromDataSource(DataSource source) {
|
||||
static TypeExpressionRecipe _readFromDataSource(DataSourceReader source) {
|
||||
return TypeExpressionRecipe(source.readDartType());
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ class TypeExpressionRecipe extends TypeRecipe {
|
|||
_TypeRecipeKind get _kind => _TypeRecipeKind.expression;
|
||||
|
||||
@override
|
||||
void _writeToDataSink(DataSink sink) {
|
||||
void _writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeDartType(type);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,8 @@ class SingletonTypeEnvironmentRecipe extends TypeEnvironmentRecipe {
|
|||
|
||||
SingletonTypeEnvironmentRecipe(this.type);
|
||||
|
||||
static SingletonTypeEnvironmentRecipe _readFromDataSource(DataSource source) {
|
||||
static SingletonTypeEnvironmentRecipe _readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
return SingletonTypeEnvironmentRecipe(source.readDartType());
|
||||
}
|
||||
|
||||
|
@ -245,7 +246,7 @@ class SingletonTypeEnvironmentRecipe extends TypeEnvironmentRecipe {
|
|||
_TypeRecipeKind get _kind => _TypeRecipeKind.singletonEnvironment;
|
||||
|
||||
@override
|
||||
void _writeToDataSink(DataSink sink) {
|
||||
void _writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeDartType(type);
|
||||
}
|
||||
|
||||
|
@ -277,7 +278,8 @@ class FullTypeEnvironmentRecipe extends TypeEnvironmentRecipe {
|
|||
|
||||
FullTypeEnvironmentRecipe({this.classType, this.types = const []});
|
||||
|
||||
static FullTypeEnvironmentRecipe _readFromDataSource(DataSource source) {
|
||||
static FullTypeEnvironmentRecipe _readFromDataSource(
|
||||
DataSourceReader source) {
|
||||
InterfaceType classType =
|
||||
source.readDartType(allowNull: true) as InterfaceType;
|
||||
List<DartType> types = source.readDartTypes(emptyAsNull: true) ?? const [];
|
||||
|
@ -288,7 +290,7 @@ class FullTypeEnvironmentRecipe extends TypeEnvironmentRecipe {
|
|||
_TypeRecipeKind get _kind => _TypeRecipeKind.fullEnvironment;
|
||||
|
||||
@override
|
||||
void _writeToDataSink(DataSink sink) {
|
||||
void _writeToDataSink(DataSinkWriter sink) {
|
||||
sink.writeDartType(classType, allowNull: true);
|
||||
sink.writeDartTypes(types, allowNull: false);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ class NativeBehavior {
|
|||
NativeBehavior.internal(this.sideEffects);
|
||||
|
||||
/// Deserializes a [NativeBehavior] object from [source].
|
||||
factory NativeBehavior.readFromDataSource(DataSource source) {
|
||||
factory NativeBehavior.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
|
||||
List<Object> readTypes() {
|
||||
|
@ -233,7 +233,7 @@ class NativeBehavior {
|
|||
}
|
||||
|
||||
/// Serializes this [NativeBehavior] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
|
||||
void writeTypes(List<Object> types) {
|
||||
|
|
|
@ -38,7 +38,7 @@ class OrderedTypeSet {
|
|||
OrderedTypeSet.internal(this._levels, this.types);
|
||||
|
||||
/// Deserializes a [OrderedTypeSet] object from [source].
|
||||
factory OrderedTypeSet.readFromDataSource(DataSource source) {
|
||||
factory OrderedTypeSet.readFromDataSource(DataSourceReader source) {
|
||||
// TODO(johnniwinther): Make the deserialized type sets share their
|
||||
// internal links like the original type sets do?
|
||||
source.begin(tag);
|
||||
|
@ -63,7 +63,7 @@ class OrderedTypeSet {
|
|||
}
|
||||
|
||||
/// Serializes this [OrderedTypeSet] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
List<InterfaceType> typeList = types.toList();
|
||||
sink.writeInt(typeList.length);
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
part of 'serialization.dart';
|
||||
|
||||
/// [SinkWriter] that writes data as a sequence of bytes.
|
||||
/// [DataSink] that writes data as a sequence of bytes.
|
||||
///
|
||||
/// This data sink works together with [BinarySourceWriter].
|
||||
class BinarySinkWriter implements SinkWriter {
|
||||
class BinaryDataSink implements DataSink {
|
||||
final Sink<List<int>> sink;
|
||||
BufferedSink _bufferedSink;
|
||||
int _length = 0;
|
||||
|
||||
BinarySinkWriter(this.sink) : _bufferedSink = BufferedSink(sink);
|
||||
BinaryDataSink(this.sink) : _bufferedSink = BufferedSink(sink);
|
||||
|
||||
@override
|
||||
int get length => _length;
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
part of 'serialization.dart';
|
||||
|
||||
/// [SourceReader] that reads data from a sequence of bytes.
|
||||
/// [DataSource] that reads data from a sequence of bytes.
|
||||
///
|
||||
/// This data source works together with [BinarySinkWriter].
|
||||
class BinarySourceReader implements SourceReader {
|
||||
/// This data source works together with [BinaryDataSink].
|
||||
class BinaryDataSource implements DataSource {
|
||||
int _byteOffset = 0;
|
||||
final List<int> _bytes;
|
||||
final StringInterner _stringInterner;
|
||||
|
||||
BinarySourceReader(this._bytes, {StringInterner stringInterner})
|
||||
BinaryDataSource(this._bytes, {StringInterner stringInterner})
|
||||
: _stringInterner = stringInterner;
|
||||
|
||||
@override
|
||||
|
|
|
@ -66,7 +66,7 @@ enum _TypeParameterKind {
|
|||
functionNode,
|
||||
}
|
||||
|
||||
/// Class used for encoding tags in [ObjectSinkWriter] and [ObjectSourceReader].
|
||||
/// Class used for encoding tags in [ObjectDataSink] and [ObjectDataSource].
|
||||
class Tag {
|
||||
final String value;
|
||||
|
||||
|
@ -126,7 +126,7 @@ const String functionTypeNodeTag = 'function-type-node';
|
|||
|
||||
class DartTypeNodeWriter
|
||||
extends ir.DartTypeVisitor1<void, List<ir.TypeParameter>> {
|
||||
final DataSink _sink;
|
||||
final DataSinkWriter _sink;
|
||||
|
||||
DartTypeNodeWriter(this._sink);
|
||||
|
||||
|
@ -262,7 +262,7 @@ class DartTypeNodeWriter
|
|||
|
||||
/// Data sink helper that canonicalizes [E] values using indices.
|
||||
class IndexedSink<E> {
|
||||
final SinkWriter _sink;
|
||||
final DataSink _sink;
|
||||
Map<E, int> cache;
|
||||
|
||||
IndexedSink(this._sink, {this.cache}) {
|
||||
|
@ -293,7 +293,7 @@ class IndexedSink<E> {
|
|||
|
||||
/// Data source helper reads canonicalized [E] values through indices.
|
||||
class IndexedSource<E> {
|
||||
final SourceReader _sourceReader;
|
||||
final DataSource _sourceReader;
|
||||
List<E> cache;
|
||||
|
||||
IndexedSource(this._sourceReader, {this.cache}) {
|
||||
|
|
|
@ -7,11 +7,11 @@ part of 'serialization.dart';
|
|||
/// [DataSinkWriter] that writes to a list of objects, useful for debugging
|
||||
/// inconsistencies between serialization and deserialization.
|
||||
///
|
||||
/// This data sink writer works together with [ObjectSourceReader].
|
||||
class ObjectSinkWriter implements SinkWriter {
|
||||
/// This data sink writer works together with [ObjectDataSource].
|
||||
class ObjectDataSink implements DataSink {
|
||||
List<dynamic> _data;
|
||||
|
||||
ObjectSinkWriter(this._data);
|
||||
ObjectDataSink(this._data);
|
||||
|
||||
@override
|
||||
void beginTag(String tag) {
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
part of 'serialization.dart';
|
||||
|
||||
/// [SourceReader] that read from a list of objects, useful for debugging
|
||||
/// [DataSource] that read from a list of objects, useful for debugging
|
||||
/// inconsistencies between serialization and deserialization.
|
||||
///
|
||||
/// This data source works together with [ObjectSinkWriter].
|
||||
class ObjectSourceReader implements SourceReader {
|
||||
/// This data source works together with [ObjectDataSink].
|
||||
class ObjectDataSource implements DataSource {
|
||||
int _index = 0;
|
||||
final List<dynamic> _data;
|
||||
|
||||
ObjectSourceReader(this._data);
|
||||
ObjectDataSource(this._data);
|
||||
|
||||
T _read<T>() {
|
||||
dynamic value = _data[_index++];
|
||||
|
|
|
@ -37,7 +37,7 @@ abstract class StringInterner {
|
|||
}
|
||||
|
||||
/// Data class representing cache information for a given [T] which can be
|
||||
/// passed from a [DataSource] to other [DataSource]s and [DataSink]s.
|
||||
/// passed from a [DataSourceReader] to other [DataSourceReader]s and [DataSinkWriter]s.
|
||||
class DataSourceTypeIndices<E, T> {
|
||||
/// Reshapes a [List<T>] to a [Map<E, int>] using [_getValue].
|
||||
Map<E, int> _reshape() {
|
||||
|
@ -57,9 +57,9 @@ class DataSourceTypeIndices<E, T> {
|
|||
Map<E, int> _cache;
|
||||
|
||||
/// Though [DataSourceTypeIndices] supports two types of caches. If the
|
||||
/// exported indices are imported into a [DataSource] then the [cacheAsList]
|
||||
/// exported indices are imported into a [DataSourceReader] then the [cacheAsList]
|
||||
/// will be used as is. If, however, the exported indices are imported into a
|
||||
/// [DataSink] then we need to reshape the [List<T>] into a [Map<E, int>]
|
||||
/// [DataSinkWriter] then we need to reshape the [List<T>] into a [Map<E, int>]
|
||||
/// where [E] is either [T] or some value which can be derived from [T] by
|
||||
/// [_getValue].
|
||||
DataSourceTypeIndices(this.cacheAsList, [this._getValue]) {
|
||||
|
@ -69,7 +69,7 @@ class DataSourceTypeIndices<E, T> {
|
|||
}
|
||||
|
||||
/// Data class representing the sum of all cache information for a given
|
||||
/// [DataSource].
|
||||
/// [DataSourceReader].
|
||||
class DataSourceIndices {
|
||||
final Map<Type, DataSourceTypeIndices> caches = {};
|
||||
}
|
||||
|
@ -94,22 +94,22 @@ class EntityReader {
|
|||
const EntityReader();
|
||||
|
||||
IndexedLibrary readLibraryFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
return entityLookup.getLibraryByIndex(source.readInt());
|
||||
}
|
||||
|
||||
IndexedClass readClassFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
return entityLookup.getClassByIndex(source.readInt());
|
||||
}
|
||||
|
||||
IndexedMember readMemberFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
return entityLookup.getMemberByIndex(source.readInt());
|
||||
}
|
||||
|
||||
IndexedTypeVariable readTypeVariableFromDataSource(
|
||||
DataSource source, EntityLookup entityLookup) {
|
||||
DataSourceReader source, EntityLookup entityLookup) {
|
||||
return entityLookup.getTypeVariableByIndex(source.readInt());
|
||||
}
|
||||
}
|
||||
|
@ -118,19 +118,20 @@ class EntityReader {
|
|||
class EntityWriter {
|
||||
const EntityWriter();
|
||||
|
||||
void writeLibraryToDataSink(DataSink sink, IndexedLibrary value) {
|
||||
void writeLibraryToDataSink(DataSinkWriter sink, IndexedLibrary value) {
|
||||
sink.writeInt(value.libraryIndex);
|
||||
}
|
||||
|
||||
void writeClassToDataSink(DataSink sink, IndexedClass value) {
|
||||
void writeClassToDataSink(DataSinkWriter sink, IndexedClass value) {
|
||||
sink.writeInt(value.classIndex);
|
||||
}
|
||||
|
||||
void writeMemberToDataSink(DataSink sink, IndexedMember value) {
|
||||
void writeMemberToDataSink(DataSinkWriter sink, IndexedMember value) {
|
||||
sink.writeInt(value.memberIndex);
|
||||
}
|
||||
|
||||
void writeTypeVariableToDataSink(DataSink sink, IndexedTypeVariable value) {
|
||||
void writeTypeVariableToDataSink(
|
||||
DataSinkWriter sink, IndexedTypeVariable value) {
|
||||
sink.writeInt(value.typeVariableIndex);
|
||||
}
|
||||
}
|
||||
|
@ -142,16 +143,16 @@ abstract class LocalLookup {
|
|||
|
||||
/// Interface used for reading codegen only data during deserialization.
|
||||
abstract class CodegenReader {
|
||||
AbstractValue readAbstractValue(DataSource source);
|
||||
OutputUnit readOutputUnitReference(DataSource source);
|
||||
js.Node readJsNode(DataSource source);
|
||||
TypeRecipe readTypeRecipe(DataSource source);
|
||||
AbstractValue readAbstractValue(DataSourceReader source);
|
||||
OutputUnit readOutputUnitReference(DataSourceReader source);
|
||||
js.Node readJsNode(DataSourceReader source);
|
||||
TypeRecipe readTypeRecipe(DataSourceReader source);
|
||||
}
|
||||
|
||||
/// Interface used for writing codegen only data during serialization.
|
||||
abstract class CodegenWriter {
|
||||
void writeAbstractValue(DataSink sink, AbstractValue value);
|
||||
void writeOutputUnitReference(DataSink sink, OutputUnit value);
|
||||
void writeJsNode(DataSink sink, js.Node node);
|
||||
void writeTypeRecipe(DataSink sink, TypeRecipe recipe);
|
||||
void writeAbstractValue(DataSinkWriter sink, AbstractValue value);
|
||||
void writeOutputUnitReference(DataSinkWriter sink, OutputUnit value);
|
||||
void writeJsNode(DataSinkWriter sink, js.Node node);
|
||||
void writeTypeRecipe(DataSinkWriter sink, TypeRecipe recipe);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
part of 'serialization.dart';
|
||||
|
||||
/// Interface handling [DataSink] low-level data serialization.
|
||||
/// Interface handling [DataSinkWriter] low-level data serialization.
|
||||
///
|
||||
/// Each implementation of [SinkWriter] should have a corresponding
|
||||
/// [SourceReader] that deserializes data serialized by that implementation.
|
||||
abstract class SinkWriter {
|
||||
/// Each implementation of [DataSink] should have a corresponding
|
||||
/// [DataSource] that deserializes data serialized by that implementation.
|
||||
abstract class DataSink {
|
||||
int get length;
|
||||
|
||||
/// Serialization of a non-negative integer value.
|
||||
|
@ -32,10 +32,10 @@ abstract class SinkWriter {
|
|||
|
||||
/// Serialization writer
|
||||
///
|
||||
/// To be used with [DataSource] to read and write serialized data.
|
||||
/// Serialization format is deferred to provided [SinkWriter].
|
||||
class DataSink {
|
||||
final SinkWriter _sinkWriter;
|
||||
/// To be used with [DataSourceReader] to read and write serialized data.
|
||||
/// Serialization format is deferred to provided [DataSink].
|
||||
class DataSinkWriter {
|
||||
final DataSink _sinkWriter;
|
||||
|
||||
/// If `true`, serialization of every data kind is preceded by a [DataKind]
|
||||
/// value.
|
||||
|
@ -80,7 +80,7 @@ class DataSink {
|
|||
}
|
||||
}
|
||||
|
||||
DataSink(this._sinkWriter,
|
||||
DataSinkWriter(this._sinkWriter,
|
||||
{this.useDataKinds = false, this.tagFrequencyMap, this.importedIndices}) {
|
||||
_dartTypeNodeWriter = DartTypeNodeWriter(this);
|
||||
_stringIndex = _createSink<String>();
|
||||
|
@ -143,7 +143,7 @@ class DataSink {
|
|||
/// non-null [f] is called to write the non-null value to the data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readValueOrNull].
|
||||
/// [DataSourceReader.readValueOrNull].
|
||||
void writeValueOrNull<E>(E value, void f(E value)) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -155,7 +155,7 @@ class DataSink {
|
|||
/// the data sink. If [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readList].
|
||||
/// [DataSourceReader.readList].
|
||||
void writeList<E>(Iterable<E> values, void f(E value),
|
||||
{bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
|
@ -189,7 +189,7 @@ class DataSink {
|
|||
/// Writes the potentially `null` non-negative [value] to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readIntOrNull].
|
||||
/// [DataSourceReader.readIntOrNull].
|
||||
void writeIntOrNull(int value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -211,7 +211,7 @@ class DataSink {
|
|||
/// Writes the potentially `null` string [value] to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readStringOrNull].
|
||||
/// [DataSourceReader.readStringOrNull].
|
||||
void writeStringOrNull(String value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -224,7 +224,7 @@ class DataSink {
|
|||
/// allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readStringMap].
|
||||
/// [DataSourceReader.readStringMap].
|
||||
void writeStringMap<V>(Map<String, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -243,7 +243,7 @@ class DataSink {
|
|||
/// [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readStrings].
|
||||
/// [DataSourceReader.readStrings].
|
||||
void writeStrings(Iterable<String> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -339,7 +339,7 @@ class DataSink {
|
|||
/// If [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readMemberNodes].
|
||||
/// [DataSourceReader.readMemberNodes].
|
||||
void writeMemberNodes(Iterable<ir.Member> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -357,7 +357,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readMemberNodeMap].
|
||||
/// [DataSourceReader.readMemberNodeMap].
|
||||
void writeMemberNodeMap<V>(Map<ir.Member, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -437,7 +437,7 @@ class DataSink {
|
|||
/// to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodeOrNull].
|
||||
/// [DataSourceReader.readTreeNodeOrNull].
|
||||
void writeTreeNodeOrNull(ir.TreeNode value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -449,7 +449,7 @@ class DataSink {
|
|||
/// If [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodes].
|
||||
/// [DataSourceReader.readTreeNodes].
|
||||
void writeTreeNodes(Iterable<ir.TreeNode> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -467,7 +467,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodeMap].
|
||||
/// [DataSourceReader.readTreeNodeMap].
|
||||
void writeTreeNodeMap<V>(Map<ir.TreeNode, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -498,7 +498,7 @@ class DataSink {
|
|||
/// the known [context] to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodeOrNullInContext].
|
||||
/// [DataSourceReader.readTreeNodeOrNullInContext].
|
||||
void writeTreeNodeOrNullInContext(ir.TreeNode value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -511,7 +511,7 @@ class DataSink {
|
|||
/// `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodesInContext].
|
||||
/// [DataSourceReader.readTreeNodesInContext].
|
||||
void writeTreeNodesInContext(Iterable<ir.TreeNode> values,
|
||||
{bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
|
@ -530,7 +530,7 @@ class DataSink {
|
|||
/// data sink. If [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTreeNodeMapInContext].
|
||||
/// [DataSourceReader.readTreeNodeMapInContext].
|
||||
void writeTreeNodeMapInContext<V>(Map<ir.TreeNode, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -573,7 +573,7 @@ class DataSink {
|
|||
/// If [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTypeParameterNodes].
|
||||
/// [DataSourceReader.readTypeParameterNodes].
|
||||
void writeTypeParameterNodes(Iterable<ir.TypeParameter> values,
|
||||
{bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
|
@ -611,7 +611,7 @@ class DataSink {
|
|||
/// [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readDartTypes].
|
||||
/// [DataSourceReader.readDartTypes].
|
||||
void writeDartTypes(Iterable<DartType> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -648,7 +648,7 @@ class DataSink {
|
|||
/// `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readDartTypeNodes].
|
||||
/// [DataSourceReader.readDartTypeNodes].
|
||||
void writeDartTypeNodes(Iterable<ir.DartType> values,
|
||||
{bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
|
@ -679,7 +679,7 @@ class DataSink {
|
|||
/// to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readLibraryOrNull].
|
||||
/// [DataSourceReader.readLibraryOrNull].
|
||||
void writeLibraryOrNull(IndexedLibrary value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -692,7 +692,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readLibraryMap].
|
||||
/// [DataSourceReader.readLibraryMap].
|
||||
void writeLibraryMap<V>(Map<LibraryEntity, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -716,7 +716,7 @@ class DataSink {
|
|||
/// to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readClassOrNull].
|
||||
/// [DataSourceReader.readClassOrNull].
|
||||
void writeClassOrNull(IndexedClass value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -728,7 +728,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readClasses].
|
||||
/// [DataSourceReader.readClasses].
|
||||
void writeClasses(Iterable<ClassEntity> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -746,7 +746,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readClassMap].
|
||||
/// [DataSourceReader.readClassMap].
|
||||
void writeClassMap<V>(Map<ClassEntity, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -770,7 +770,7 @@ class DataSink {
|
|||
/// to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readMemberOrNull].
|
||||
/// [DataSourceReader.readMemberOrNull].
|
||||
void writeMemberOrNull(IndexedMember value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -782,7 +782,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readMembers].
|
||||
/// [DataSourceReader.readMembers].
|
||||
void writeMembers(Iterable<MemberEntity> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -800,7 +800,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readMemberMap].
|
||||
/// [DataSourceReader.readMemberMap].
|
||||
void writeMemberMap<V>(
|
||||
Map<MemberEntity, V> map, void f(MemberEntity member, V value),
|
||||
{bool allowNull = false}) {
|
||||
|
@ -826,7 +826,7 @@ class DataSink {
|
|||
/// [allowNull] is `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readTypeVariableMap].
|
||||
/// [DataSourceReader.readTypeVariableMap].
|
||||
void writeTypeVariableMap<V>(Map<IndexedTypeVariable, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -868,7 +868,7 @@ class DataSink {
|
|||
/// to this data sink.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readLocalOrNull].
|
||||
/// [DataSourceReader.readLocalOrNull].
|
||||
void writeLocalOrNull(Local value) {
|
||||
writeBool(value != null);
|
||||
if (value != null) {
|
||||
|
@ -880,7 +880,7 @@ class DataSink {
|
|||
/// is `true`, [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readLocals].
|
||||
/// [DataSourceReader.readLocals].
|
||||
void writeLocals(Iterable<Local> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -898,7 +898,7 @@ class DataSink {
|
|||
/// `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readLocalMap].
|
||||
/// [DataSourceReader.readLocalMap].
|
||||
void writeLocalMap<V>(Map<Local, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -1019,7 +1019,7 @@ class DataSink {
|
|||
/// [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readConstants].
|
||||
/// [DataSourceReader.readConstants].
|
||||
void writeConstants(Iterable<ConstantValue> values,
|
||||
{bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
|
@ -1038,7 +1038,7 @@ class DataSink {
|
|||
/// `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readConstantMap].
|
||||
/// [DataSourceReader.readConstantMap].
|
||||
void writeConstantMap<V>(Map<ConstantValue, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
@ -1111,7 +1111,7 @@ class DataSink {
|
|||
/// [values] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readImports].
|
||||
/// [DataSourceReader.readImports].
|
||||
void writeImports(Iterable<ImportEntity> values, {bool allowNull = false}) {
|
||||
if (values == null) {
|
||||
assert(allowNull);
|
||||
|
@ -1129,7 +1129,7 @@ class DataSink {
|
|||
/// `true`, [map] is allowed to be `null`.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSource.readImportMap].
|
||||
/// [DataSourceReader.readImportMap].
|
||||
void writeImportMap<V>(Map<ImportEntity, V> map, void f(V value),
|
||||
{bool allowNull = false}) {
|
||||
if (map == null) {
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
part of 'serialization.dart';
|
||||
|
||||
/// Interface handling [DataSource] low-level data deserialization.
|
||||
/// Interface handling [DataSourceReader] low-level data deserialization.
|
||||
///
|
||||
/// Each implementation of [SourceReader] should have a corresponding
|
||||
/// [SinkWriter] for which it deserializes data.
|
||||
abstract class SourceReader {
|
||||
/// Each implementation of [DataSource] should have a corresponding
|
||||
/// [DataSink] for which it deserializes data.
|
||||
abstract class DataSource {
|
||||
/// Deserialization of a section begin tag.
|
||||
void begin(String tag);
|
||||
|
||||
|
@ -32,10 +32,10 @@ abstract class SourceReader {
|
|||
|
||||
/// Deserialization reader
|
||||
///
|
||||
/// To be used with [DataSink] to read and write serialized data.
|
||||
/// Deserialization format is deferred to provided [SourceReader].
|
||||
class DataSource {
|
||||
final SourceReader _sourceReader;
|
||||
/// To be used with [DataSinkWriter] to read and write serialized data.
|
||||
/// Deserialization format is deferred to provided [DataSource].
|
||||
class DataSourceReader {
|
||||
final DataSource _sourceReader;
|
||||
|
||||
static final List<ir.DartType> emptyListOfDartTypes =
|
||||
List<ir.DartType>.filled(0, null, growable: false);
|
||||
|
@ -68,7 +68,7 @@ class DataSource {
|
|||
}
|
||||
}
|
||||
|
||||
DataSource(this._sourceReader,
|
||||
DataSourceReader(this._sourceReader,
|
||||
{this.useDataKinds = false, this.importedIndices}) {
|
||||
_stringIndex = _createSource<String>();
|
||||
_uriIndex = _createSource<Uri>();
|
||||
|
@ -77,8 +77,8 @@ class DataSource {
|
|||
_constantIndex = _createSource<ConstantValue>();
|
||||
}
|
||||
|
||||
/// Exports [DataSourceIndices] for use in other [DataSource]s and
|
||||
/// [DataSink]s.
|
||||
/// Exports [DataSourceIndices] for use in other [DataSourceReader]s and
|
||||
/// [DataSinkWriter]s.
|
||||
DataSourceIndices exportIndices() {
|
||||
var indices = DataSourceIndices();
|
||||
indices.caches[String] = DataSourceTypeIndices(_stringIndex.cache);
|
||||
|
@ -200,7 +200,7 @@ class DataSource {
|
|||
/// read the non-null value from the data source.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeValueOrNull].
|
||||
/// [DataSinkWriter.writeValueOrNull].
|
||||
E readValueOrNull<E>(E f()) {
|
||||
bool hasValue = readBool();
|
||||
if (hasValue) {
|
||||
|
@ -213,7 +213,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeList].
|
||||
/// [DataSinkWriter.writeList].
|
||||
List<E> readList<E>(E f(), {bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -246,7 +246,7 @@ class DataSource {
|
|||
/// source.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeIntOrNull].
|
||||
/// [DataSinkWriter.writeIntOrNull].
|
||||
int readIntOrNull() {
|
||||
bool hasValue = readBool();
|
||||
if (hasValue) {
|
||||
|
@ -268,7 +268,7 @@ class DataSource {
|
|||
/// Reads a potentially `null` string value from this data source.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeStringOrNull].
|
||||
/// [DataSinkWriter.writeStringOrNull].
|
||||
String readStringOrNull() {
|
||||
bool hasValue = readBool();
|
||||
if (hasValue) {
|
||||
|
@ -281,7 +281,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeStrings].
|
||||
/// [DataSinkWriter.writeStrings].
|
||||
List<String> readStrings({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -297,7 +297,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeStringMap].
|
||||
/// [DataSinkWriter.writeStringMap].
|
||||
Map<String, V> readStringMap<V>(V f(), {bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -402,7 +402,7 @@ class DataSource {
|
|||
/// If [emptyAsNull] is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeMemberNodes].
|
||||
/// [DataSinkWriter.writeMemberNodes].
|
||||
List<E> readMemberNodes<E extends ir.Member>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -419,7 +419,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeMemberNodeMap].
|
||||
/// [DataSinkWriter.writeMemberNodeMap].
|
||||
Map<K, V> readMemberNodeMap<K extends ir.Member, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -506,7 +506,7 @@ class DataSource {
|
|||
/// If [emptyAsNull] is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTreeNodes].
|
||||
/// [DataSinkWriter.writeTreeNodes].
|
||||
List<E> readTreeNodes<E extends ir.TreeNode>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -523,7 +523,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTreeNodeMap].
|
||||
/// [DataSinkWriter.writeTreeNodeMap].
|
||||
Map<K, V> readTreeNodeMap<K extends ir.TreeNode, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -563,7 +563,7 @@ class DataSource {
|
|||
/// instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTreeNodesInContext].
|
||||
/// [DataSinkWriter.writeTreeNodesInContext].
|
||||
List<E> readTreeNodesInContext<E extends ir.TreeNode>(
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -582,7 +582,7 @@ class DataSource {
|
|||
/// map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTreeNodeMapInContext].
|
||||
/// [DataSinkWriter.writeTreeNodeMapInContext].
|
||||
Map<K, V> readTreeNodeMapInContext<K extends ir.TreeNode, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -620,7 +620,7 @@ class DataSource {
|
|||
/// list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTypeParameterNodes].
|
||||
/// [DataSinkWriter.writeTypeParameterNodes].
|
||||
List<ir.TypeParameter> readTypeParameterNodes({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -644,7 +644,7 @@ class DataSource {
|
|||
/// `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeDartTypes].
|
||||
/// [DataSinkWriter.writeDartTypes].
|
||||
List<DartType> readDartTypes({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -771,7 +771,7 @@ class DataSource {
|
|||
/// is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeDartTypeNodes].
|
||||
/// [DataSinkWriter.writeDartTypeNodes].
|
||||
List<ir.DartType> readDartTypeNodes({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -823,7 +823,7 @@ class DataSource {
|
|||
/// map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeLibraryMap].
|
||||
/// [DataSinkWriter.writeLibraryMap].
|
||||
Map<K, V> readLibraryMap<K extends LibraryEntity, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -856,7 +856,7 @@ class DataSource {
|
|||
/// If [emptyAsNull] is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeClasses].
|
||||
/// [DataSinkWriter.writeClasses].
|
||||
List<E> readClasses<E extends ClassEntity>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -873,7 +873,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeClassMap].
|
||||
/// [DataSinkWriter.writeClassMap].
|
||||
Map<K, V> readClassMap<K extends ClassEntity, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -906,7 +906,7 @@ class DataSource {
|
|||
/// If [emptyAsNull] is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeMembers].
|
||||
/// [DataSinkWriter.writeMembers].
|
||||
List<E> readMembers<E extends MemberEntity>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -923,7 +923,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeMemberMap].
|
||||
/// [DataSinkWriter.writeMemberMap].
|
||||
Map<K, V> readMemberMap<K extends MemberEntity, V>(V f(MemberEntity member),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -947,7 +947,7 @@ class DataSource {
|
|||
/// [emptyAsNull] is `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeTypeVariableMap].
|
||||
/// [DataSinkWriter.writeTypeVariableMap].
|
||||
Map<K, V> readTypeVariableMap<K extends IndexedTypeVariable, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -998,7 +998,7 @@ class DataSource {
|
|||
/// [emptyAsNull] is `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeLocals].
|
||||
/// [DataSinkWriter.writeLocals].
|
||||
List<E> readLocals<E extends Local>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -1015,7 +1015,7 @@ class DataSource {
|
|||
/// `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeLocalMap].
|
||||
/// [DataSinkWriter.writeLocalMap].
|
||||
Map<K, V> readLocalMap<K extends Local, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -1124,7 +1124,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeConstants].
|
||||
/// [DataSinkWriter.writeConstants].
|
||||
List<E> readConstants<E extends ConstantValue>({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -1141,7 +1141,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeConstantMap].
|
||||
/// [DataSinkWriter.writeConstantMap].
|
||||
Map<K, V> readConstantMap<K extends ConstantValue, V>(V f(),
|
||||
{bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
|
@ -1214,7 +1214,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty list.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeImports].
|
||||
/// [DataSinkWriter.writeImports].
|
||||
List<ImportEntity> readImports({bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
@ -1230,7 +1230,7 @@ class DataSource {
|
|||
/// `true`, `null` is returned instead of an empty map.
|
||||
///
|
||||
/// This is a convenience method to be used together with
|
||||
/// [DataSink.writeImportMap].
|
||||
/// [DataSinkWriter.writeImportMap].
|
||||
Map<ImportEntity, V> readImportMap<V>(V f(), {bool emptyAsNull = false}) {
|
||||
int count = readInt();
|
||||
if (count == 0 && emptyAsNull) return null;
|
||||
|
|
|
@ -73,7 +73,7 @@ class BytesInMemorySerializationStrategy extends SerializationStrategy<int> {
|
|||
List<int> serializeGlobalTypeInferenceResults(
|
||||
DataSourceIndices indices, GlobalTypeInferenceResults results) {
|
||||
ByteSink byteSink = ByteSink();
|
||||
DataSink sink = DataSink(BinarySinkWriter(byteSink),
|
||||
DataSinkWriter sink = DataSinkWriter(BinaryDataSink(byteSink),
|
||||
useDataKinds: useDataKinds, importedIndices: indices);
|
||||
serializeGlobalTypeInferenceResultsToSink(results, sink);
|
||||
return byteSink.builder.takeBytes();
|
||||
|
@ -89,8 +89,8 @@ class BytesInMemorySerializationStrategy extends SerializationStrategy<int> {
|
|||
JsClosedWorld closedWorld,
|
||||
DataSourceIndices indices,
|
||||
List<int> globalTypeInferenceResultsData) {
|
||||
DataSource globalTypeInferenceResultsSource = DataSource(
|
||||
BinarySourceReader(globalTypeInferenceResultsData),
|
||||
DataSourceReader globalTypeInferenceResultsSource = DataSourceReader(
|
||||
BinaryDataSource(globalTypeInferenceResultsData),
|
||||
useDataKinds: useDataKinds,
|
||||
importedIndices: indices);
|
||||
return deserializeGlobalTypeInferenceResultsFromSource(
|
||||
|
@ -106,8 +106,8 @@ class BytesInMemorySerializationStrategy extends SerializationStrategy<int> {
|
|||
@override
|
||||
List<int> serializeClosedWorld(JsClosedWorld closedWorld) {
|
||||
ByteSink byteSink = ByteSink();
|
||||
DataSink sink =
|
||||
DataSink(BinarySinkWriter(byteSink), useDataKinds: useDataKinds);
|
||||
DataSinkWriter sink =
|
||||
DataSinkWriter(BinaryDataSink(byteSink), useDataKinds: useDataKinds);
|
||||
serializeClosedWorldToSink(closedWorld, sink);
|
||||
return byteSink.builder.takeBytes();
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ class BytesInMemorySerializationStrategy extends SerializationStrategy<int> {
|
|||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
List<int> data) {
|
||||
DataSource source =
|
||||
DataSource(BinarySourceReader(data), useDataKinds: useDataKinds);
|
||||
DataSourceReader source =
|
||||
DataSourceReader(BinaryDataSource(data), useDataKinds: useDataKinds);
|
||||
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
|
||||
environment, abstractValueStrategy, component, source);
|
||||
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
|
||||
|
@ -137,8 +137,8 @@ class BytesOnDiskSerializationStrategy extends SerializationStrategy<int> {
|
|||
List<int> serializeGlobalTypeInferenceResults(
|
||||
DataSourceIndices indices, GlobalTypeInferenceResults results) {
|
||||
Uri uri = Uri.base.resolve('world.data');
|
||||
DataSink sink = DataSink(
|
||||
BinarySinkWriter(
|
||||
DataSinkWriter sink = DataSinkWriter(
|
||||
BinaryDataSink(
|
||||
BinaryOutputSinkAdapter(RandomAccessBinaryOutputSink(uri))),
|
||||
useDataKinds: useDataKinds,
|
||||
importedIndices: indices);
|
||||
|
@ -156,8 +156,8 @@ class BytesOnDiskSerializationStrategy extends SerializationStrategy<int> {
|
|||
JsClosedWorld closedWorld,
|
||||
DataSourceIndices indices,
|
||||
List<int> globalTypeInferenceResultsData) {
|
||||
DataSource globalTypeInferenceResultsSource = DataSource(
|
||||
BinarySourceReader(globalTypeInferenceResultsData),
|
||||
DataSourceReader globalTypeInferenceResultsSource = DataSourceReader(
|
||||
BinaryDataSource(globalTypeInferenceResultsData),
|
||||
useDataKinds: useDataKinds,
|
||||
importedIndices: indices);
|
||||
return deserializeGlobalTypeInferenceResultsFromSource(
|
||||
|
@ -173,8 +173,8 @@ class BytesOnDiskSerializationStrategy extends SerializationStrategy<int> {
|
|||
@override
|
||||
List<int> serializeClosedWorld(JsClosedWorld closedWorld) {
|
||||
Uri uri = Uri.base.resolve('closed_world.data');
|
||||
DataSink sink = DataSink(
|
||||
BinarySinkWriter(
|
||||
DataSinkWriter sink = DataSinkWriter(
|
||||
BinaryDataSink(
|
||||
BinaryOutputSinkAdapter(RandomAccessBinaryOutputSink(uri))),
|
||||
useDataKinds: useDataKinds);
|
||||
serializeClosedWorldToSink(closedWorld, sink);
|
||||
|
@ -189,8 +189,8 @@ class BytesOnDiskSerializationStrategy extends SerializationStrategy<int> {
|
|||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
List<int> data) {
|
||||
DataSource source =
|
||||
DataSource(BinarySourceReader(data), useDataKinds: useDataKinds);
|
||||
DataSourceReader source =
|
||||
DataSourceReader(BinaryDataSource(data), useDataKinds: useDataKinds);
|
||||
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
|
||||
environment, abstractValueStrategy, component, source);
|
||||
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
|
||||
|
@ -207,7 +207,7 @@ class ObjectsInMemorySerializationStrategy
|
|||
List<Object> serializeGlobalTypeInferenceResults(
|
||||
DataSourceIndices indices, GlobalTypeInferenceResults results) {
|
||||
List<Object> data = [];
|
||||
DataSink sink = DataSink(ObjectSinkWriter(data),
|
||||
DataSinkWriter sink = DataSinkWriter(ObjectDataSink(data),
|
||||
useDataKinds: useDataKinds, importedIndices: indices);
|
||||
serializeGlobalTypeInferenceResultsToSink(results, sink);
|
||||
return data;
|
||||
|
@ -223,8 +223,8 @@ class ObjectsInMemorySerializationStrategy
|
|||
JsClosedWorld closedWorld,
|
||||
DataSourceIndices indices,
|
||||
List<Object> globalTypeInferenceResultsData) {
|
||||
DataSource globalTypeInferenceResultsSource =
|
||||
DataSource(ObjectSourceReader(globalTypeInferenceResultsData));
|
||||
DataSourceReader globalTypeInferenceResultsSource =
|
||||
DataSourceReader(ObjectDataSource(globalTypeInferenceResultsData));
|
||||
return deserializeGlobalTypeInferenceResultsFromSource(
|
||||
options,
|
||||
reporter,
|
||||
|
@ -238,8 +238,8 @@ class ObjectsInMemorySerializationStrategy
|
|||
@override
|
||||
List<Object> serializeClosedWorld(JsClosedWorld closedWorld) {
|
||||
List<Object> data = [];
|
||||
DataSink sink =
|
||||
DataSink(ObjectSinkWriter(data), useDataKinds: useDataKinds);
|
||||
DataSinkWriter sink =
|
||||
DataSinkWriter(ObjectDataSink(data), useDataKinds: useDataKinds);
|
||||
serializeClosedWorldToSink(closedWorld, sink);
|
||||
return data;
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ class ObjectsInMemorySerializationStrategy
|
|||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
List<Object> data) {
|
||||
DataSource source =
|
||||
DataSource(ObjectSourceReader(data), useDataKinds: useDataKinds);
|
||||
DataSourceReader source =
|
||||
DataSourceReader(ObjectDataSource(data), useDataKinds: useDataKinds);
|
||||
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
|
||||
environment, abstractValueStrategy, component, source);
|
||||
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
|
||||
|
|
|
@ -38,7 +38,7 @@ class ClosedWorldAndIndices {
|
|||
}
|
||||
|
||||
void serializeGlobalTypeInferenceResultsToSink(
|
||||
GlobalTypeInferenceResults results, DataSink sink) {
|
||||
GlobalTypeInferenceResults results, DataSinkWriter sink) {
|
||||
JsClosedWorld closedWorld = results.closedWorld;
|
||||
GlobalLocalsMap globalLocalsMap = results.globalLocalsMap;
|
||||
InferredData inferredData = results.inferredData;
|
||||
|
@ -55,7 +55,7 @@ GlobalTypeInferenceResults deserializeGlobalTypeInferenceResultsFromSource(
|
|||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
JsClosedWorld closedWorld,
|
||||
DataSource source) {
|
||||
DataSourceReader source) {
|
||||
source.registerComponentLookup(ComponentLookup(component));
|
||||
source.registerEntityLookup(ClosedEntityLookup(closedWorld.elementMap));
|
||||
GlobalLocalsMap globalLocalsMap = GlobalLocalsMap.readFromDataSource(
|
||||
|
@ -66,7 +66,8 @@ GlobalTypeInferenceResults deserializeGlobalTypeInferenceResultsFromSource(
|
|||
closedWorld.elementMap, closedWorld, globalLocalsMap, inferredData);
|
||||
}
|
||||
|
||||
void serializeClosedWorldToSink(JsClosedWorld closedWorld, DataSink sink) {
|
||||
void serializeClosedWorldToSink(
|
||||
JsClosedWorld closedWorld, DataSinkWriter sink) {
|
||||
closedWorld.writeToDataSink(sink);
|
||||
sink.close();
|
||||
}
|
||||
|
@ -77,7 +78,7 @@ JsClosedWorld deserializeClosedWorldFromSource(
|
|||
Environment environment,
|
||||
AbstractValueStrategy abstractValueStrategy,
|
||||
ir.Component component,
|
||||
DataSource source) {
|
||||
DataSourceReader source) {
|
||||
return JsClosedWorld.readFromDataSource(
|
||||
options, reporter, environment, abstractValueStrategy, component, source);
|
||||
}
|
||||
|
@ -177,8 +178,8 @@ class SerializationTask extends CompilerTask {
|
|||
_reporter.log('Writing data to ${_options.writeModularAnalysisUri}');
|
||||
api.BinaryOutputSink dataOutput =
|
||||
_outputProvider.createBinarySink(_options.writeModularAnalysisUri);
|
||||
DataSink sink =
|
||||
DataSink(BinarySinkWriter(BinaryOutputSinkAdapter(dataOutput)));
|
||||
DataSinkWriter sink =
|
||||
DataSinkWriter(BinaryDataSink(BinaryOutputSinkAdapter(dataOutput)));
|
||||
data.toDataSink(sink);
|
||||
sink.close();
|
||||
});
|
||||
|
@ -197,11 +198,11 @@ class SerializationTask extends CompilerTask {
|
|||
// ModuleData.fromDataSource(source);
|
||||
|
||||
BytesSink bytes = BytesSink();
|
||||
DataSink binarySink =
|
||||
DataSink(BinarySinkWriter(bytes), useDataKinds: true);
|
||||
DataSinkWriter binarySink =
|
||||
DataSinkWriter(BinaryDataSink(bytes), useDataKinds: true);
|
||||
data.toDataSink(binarySink);
|
||||
binarySink.close();
|
||||
var source = DataSource(BinarySourceReader(bytes.builder.toBytes()),
|
||||
var source = DataSourceReader(BinaryDataSource(bytes.builder.toBytes()),
|
||||
useDataKinds: true);
|
||||
source.registerComponentLookup(ComponentLookup(component));
|
||||
ModuleData.fromDataSource(source);
|
||||
|
@ -215,7 +216,8 @@ class SerializationTask extends CompilerTask {
|
|||
for (Uri uri in _options.modularAnalysisInputs) {
|
||||
api.Input<List<int>> dataInput =
|
||||
await _provider.readFromUri(uri, inputKind: api.InputKind.binary);
|
||||
DataSource source = DataSource(BinarySourceReader(dataInput.data));
|
||||
DataSourceReader source =
|
||||
DataSourceReader(BinaryDataSource(dataInput.data));
|
||||
source.registerComponentLookup(ComponentLookup(component));
|
||||
results.add(ModuleData.fromDataSource(source));
|
||||
}
|
||||
|
@ -228,8 +230,8 @@ class SerializationTask extends CompilerTask {
|
|||
_reporter.log('Writing closed world to ${_options.writeClosedWorldUri}');
|
||||
api.BinaryOutputSink dataOutput =
|
||||
_outputProvider.createBinarySink(_options.writeClosedWorldUri);
|
||||
DataSink sink =
|
||||
DataSink(BinarySinkWriter(BinaryOutputSinkAdapter(dataOutput)));
|
||||
DataSinkWriter sink =
|
||||
DataSinkWriter(BinaryDataSink(BinaryOutputSinkAdapter(dataOutput)));
|
||||
serializeClosedWorldToSink(closedWorld, sink);
|
||||
});
|
||||
}
|
||||
|
@ -243,8 +245,8 @@ class SerializationTask extends CompilerTask {
|
|||
api.Input<List<int>> dataInput = await _provider.readFromUri(
|
||||
_options.readClosedWorldUri,
|
||||
inputKind: api.InputKind.binary);
|
||||
DataSource source = DataSource(
|
||||
BinarySourceReader(dataInput.data, stringInterner: _stringInterner));
|
||||
DataSourceReader source = DataSourceReader(
|
||||
BinaryDataSource(dataInput.data, stringInterner: _stringInterner));
|
||||
var closedWorld = deserializeClosedWorldFromSource(_options, _reporter,
|
||||
environment, abstractValueStrategy, component, source);
|
||||
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
|
||||
|
@ -261,8 +263,8 @@ class SerializationTask extends CompilerTask {
|
|||
_reporter.log('Writing data to ${_options.writeDataUri}');
|
||||
api.BinaryOutputSink dataOutput =
|
||||
_outputProvider.createBinarySink(_options.writeDataUri);
|
||||
DataSink sink = DataSink(
|
||||
BinarySinkWriter(BinaryOutputSinkAdapter(dataOutput)),
|
||||
DataSinkWriter sink = DataSinkWriter(
|
||||
BinaryDataSink(BinaryOutputSinkAdapter(dataOutput)),
|
||||
importedIndices: indices);
|
||||
serializeGlobalTypeInferenceResultsToSink(results, sink);
|
||||
});
|
||||
|
@ -277,8 +279,8 @@ class SerializationTask extends CompilerTask {
|
|||
_reporter.log('Reading data from ${_options.readDataUri}');
|
||||
api.Input<List<int>> dataInput = await _provider
|
||||
.readFromUri(_options.readDataUri, inputKind: api.InputKind.binary);
|
||||
DataSource source = DataSource(
|
||||
BinarySourceReader(dataInput.data, stringInterner: _stringInterner),
|
||||
DataSourceReader source = DataSourceReader(
|
||||
BinaryDataSource(dataInput.data, stringInterner: _stringInterner),
|
||||
importedIndices: closedWorldAndIndices.indices);
|
||||
return deserializeGlobalTypeInferenceResultsFromSource(
|
||||
_options,
|
||||
|
@ -311,8 +313,8 @@ class SerializationTask extends CompilerTask {
|
|||
measureSubtask('serialize codegen', () {
|
||||
Uri uri = Uri.parse('${_options.writeCodegenUri}$shard');
|
||||
api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(uri);
|
||||
DataSink sink = DataSink(
|
||||
BinarySinkWriter(BinaryOutputSinkAdapter(dataOutput)),
|
||||
DataSinkWriter sink = DataSinkWriter(
|
||||
BinaryDataSink(BinaryOutputSinkAdapter(dataOutput)),
|
||||
importedIndices: indices);
|
||||
_reporter.log('Writing data to ${uri}');
|
||||
sink.registerEntityWriter(entityWriter);
|
||||
|
@ -357,8 +359,8 @@ class SerializationTask extends CompilerTask {
|
|||
api.Input<List<int>> dataInput,
|
||||
DataSourceIndices importedIndices,
|
||||
Map<MemberEntity, CodegenResult> results) {
|
||||
DataSource source = DataSource(
|
||||
BinarySourceReader(dataInput.data, stringInterner: _stringInterner),
|
||||
DataSourceReader source = DataSourceReader(
|
||||
BinaryDataSource(dataInput.data, stringInterner: _stringInterner),
|
||||
importedIndices: importedIndices);
|
||||
backendStrategy.prepareCodegenReader(source);
|
||||
Map<MemberEntity, CodegenResult> codegenResults =
|
||||
|
|
|
@ -82,7 +82,7 @@ class CallStructure {
|
|||
}
|
||||
|
||||
/// Deserializes a [CallStructure] object from [source].
|
||||
factory CallStructure.readFromDataSource(DataSource source) {
|
||||
factory CallStructure.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
int argumentCount = source.readInt();
|
||||
List<String> namedArguments = source.readStrings();
|
||||
|
@ -92,7 +92,7 @@ class CallStructure {
|
|||
}
|
||||
|
||||
/// Serializes this [CallStructure] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(argumentCount);
|
||||
sink.writeStrings(namedArguments);
|
||||
|
|
|
@ -15,11 +15,11 @@ import 'class_set.dart';
|
|||
abstract class ClassHierarchy {
|
||||
/// Deserializes a [ClassHierarchy] object from [source].
|
||||
factory ClassHierarchy.readFromDataSource(
|
||||
DataSource source, CommonElements commonElements) =
|
||||
DataSourceReader source, CommonElements commonElements) =
|
||||
ClassHierarchyImpl.readFromDataSource;
|
||||
|
||||
/// Serializes this [ClassHierarchy] to [sink].
|
||||
void writeToDataSink(DataSink sink);
|
||||
void writeToDataSink(DataSinkWriter sink);
|
||||
|
||||
/// Returns `true` if [cls] is either directly or indirectly instantiated.
|
||||
bool isInstantiated(ClassEntity cls);
|
||||
|
@ -170,7 +170,7 @@ class ClassHierarchyImpl implements ClassHierarchy {
|
|||
this._commonElements, this._classHierarchyNodes, this._classSets);
|
||||
|
||||
factory ClassHierarchyImpl.readFromDataSource(
|
||||
DataSource source, CommonElements commonElements) {
|
||||
DataSourceReader source, CommonElements commonElements) {
|
||||
source.begin(tag);
|
||||
Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes =
|
||||
ClassHierarchyNodesMap();
|
||||
|
@ -192,7 +192,7 @@ class ClassHierarchyImpl implements ClassHierarchy {
|
|||
}
|
||||
|
||||
@override
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(_classSets.length);
|
||||
ClassHierarchyNode node =
|
||||
|
|
|
@ -213,7 +213,7 @@ class ClassHierarchyNode {
|
|||
|
||||
/// Deserializes a [ClassHierarchyNode] object from [source].
|
||||
factory ClassHierarchyNode.readFromDataSource(
|
||||
DataSource source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
|
||||
DataSourceReader source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
|
||||
source.begin(tag);
|
||||
IndexedClass cls = source.readClass();
|
||||
ClassHierarchyNode parentNode;
|
||||
|
@ -233,7 +233,7 @@ class ClassHierarchyNode {
|
|||
}
|
||||
|
||||
/// Serializes this [ClassHierarchyNode] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeClass(cls);
|
||||
sink.writeClassOrNull(parentNode?.cls);
|
||||
|
@ -541,7 +541,7 @@ class ClassSet {
|
|||
|
||||
/// Deserializes a [ClassSet] object from [source].
|
||||
factory ClassSet.readFromDataSource(
|
||||
DataSource source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
|
||||
DataSourceReader source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
|
||||
source.begin(tag);
|
||||
ClassHierarchyNode node = nodeMap[source.readClass()];
|
||||
List<ClassHierarchyNode> subtypes = source.readList(() {
|
||||
|
@ -557,7 +557,7 @@ class ClassSet {
|
|||
}
|
||||
|
||||
/// Serializes this [ClassSet] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeClass(node.cls);
|
||||
sink.writeList(_subtypes, (ClassHierarchyNode node) {
|
||||
|
|
|
@ -241,7 +241,7 @@ class GenericInstantiation {
|
|||
|
||||
GenericInstantiation(this.functionType, this.typeArguments);
|
||||
|
||||
factory GenericInstantiation.readFromDataSource(DataSource source) {
|
||||
factory GenericInstantiation.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
DartType functionType = source.readDartType();
|
||||
List<DartType> typeArguments = source.readDartTypes();
|
||||
|
@ -249,7 +249,7 @@ class GenericInstantiation {
|
|||
return GenericInstantiation(functionType, typeArguments);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartType(functionType);
|
||||
sink.writeDartTypes(typeArguments);
|
||||
|
|
|
@ -839,7 +839,7 @@ class MemberAccess {
|
|||
|
||||
MemberAccess(this.reads, this.writes, this.invokes);
|
||||
|
||||
factory MemberAccess.readFromDataSource(DataSource source) {
|
||||
factory MemberAccess.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
EnumSet<Access> reads = EnumSet.fixed(source.readInt());
|
||||
EnumSet<Access> writes = EnumSet.fixed(source.readInt());
|
||||
|
@ -848,7 +848,7 @@ class MemberAccess {
|
|||
return MemberAccess(reads, writes, invokes);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(reads.value);
|
||||
sink.writeInt(writes.value);
|
||||
|
|
|
@ -199,7 +199,7 @@ class Selector {
|
|||
CallStructure(0, null, typeArguments));
|
||||
|
||||
/// Deserializes a [Selector] object from [source].
|
||||
factory Selector.readFromDataSource(DataSource source) {
|
||||
factory Selector.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
SelectorKind kind = source.readEnum(SelectorKind.values);
|
||||
bool isSetter = source.readBool();
|
||||
|
@ -212,7 +212,7 @@ class Selector {
|
|||
}
|
||||
|
||||
/// Serializes this [Selector] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeEnum(kind);
|
||||
sink.writeBool(memberName.isSetter);
|
||||
|
|
|
@ -43,7 +43,7 @@ class SideEffects {
|
|||
SideEffects.fromFlags(this._flags);
|
||||
|
||||
/// Deserializes a [SideEffects] object from [source].
|
||||
factory SideEffects.readFromDataSource(DataSource source) {
|
||||
factory SideEffects.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
int flags = source.readInt();
|
||||
source.end(tag);
|
||||
|
@ -51,7 +51,7 @@ class SideEffects {
|
|||
}
|
||||
|
||||
/// Serializes this [SideEffects] to [sink].
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeInt(_flags);
|
||||
sink.end(tag);
|
||||
|
|
|
@ -59,7 +59,7 @@ class DynamicUse {
|
|||
return DynamicUse(selector, otherReceiverConstraint, _typeArguments);
|
||||
}
|
||||
|
||||
factory DynamicUse.readFromDataSource(DataSource source) {
|
||||
factory DynamicUse.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
Selector selector = Selector.readFromDataSource(source);
|
||||
bool hasConstraint = source.readBool();
|
||||
|
@ -72,7 +72,7 @@ class DynamicUse {
|
|||
return DynamicUse(selector, receiverConstraint, typeArguments);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
selector.writeToDataSink(sink);
|
||||
sink.writeBool(receiverConstraint != null);
|
||||
|
@ -215,7 +215,7 @@ class StaticUse {
|
|||
return true;
|
||||
}
|
||||
|
||||
factory StaticUse.readFromDataSource(DataSource source) {
|
||||
factory StaticUse.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
MemberEntity element = source.readMember();
|
||||
StaticUseKind kind = source.readEnum(StaticUseKind.values);
|
||||
|
@ -234,7 +234,7 @@ class StaticUse {
|
|||
typeArguments: typeArguments);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
assert(element is MemberEntity, "Unsupported entity: $element");
|
||||
sink.writeMember(element);
|
||||
|
@ -727,7 +727,7 @@ class TypeUse {
|
|||
this.kind = kind,
|
||||
this.hashCode = Hashing.objectsHash(type, kind, deferredImport);
|
||||
|
||||
factory TypeUse.readFromDataSource(DataSource source) {
|
||||
factory TypeUse.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
DartType type = source.readDartType();
|
||||
TypeUseKind kind = source.readEnum(TypeUseKind.values);
|
||||
|
@ -736,7 +736,7 @@ class TypeUse {
|
|||
return TypeUse.internal(type, kind, deferredImport);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeDartType(type);
|
||||
sink.writeEnum(kind);
|
||||
|
@ -900,14 +900,14 @@ class ConstantUse {
|
|||
|
||||
ConstantUse._(this.value);
|
||||
|
||||
factory ConstantUse.readFromDataSource(DataSource source) {
|
||||
factory ConstantUse.readFromDataSource(DataSourceReader source) {
|
||||
source.begin(tag);
|
||||
ConstantValue value = source.readConstant();
|
||||
source.end(tag);
|
||||
return ConstantUse._(value);
|
||||
}
|
||||
|
||||
void writeToDataSink(DataSink sink) {
|
||||
void writeToDataSink(DataSinkWriter sink) {
|
||||
sink.begin(tag);
|
||||
sink.writeConstant(value);
|
||||
sink.end(tag);
|
||||
|
|
Loading…
Reference in a new issue