[analyzer] Remove generated constant evaluator and its tests.
The generated constant evaluator is not being used and is removed by this CL. All imports of the deleted evaluator will import the more direct dependency and tests are moved to `evaluation_test.dart`. Change-Id: Ie435d289bd85256419f67407b36af0375661f335 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324342 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Kallen Tu <kallentu@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/src/dart/element/type_provider.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/ast/syntactic_entity.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/constant/value.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
@@ -20,6 +22,8 @@ import 'package:analyzer/src/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/dart/constant/from_environment_evaluator.dart';
|
||||
import 'package:analyzer/src/dart/constant/has_type_parameter_reference.dart';
|
||||
import 'package:analyzer/src/dart/constant/potentially_constant.dart';
|
||||
import 'package:analyzer/src/dart/constant/utilities.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/element/member.dart';
|
||||
import 'package:analyzer/src/dart/element/type.dart';
|
||||
@@ -27,7 +31,6 @@ import 'package:analyzer/src/dart/element/type_algebra.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart' show TypeSystemImpl;
|
||||
import 'package:analyzer/src/diagnostic/diagnostic.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/java_core.dart';
|
||||
import 'package:analyzer/src/task/api/model.dart';
|
||||
|
||||
@@ -904,7 +904,7 @@ class DartObjectImpl implements DartObject, Constant {
|
||||
Map<DartObjectImpl, DartObjectImpl>? toMapValue() {
|
||||
final state = this.state;
|
||||
if (state is MapState) {
|
||||
return state._entries;
|
||||
return state.entries;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ class DartObjectImpl implements DartObject, Constant {
|
||||
Set<DartObjectImpl>? toSetValue() {
|
||||
final state = this.state;
|
||||
if (state is SetState) {
|
||||
return state._elements;
|
||||
return state.elements;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -2491,16 +2491,16 @@ class ListState extends InstanceState {
|
||||
/// The state of an object representing a map.
|
||||
class MapState extends InstanceState {
|
||||
/// The entries in the map.
|
||||
final Map<DartObjectImpl, DartObjectImpl> _entries;
|
||||
final Map<DartObjectImpl, DartObjectImpl> entries;
|
||||
|
||||
/// Initialize a newly created state to represent a map with the given
|
||||
/// [entries].
|
||||
MapState(this._entries);
|
||||
MapState(this.entries);
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
int value = 0;
|
||||
for (DartObjectImpl key in _entries.keys.toSet()) {
|
||||
for (DartObjectImpl key in entries.keys.toSet()) {
|
||||
value = (value << 3) ^ key.hashCode;
|
||||
}
|
||||
return value;
|
||||
@@ -2512,15 +2512,15 @@ class MapState extends InstanceState {
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is MapState) {
|
||||
Map<DartObjectImpl, DartObjectImpl> otherElements = other._entries;
|
||||
int count = _entries.length;
|
||||
Map<DartObjectImpl, DartObjectImpl> otherElements = other.entries;
|
||||
int count = entries.length;
|
||||
if (otherElements.length != count) {
|
||||
return false;
|
||||
} else if (count == 0) {
|
||||
return true;
|
||||
}
|
||||
for (DartObjectImpl key in _entries.keys) {
|
||||
var value = _entries[key];
|
||||
for (DartObjectImpl key in entries.keys) {
|
||||
var value = entries[key];
|
||||
var otherValue = otherElements[key];
|
||||
if (value != otherValue) {
|
||||
return false;
|
||||
@@ -2552,7 +2552,7 @@ class MapState extends InstanceState {
|
||||
StringBuffer buffer = StringBuffer();
|
||||
buffer.write('{');
|
||||
bool first = true;
|
||||
_entries.forEach((DartObjectImpl key, DartObjectImpl value) {
|
||||
entries.forEach((DartObjectImpl key, DartObjectImpl value) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
@@ -2763,16 +2763,16 @@ class RecordState extends InstanceState {
|
||||
/// The state of an object representing a set.
|
||||
class SetState extends InstanceState {
|
||||
/// The elements of the set.
|
||||
final Set<DartObjectImpl> _elements;
|
||||
final Set<DartObjectImpl> elements;
|
||||
|
||||
/// Initialize a newly created state to represent a set with the given
|
||||
/// [elements].
|
||||
SetState(this._elements);
|
||||
SetState(this.elements);
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
int value = 0;
|
||||
for (DartObjectImpl element in _elements) {
|
||||
for (DartObjectImpl element in elements) {
|
||||
value = (value << 3) ^ element.hashCode;
|
||||
}
|
||||
return value;
|
||||
@@ -2784,16 +2784,16 @@ class SetState extends InstanceState {
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is SetState) {
|
||||
List<DartObjectImpl> elements = _elements.toList();
|
||||
List<DartObjectImpl> otherElements = other._elements.toList();
|
||||
int count = elements.length;
|
||||
List<DartObjectImpl> currentElements = elements.toList();
|
||||
List<DartObjectImpl> otherElements = other.elements.toList();
|
||||
int count = currentElements.length;
|
||||
if (otherElements.length != count) {
|
||||
return false;
|
||||
} else if (count == 0) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (elements[i] != otherElements[i]) {
|
||||
if (currentElements[i] != otherElements[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2823,7 +2823,7 @@ class SetState extends InstanceState {
|
||||
StringBuffer buffer = StringBuffer();
|
||||
buffer.write('{');
|
||||
bool first = true;
|
||||
for (var element in _elements) {
|
||||
for (var element in elements) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/ast/syntactic_entity.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/constant/value.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
@@ -32,7 +34,6 @@ import 'package:analyzer/src/error/doc_comment_verifier.dart';
|
||||
import 'package:analyzer/src/error/error_handler_verifier.dart';
|
||||
import 'package:analyzer/src/error/must_call_super_verifier.dart';
|
||||
import 'package:analyzer/src/error/null_safe_api_verifier.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/workspace/workspace.dart';
|
||||
|
||||
@@ -11,12 +11,13 @@ import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/source/source_range.dart';
|
||||
import 'package:analyzer/src/dart/constant/evaluation.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/dart/resolver/exit_detector.dart';
|
||||
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
|
||||
import 'package:analyzer/src/dart/resolver/scope.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
typedef _CatchClausesVerifierReporter = void Function(
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/src/dart/constant/evaluation.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/generated/source.dart' show Source;
|
||||
|
||||
export 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
export 'package:analyzer/dart/constant/value.dart';
|
||||
export 'package:analyzer/src/dart/constant/evaluation.dart';
|
||||
export 'package:analyzer/src/dart/constant/utilities.dart';
|
||||
export 'package:analyzer/src/dart/constant/value.dart';
|
||||
|
||||
/// Instances of the class [ConstantEvaluator] evaluate constant expressions to
|
||||
/// produce their compile-time value.
|
||||
///
|
||||
/// According to the Dart Language Specification:
|
||||
///
|
||||
/// > A constant expression is one of the following:
|
||||
/// >
|
||||
/// > * A literal number.
|
||||
/// > * A literal boolean.
|
||||
/// > * A literal string where any interpolated expression is a compile-time
|
||||
/// > constant that evaluates to a numeric, string or boolean value or to
|
||||
/// > **null**.
|
||||
/// > * A literal symbol.
|
||||
/// > * **null**.
|
||||
/// > * A qualified reference to a static constant variable.
|
||||
/// > * An identifier expression that denotes a constant variable, class or type
|
||||
/// > alias.
|
||||
/// > * A constant constructor invocation.
|
||||
/// > * A constant list literal.
|
||||
/// > * A constant map literal.
|
||||
/// > * A simple or qualified identifier denoting a top-level function or a
|
||||
/// > static method.
|
||||
/// > * A parenthesized expression _(e)_ where _e_ is a constant expression.
|
||||
/// > * <span>
|
||||
/// > An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i>
|
||||
/// > where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
||||
/// > expressions and <i>identical()</i> is statically bound to the predefined
|
||||
/// > dart function <i>identical()</i> discussed above.
|
||||
/// > </span>
|
||||
/// > * <span>
|
||||
/// > An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i>
|
||||
/// > or <i>e<sub>1</sub> != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and
|
||||
/// > <i>e<sub>2</sub></i> are constant expressions that evaluate to a
|
||||
/// > numeric, string or boolean value.
|
||||
/// > </span>
|
||||
/// > * <span>
|
||||
/// > An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> &&
|
||||
/// > e<sub>2</sub></i> or <i>e<sub>1</sub> || e<sub>2</sub></i>, where
|
||||
/// > <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
||||
/// > expressions that evaluate to a boolean value.
|
||||
/// > </span>
|
||||
/// > * <span>
|
||||
/// > An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^
|
||||
/// > e<sub>2</sub></i>, <i>e<sub>1</sub> & e<sub>2</sub></i>,
|
||||
/// > <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub> >>
|
||||
/// > e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where
|
||||
/// > <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
||||
/// > expressions that evaluate to an integer value or to <b>null</b>.
|
||||
/// > </span>
|
||||
/// > * <span>
|
||||
/// > An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> +
|
||||
/// > e<sub>2</sub></i>, <i>e<sub>1</sub> -e<sub>2</sub></i>,
|
||||
/// > <i>e<sub>1</sub> * e<sub>2</sub></i>, <i>e<sub>1</sub> /
|
||||
/// > e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ e<sub>2</sub></i>,
|
||||
/// > <i>e<sub>1</sub> > e<sub>2</sub></i>, <i>e<sub>1</sub> <
|
||||
/// > e<sub>2</sub></i>, <i>e<sub>1</sub> >= e<sub>2</sub></i>,
|
||||
/// > <i>e<sub>1</sub> <= e<sub>2</sub></i> or <i>e<sub>1</sub> %
|
||||
/// > e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i> and
|
||||
/// > <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric
|
||||
/// > value or to <b>null</b>.
|
||||
/// > </span>
|
||||
/// > * <span>
|
||||
/// > An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> :
|
||||
/// > e<sub>3</sub></i> where <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and
|
||||
/// > <i>e<sub>3</sub></i> are constant expressions, and <i>e<sub>1</sub></i>
|
||||
/// > evaluates to a boolean value.
|
||||
/// > </span>
|
||||
///
|
||||
/// The values returned by instances of this class are therefore `null` and
|
||||
/// instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and
|
||||
/// `DartObject`.
|
||||
///
|
||||
/// In addition, this class defines several values that can be returned to
|
||||
/// indicate various conditions encountered during evaluation. These are
|
||||
/// documented with the static fields that define those values.
|
||||
class ConstantEvaluator {
|
||||
/// The source containing the expression(s) that will be evaluated.
|
||||
final Source _source;
|
||||
|
||||
/// The library containing the expression(s) that will be evaluated.
|
||||
final LibraryElementImpl _library;
|
||||
|
||||
ConstantEvaluator(this._source, this._library);
|
||||
|
||||
EvaluationResult evaluate(Expression expression) {
|
||||
RecordingErrorListener errorListener = RecordingErrorListener();
|
||||
ErrorReporter errorReporter = ErrorReporter(
|
||||
errorListener,
|
||||
_source,
|
||||
isNonNullableByDefault: _library.isNonNullableByDefault,
|
||||
);
|
||||
var result = expression.accept(ConstantVisitor(
|
||||
ConstantEvaluationEngine(
|
||||
declaredVariables: DeclaredVariables(),
|
||||
isNonNullableByDefault:
|
||||
_library.featureSet.isEnabled(Feature.non_nullable),
|
||||
configuration: ConstantEvaluationConfiguration(),
|
||||
),
|
||||
_library,
|
||||
errorReporter));
|
||||
List<AnalysisError> errors = errorListener.errors;
|
||||
if (errors.isNotEmpty) {
|
||||
return EvaluationResult.forErrors(errors);
|
||||
}
|
||||
if (result is DartObjectImpl) {
|
||||
return EvaluationResult.forValue(result);
|
||||
}
|
||||
// We should not get here. Either there should be a valid value or there
|
||||
// should be an error explaining why a value could not be generated.
|
||||
return EvaluationResult.forErrors(errors);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import 'dart:typed_data';
|
||||
import 'package:_fe_analyzer_shared/src/scanner/string_canonicalizer.dart';
|
||||
import 'package:analyzer/dart/analysis/analysis_options.dart';
|
||||
import 'package:analyzer/dart/analysis/code_style_options.dart';
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
@@ -14,7 +15,6 @@ import 'package:analyzer/source/error_processor.dart';
|
||||
import 'package:analyzer/src/analysis_options/code_style_options.dart';
|
||||
import 'package:analyzer/src/dart/analysis/experiments.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/summary/api_signature.dart';
|
||||
|
||||
@@ -11,17 +11,18 @@ import 'package:_fe_analyzer_shared/src/exhaustiveness/space.dart';
|
||||
import 'package:_fe_analyzer_shared/src/exhaustiveness/static_type.dart';
|
||||
import 'package:_fe_analyzer_shared/src/exhaustiveness/types.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/constant/value.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/dart/ast/extensions.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/element/replacement_visitor.dart';
|
||||
import 'package:analyzer/src/dart/element/type_algebra.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/dart/resolver/variance.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
|
||||
/// The buffer that accumulates types and elements as is, so that they
|
||||
/// can be written latter into Dart code that considers imports. It also
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/dart/element/type_provider.dart';
|
||||
import 'package:analyzer/src/dart/constant/from_environment_evaluator.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@ import 'class_member_parser_test.dart' as class_member_parser;
|
||||
import 'collection_literal_parser_test.dart' as collection_literal_parser;
|
||||
import 'complex_parser_test.dart' as complex_parser;
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
import 'constant_test.dart' as constant_test;
|
||||
import 'element_resolver_test.dart' as element_resolver_test;
|
||||
import 'error_parser_test.dart' as error_parser;
|
||||
import 'error_suppression_test.dart' as error_suppression;
|
||||
@@ -51,7 +50,6 @@ main() {
|
||||
class_member_parser.main();
|
||||
collection_literal_parser.main();
|
||||
complex_parser.main();
|
||||
constant_test.main();
|
||||
element_resolver_test.main();
|
||||
error_parser.main();
|
||||
error_suppression.main();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,8 @@ import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/dart/element/type_provider.dart';
|
||||
import 'package:analyzer/src/dart/constant/value.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
@@ -48,8 +48,12 @@ class DartObjectPrinter {
|
||||
_writeGenericState(type, state);
|
||||
} else if (state is ListState) {
|
||||
_writeListState(state);
|
||||
} else if (state is MapState) {
|
||||
_writeMapState(state);
|
||||
} else if (state is RecordState) {
|
||||
_writeRecordState(type, state);
|
||||
} else if (state is SetState) {
|
||||
_writeSetState(state);
|
||||
} else if (state is TypeState) {
|
||||
_sink.write('Type ');
|
||||
_sink.writeln(state);
|
||||
@@ -122,6 +126,30 @@ class DartObjectPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
void _writeMapState(MapState state) {
|
||||
_sink.writeln('Map');
|
||||
_sink.withIndent(() {
|
||||
final entries = state.entries;
|
||||
if (entries.isNotEmpty) {
|
||||
_sink.writelnWithIndent('entries');
|
||||
_sink.withIndent(() {
|
||||
for (final entry in entries.entries) {
|
||||
_sink.writelnWithIndent('entry');
|
||||
_sink.withIndent(() {
|
||||
_sink.writeIndent();
|
||||
_sink.write('key: ');
|
||||
write(entry.key);
|
||||
|
||||
_sink.writeIndent();
|
||||
_sink.write('value: ');
|
||||
write(entry.value);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _writeRecordState(DartType type, RecordState state) {
|
||||
_sink.write('Record');
|
||||
_elementPrinter.writeType(type);
|
||||
@@ -154,6 +182,22 @@ class DartObjectPrinter {
|
||||
});
|
||||
}
|
||||
|
||||
void _writeSetState(SetState state) {
|
||||
_sink.writeln('Set');
|
||||
_sink.withIndent(() {
|
||||
final elements = state.elements;
|
||||
if (elements.isNotEmpty) {
|
||||
_sink.writelnWithIndent('elements');
|
||||
_sink.withIndent(() {
|
||||
for (final element in elements) {
|
||||
_sink.writeIndent();
|
||||
write(element);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _writeString(DartObjectImpl object) {
|
||||
_sink.write('String ');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user