Version 3.10.0-0.0.dev Merge e694eb261aa433157b283c231914c92ae0b45614 into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a5b1fd..1d3e507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -1,3 +1,5 @@ +## 3.10.0 + ## 3.9.0 **Released on:** Unreleased
diff --git a/DEPS b/DEPS index cb7363e..17d7a59 100644 --- a/DEPS +++ b/DEPS
@@ -84,7 +84,7 @@ "download_reclient": True, # Update from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core - "fuchsia_sdk_version": "version:28.20250701.7.1", + "fuchsia_sdk_version": "version:28.20250714.4.1", "download_fuchsia_deps": False, # Ninja, runs the build based on files generated by GN. @@ -136,7 +136,7 @@ "dartdoc_rev": "882aea9351262d618c955322f4c9aafe9540b848", "ecosystem_rev": "d5233c6dd0767cffa5742e32c4bc7c230c9c4b12", "flute_rev": "e4ea0459a7debae5e9592c85141707b01fac86c9", - "http_rev": "4209e846100cb22d60dea7e48727334b8c55be34", + "http_rev": "7d2d87ebfba86035a9ca6b79160ccc2ac1253c0c", "i18n_rev": "c45e050426bdeaaa120e5ce856abb486863d0476", "leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # rolled manually "material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
diff --git a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart index 77ab717..5596f82 100644 --- a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart +++ b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
@@ -6,7 +6,7 @@ // // Instead modify 'tools/experimental_features.yaml' and run // 'dart pkg/front_end/tool/cfe.dart generate-experimental-flags' to update. -const Version defaultLanguageVersion = const Version(3, 9); +const Version defaultLanguageVersion = const Version(3, 10); /// Enum for experimental flags shared between the CFE and the analyzer. enum ExperimentalFlag {
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart index 58816cd..2492c3c 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart
@@ -336,6 +336,12 @@ } @override + void visitGenericFunctionType(GenericFunctionType node) { + // Don't descent into function types or we may generate values + // for their parameters. + } + + @override void visitPrefixedIdentifier(PrefixedIdentifier node) { if (experimentalInlineValuesProperties) { // Don't create values for excluded types or access of their properties.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart index 797cdde..26b4361 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart
@@ -6,24 +6,10 @@ import 'package:analysis_server_plugin/edit/dart/correction_producer.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/precedence.dart'; -import 'package:analyzer/dart/ast/token.dart'; -import 'package:analyzer/source/source_range.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; -/// This correction producer can act on a variety of code, and various edits -/// might be applied. -typedef _ParametersFixData = - ({ - SourceRange parensRange, - List<SourceRange> deleteRanges, - bool negated, - bool needsParens, - (SourceRange, String)? replace, - bool bangBeforeParens, - }); - class ConvertToBooleanExpression extends ResolvedCorrectionProducer { ConvertToBooleanExpression({required super.context}); @@ -41,202 +27,49 @@ Future<void> compute(ChangeBuilder builder) async { AstNode? node = this.node; if (node is BooleanLiteral) node = node.parent; - _ParametersFixData parameters; + if (node is! BinaryExpression) return; - if (node case BinaryExpression( - :var rightOperand, - :var leftOperand, - operator: Token(type: var operator), - )) { - if (rightOperand is BooleanLiteral) { - parameters = _processBinaryExp( - node, - operator, - rightOperand, - leftOperand, - currentIsLeft: false, - ); - } else if (leftOperand is BooleanLiteral) { - parameters = _processBinaryExp( - node, - operator, - leftOperand, - rightOperand, - currentIsLeft: true, - ); - } else { - return; - } - } else if (node - case ConditionalExpression( - :var condition, - :var thenExpression, - :var elseExpression, - ) && - var conditionalExp) { - _ParametersFixData? result = (switch ((thenExpression, elseExpression)) { - (BooleanLiteral then, BooleanLiteral elseExp) => () { - var equalValues = then.value == elseExp.value; - var rangeStart = - equalValues - // keep `then` - ? range.startStart(condition, then) - // keep `condition` - : range.endEnd(condition, then); - // remove ` : elseExp` - var rangeEnd = range.endEnd(then, elseExp); - return ( - parensRange: range.node(equalValues ? then : condition), - deleteRanges: [rangeStart, rangeEnd], - negated: !then.value && elseExp.value, - replace: null, - needsParens: !equalValues && condition.needsParens, - bangBeforeParens: false, - ); - }(), - (BooleanLiteral then, Expression elseExp) => () { - var replaceRange = range.endStart(condition, elseExp); - var operator = then.ifBarElseAmpersand; - return ( - parensRange: range.node(conditionalExp), - deleteRanges: const <SourceRange>[], - negated: !then.value, - replace: (replaceRange, ' ${operator.lexeme} '), - // conditional expressions always need parens so there will - // be no need to add them - needsParens: false, - bangBeforeParens: false, - ); - }(), - (Expression then, BooleanLiteral elseExp) => () { - var rangeStart = range.endStart(condition, then); - var rangeEnd = range.endEnd(then, elseExp); - var operator = elseExp.ifBarElseAmpersand; - return ( - parensRange: range.node(conditionalExp), - deleteRanges: [rangeEnd], - negated: elseExp.value, - replace: (rangeStart, ' ${operator.lexeme} '), - // conditional expressions always need parens so there will - // be no need to add them - needsParens: false, - bangBeforeParens: false, - ); - }(), - (_, _) => null, - }); - if (result == null) { - return; - } - parameters = result; + var rightOperand = node.rightOperand; + var leftOperand = node.leftOperand; + + Expression expression; + BooleanLiteral literal; + + var deleteRange = range.endEnd(leftOperand, rightOperand); + + if (rightOperand is BooleanLiteral) { + literal = rightOperand; + expression = node.leftOperand; + } else if (leftOperand is BooleanLiteral) { + literal = leftOperand; + expression = node.rightOperand; + deleteRange = range.startStart(leftOperand, rightOperand); } else { return; } - await _addEdit(builder, parameters); - } - Future<void> _addEdit( - ChangeBuilder builder, - _ParametersFixData parameters, - ) async { - var ( - :parensRange, - :deleteRanges, - :negated, - :replace, - :needsParens, - :bangBeforeParens, - ) = parameters; + var negated = !isPositiveCase(node, literal); await builder.addDartFileEdit(file, (builder) { - if (bangBeforeParens) { - if (negated) { - builder.addSimpleInsertion(parensRange.offset, TokenType.BANG.lexeme); - if (needsParens) { - builder.addSimpleInsertion(parensRange.offset, '('); - builder.addSimpleInsertion(parensRange.end, ')'); - } - } - } else { - if (needsParens) { - builder.addSimpleInsertion(parensRange.offset, '('); - } - if (negated) { - builder.addSimpleInsertion(parensRange.offset, TokenType.BANG.lexeme); - } - if (needsParens) { - builder.addSimpleInsertion(parensRange.end, ')'); + if (negated) { + builder.addSimpleInsertion(expression.offset, '!'); + if (expression.needsParens) { + builder.addSimpleInsertion(expression.offset, '('); + builder.addSimpleInsertion(expression.end, ')'); } } - if (replace != null) { - builder.addSimpleReplacement(replace.$1, replace.$2); - } - for (var range in deleteRanges) { - builder.addDeletion(range); - } + builder.addDeletion(deleteRange); }); } - _ParametersFixData _processBinaryExp( - BinaryExpression binaryExp, - TokenType operator, - BooleanLiteral current, - Expression other, { - required bool currentIsLeft, - }) { - List<SourceRange> deleteRanges; - SourceRange parensRange; - bool needsParens; - switch (operator) { - case TokenType.BAR || TokenType.BAR_BAR when current.value: - case TokenType.AMPERSAND || TokenType.AMPERSAND_AMPERSAND - when !current.value: - deleteRanges = [ - currentIsLeft - ? range.endEnd(current, other) - : range.startStart(other, current), - ]; - parensRange = range.node(current); - needsParens = current.needsParens; - default: - deleteRanges = [ - currentIsLeft - ? range.startStart(current, other) - : range.endEnd(other, current), - ]; - parensRange = range.node(other); - needsParens = other.needsParens; - } - return ( - negated: !isPositiveCase(binaryExp, current), - parensRange: parensRange, - deleteRanges: deleteRanges, - needsParens: needsParens, - replace: null, - bangBeforeParens: true, - ); - } - static bool isPositiveCase( BinaryExpression expression, BooleanLiteral literal, ) { - return switch (expression.operator.type) { - TokenType.BAR || - TokenType.BAR_BAR || - TokenType.AMPERSAND || - TokenType.AMPERSAND_AMPERSAND => true, - TokenType.EQ_EQ => literal.value, - TokenType.BANG_EQ || TokenType.CARET => !literal.value, - _ => throw StateError('Unexpected operator ${expression.operator.type}'), - }; + if (expression.operator.lexeme == '==') return literal.value; + return !literal.value; } } -extension on BooleanLiteral { - TokenType get ifBarElseAmpersand => - value ? TokenType.BAR_BAR : TokenType.AMPERSAND_AMPERSAND; -} - extension on Expression { bool get needsParens => precedence <= Precedence.prefix; }
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart index a220029..8243f9a 100644 --- a/pkg/analysis_server/test/abstract_single_unit.dart +++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -18,11 +18,6 @@ class AbstractSingleUnitTest extends AbstractContextTest { bool verifyNoTestUnitErrors = true; - /// Whether the test code should parse carrets as position shorthands. - /// - /// Set this to `true` when the test code is using the carret operator. - bool keepCaret = false; - TestCode? _parsedTestCode; late ParsedUnitResult testParsedResult; late ResolvedLibraryResult? testLibraryResult; @@ -43,10 +38,7 @@ String get testCode => parsedTestCode.code; set testCode(String value) { - parsedTestCode = TestCode.parse( - normalizeSource(value), - positionShorthand: !keepCaret, - ); + parsedTestCode = TestCode.parse(normalizeSource(value)); } void addTestSource(String code) {
diff --git a/pkg/analysis_server/test/analysis/get_hover_test.dart b/pkg/analysis_server/test/analysis/get_hover_test.dart index c6a47a7..d505960 100644 --- a/pkg/analysis_server/test/analysis/get_hover_test.dart +++ b/pkg/analysis_server/test/analysis/get_hover_test.dart
@@ -1762,7 +1762,7 @@ var hover = await prepareHover('A'); _assertHover( hover, - elementDescription: 'typedef A = void Function(int )', + elementDescription: 'typedef A = void Function(int)', elementKind: 'type alias', ); }
diff --git a/pkg/analysis_server/test/lsp/inline_value_test.dart b/pkg/analysis_server/test/lsp/inline_value_test.dart index 5a8004f..b6c275e 100644 --- a/pkg/analysis_server/test/lsp/inline_value_test.dart +++ b/pkg/analysis_server/test/lsp/inline_value_test.dart
@@ -120,6 +120,20 @@ await verify_values(code, ofType: InlineValueVariableLookup); } + Future<void> test_parameter_nestedInFunctionType() async { + // A parameter nested inside a function type should not produce a value. + code = TestCode.parse(r''' +void f( + int /*[0*/value/*0]*/, { + required void Function(int value) /*[1*/func/*1]*/, +}) { + ^ +} +'''); + + await verify_values(code, ofType: InlineValueVariableLookup); + } + Future<void> test_parameter_read() async { code = TestCode.parse(r''' void f(int aaa, int bbb) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_boolean_expression_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_boolean_expression_test.dart index 6b95f16..3d6af5e 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_boolean_expression_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_boolean_expression_test.dart
@@ -43,172 +43,15 @@ @override String get lintCode => LintNames.no_literal_bool_comparisons; - Future<void> test_andAndFalse() async { - await resolveTestCode(r''' -void f(bool value) { - if (value && false) print(value); -} -'''); - var lint = await lintCodeByName(lintCode); - await assertHasFix(r''' -void f(bool value) { - if (false) print(value); -} -''', errorFilter: (error) => error.diagnosticCode == lint); - } - - Future<void> test_andAndTrue() async { - await resolveTestCode(r''' -void f(bool value) { - if (value && true) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_andFalse() async { - await resolveTestCode(r''' -void f(bool value) { - if (value & false) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (false) print(value); -} -'''); - } - - Future<void> test_andTrue() async { - await resolveTestCode(r''' -void f(bool value) { - if (value & true) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_conditional_bothFalse() async { - await resolveTestCode(r''' -void f(bool value1) { - print(value1 ? false : false); -} -'''); - await assertHasFix(r''' -void f(bool value1) { - print(false); -} -'''); - } - - Future<void> test_conditional_bothLiteral1() async { - await resolveTestCode(r''' -void f(bool value1) { - print(value1 ? true : false); -} -'''); - await assertHasFix(r''' -void f(bool value1) { - print(value1); -} -'''); - } - - Future<void> test_conditional_bothLiteral2() async { - await resolveTestCode(r''' -void f(bool value1) { - print(value1 ? false : true); -} -'''); - await assertHasFix(r''' -void f(bool value1) { - print(!value1); -} -'''); - } - - Future<void> test_conditional_bothTrue() async { - await resolveTestCode(r''' -void f(bool value1) { - print(value1 ? true : true); -} -'''); - await assertHasFix(r''' -void f(bool value1) { - print(true); -} -'''); - } - - Future<void> test_conditional_elseFalse() async { - await resolveTestCode(r''' -void f(bool value1, bool value2) { - print(value1 ? value2 : false); -} -'''); - await assertHasFix(r''' -void f(bool value1, bool value2) { - print(value1 && value2); -} -'''); - } - - Future<void> test_conditional_elseTrue() async { - await resolveTestCode(r''' -void f(bool value1, bool value2) { - print(value1 ? value2 : true); -} -'''); - await assertHasFix(r''' -void f(bool value1, bool value2) { - print(!value1 || value2); -} -'''); - } - - Future<void> test_conditional_thenFalse() async { - await resolveTestCode(r''' -void f(bool value1, bool value2) { - print(value1 ? false : value2); -} -'''); - await assertHasFix(r''' -void f(bool value1, bool value2) { - print(!value1 && value2); -} -'''); - } - - Future<void> test_conditional_thenTrue() async { - await resolveTestCode(r''' -void f(bool value1, bool value2) { - print(value1 ? true : value2); -} -'''); - await assertHasFix(r''' -void f(bool value1, bool value2) { - print(value1 || value2); -} -'''); - } - Future<void> test_ifFalse() async { await resolveTestCode(r''' void f(bool value) { - if (value == false) print(value); + if (value == false) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (!value) print(value); + if (!value) print(value); } '''); } @@ -217,12 +60,12 @@ Future<void> test_ifFalse_asExpression() async { await resolveTestCode(r''' void f(Object value) { - if (value as bool == false) print(value); + if (value as bool == false) print(value); } '''); await assertHasFix(r''' void f(Object value) { - if (!(value as bool)) print(value); + if (!(value as bool)) print(value); } '''); } @@ -230,12 +73,12 @@ Future<void> test_ifFalse_reversed() async { await resolveTestCode(r''' void f(bool value) { - if (false == value) print(value); + if (false == value) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (!value) print(value); + if (!value) print(value); } '''); } @@ -243,12 +86,12 @@ Future<void> test_ifNotFalse() async { await resolveTestCode(r''' void f(bool value) { - if (value != false) print(value); + if (value != false) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (value) print(value); + if (value) print(value); } '''); } @@ -256,12 +99,12 @@ Future<void> test_ifNotFalse_reversed() async { await resolveTestCode(r''' void f(bool value) { - if (false != value) print(value); + if (false != value) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (value) print(value); + if (value) print(value); } '''); } @@ -269,12 +112,12 @@ Future<void> test_ifNotTrue() async { await resolveTestCode(r''' void f(bool value) { - if (value != true) print(value); + if (value != true) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (!value) print(value); + if (!value) print(value); } '''); } @@ -282,12 +125,12 @@ Future<void> test_ifNotTrue_reversed() async { await resolveTestCode(r''' void f(bool value) { - if (true != value) print(value); + if (true != value) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (!value) print(value); + if (!value) print(value); } '''); } @@ -295,55 +138,12 @@ Future<void> test_ifTrue() async { await resolveTestCode(r''' void f(bool value) { - if (value == true) print(value); + if (value == true) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_ifTrue_invocation() async { - await resolveTestCode(r''' -void f(bool Function() fn) { - if (fn() == true) print('something'); -} -'''); - await assertHasFix(r''' -void f(bool Function() fn) { - if (fn()) print('something'); -} -'''); - } - - Future<void> test_ifTrue_prefixed() async { - await resolveTestCode(r''' -void f(List list) { - if (list.isNotEmpty == true) print(list); -} -'''); - await assertHasFix(r''' -void f(List list) { - if (list.isNotEmpty) print(list); -} -'''); - } - - Future<void> test_ifTrue_propertyAccess() async { - await resolveTestCode(r''' -extension E on List { - void m() { - if (this.isNotEmpty == true) print(this); - } -} -'''); - await assertHasFix(r''' -extension E on List { - void m() { - if (this.isNotEmpty) print(this); - } + if (value) print(value); } '''); } @@ -351,92 +151,12 @@ Future<void> test_ifTrue_reversed() async { await resolveTestCode(r''' void f(bool value) { - if (true == value) print(value); + if (true == value) print(value); } '''); await assertHasFix(r''' void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_orFalse() async { - await resolveTestCode(r''' -void f(bool value) { - if (value | false) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_orOrFalse() async { - await resolveTestCode(r''' -void f(bool value) { - if (value || false) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_orOrTrue() async { - await resolveTestCode(r''' -void f(bool value) { - if (value || true) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (true) print(value); -} -'''); - } - - Future<void> test_orTrue() async { - await resolveTestCode(r''' -void f(bool value) { - if (value | true) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (true) print(value); -} -'''); - } - - Future<void> test_xorFalse() async { - keepCaret = true; - await resolveTestCode(r''' -void f(bool value) { - if (value ^ false) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (value) print(value); -} -'''); - } - - Future<void> test_xorTrue() async { - keepCaret = true; - await resolveTestCode(r''' -void f(bool value) { - if (value ^ true) print(value); -} -'''); - await assertHasFix(r''' -void f(bool value) { - if (!value) print(value); + if (value) print(value); } '''); }
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart index 6fb7336..096c92c 100644 --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -109,7 +109,7 @@ // TODO(scheglov): Clean up the list of implicitly analyzed files. class AnalysisDriver { /// The version of data format, should be incremented on every format change. - static const int DATA_VERSION = 503; + static const int DATA_VERSION = 508; /// The number of exception contexts allowed to write. Once this field is /// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart index 6dc2640..fe616e4 100644 --- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart +++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -12,7 +12,7 @@ /// The current version of the Dart language (or, for non-stable releases, the /// version of the language currently in the process of being developed). -const _currentVersion = '3.9.0'; +const _currentVersion = '3.10.0'; /// A map containing information about all known experimental flags. final _knownFeatures = <String, ExperimentalFeature>{
diff --git a/pkg/analyzer/lib/src/dart/element/display_string_builder.dart b/pkg/analyzer/lib/src/dart/element/display_string_builder.dart index 459baa2..15a4a1e 100644 --- a/pkg/analyzer/lib/src/dart/element/display_string_builder.dart +++ b/pkg/analyzer/lib/src/dart/element/display_string_builder.dart
@@ -36,19 +36,11 @@ @override String toString() => _buffer.toString(); - void writeAbstractElement(FragmentImpl element) { + void writeAbstractElement(ElementImpl element) { _write(element.name ?? '<unnamed ${element.runtimeType}>'); } - void writeAbstractElement2(ElementImpl element) { - _write(element.name ?? '<unnamed ${element.runtimeType}>'); - } - - void writeClassElement(ClassFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } - + void writeClassElement(ClassElementImpl element) { if (element.isSealed) { _write('sealed '); } else if (element.isAbstract) { @@ -68,23 +60,17 @@ _write('class '); _write(element.displayName); - _writeTypeParameters(element.typeParameters); + _writeTypeParameters2(element.typeParameters); _writeTypeIfNotObject(' extends ', element.supertype); _writeTypesIfNotEmpty(' with ', element.mixins); _writeTypesIfNotEmpty(' implements ', element.interfaces); } - void writeCompilationUnitElement(LibraryFragmentImpl element) { - var path = element.source.fullName; - _write(path); - } - void writeConstructorElement(ConstructorElementMixin2 element) { _writeType(element.returnType); - _write(' '); - _write(element.displayName); + _write(' ${element.displayName}'); _writeFormalParameters2( element.formalParameters, @@ -93,31 +79,18 @@ ); } - void writeConstructorFragment(ConstructorFragmentImpl element) { - _writeType(element.returnType); - _write(' '); - - _write(element.displayName); - - _writeFormalParameters( - element.parameters, - forElement: true, - allowMultiline: true, - ); + void writeDynamicElement(DynamicElementImpl element) { + _write('dynamic'); } void writeDynamicType() { _write('dynamic'); } - void writeEnumElement(EnumFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } - + void writeEnumElement(EnumElementImpl element) { _write('enum '); _write(element.displayName); - _writeTypeParameters(element.typeParameters); + _writeTypeParameters2(element.typeParameters); _writeTypesIfNotEmpty(' with ', element.mixins); _writeTypesIfNotEmpty(' implements ', element.interfaces); } @@ -140,54 +113,23 @@ } } - void writeExecutableFragment(ExecutableFragmentImpl fragment, String name) { - if (fragment.isAugmentation) { - _write('augment '); - } - - if (fragment is! SetterFragmentImpl) { - _writeType(fragment.returnType); - _write(' '); - } - - _write(name); - - if (fragment is! GetterFragmentImpl) { - _writeTypeParameters(fragment.typeParameters); - _writeFormalParameters( - fragment.parameters, - forElement: true, - allowMultiline: true, - ); - } - } - - void writeExtensionElement(ExtensionFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } - + void writeExtensionElement(ExtensionElementImpl element) { _write('extension'); - if (element.displayName.isNotEmpty) { - _write(' '); - _write(element.displayName); - _writeTypeParameters(element.typeParameters); + if (element.name case var name?) { + _write(' $name'); } + _writeTypeParameters2(element.typeParameters); _write(' on '); _writeType(element.extendedType); } - void writeExtensionTypeElement(ExtensionTypeFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } - + void writeExtensionTypeElement(ExtensionTypeElementImpl element) { _write('extension type '); _write(element.displayName); - _writeTypeParameters(element.typeParameters); + _writeTypeParameters2(element.typeParameters); _write('('); - _writeType(element.representation.element.type); + _writeType(element.representation.type); _write(' '); _write(element.representation.name ?? '<null-name}>'); _write(')'); @@ -195,21 +137,7 @@ _writeTypesIfNotEmpty(' implements ', element.interfaces); } - void writeFormalParameter(FormalParameterFragmentImpl element) { - if (element.isRequiredPositional) { - _writeWithoutDelimiters(element, forElement: true); - } else if (element.isOptionalPositional) { - _write('['); - _writeWithoutDelimiters(element, forElement: true); - _write(']'); - } else if (element.isNamed) { - _write('{'); - _writeWithoutDelimiters(element, forElement: true); - _write('}'); - } - } - - void writeFormalParameter2(FormalParameterElementMixin element) { + void writeFormalParameterElement(FormalParameterElementMixin element) { if (element.isRequiredPositional) { _writeWithoutDelimiters2(element, forElement: true); } else if (element.isOptionalPositional) { @@ -237,13 +165,15 @@ _writeNullability(type.nullabilitySuffix); } - void writeGenericFunctionTypeElement( - GenericFunctionTypeFragmentImpl element, - ) { + void writeGenericFunctionTypeElement(GenericFunctionTypeElementImpl element) { _writeType(element.returnType); _write(' Function'); - _writeTypeParameters(element.typeParameters); - _writeFormalParameters(element.parameters, forElement: true); + _writeTypeParameters2(element.typeParameters); + _writeFormalParameters2(element.formalParameters.cast(), forElement: true); + } + + void writeGetterElement(GetterElementImpl element) { + writeExecutableElement(element, 'get ${element.displayName}'); } void writeInterfaceType(InterfaceType type) { @@ -260,6 +190,10 @@ _write('InvalidType'); } + void writeLabelElement(LabelElementImpl element) { + _write(element.name ?? '<null-name>'); + } + void writeLibraryElement(LibraryElementImpl element) { _write('library '); _write('${element.source.uri}'); @@ -275,20 +209,40 @@ _writeDirectiveUri(element.uri); } - void writeMixinElement(MixinFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } + void writeLocalFunctionElement(LocalFunctionElementImpl element) { + _writeType(element.returnType); + _write(element.name ?? ' <null-name>'); + _writeTypeParameters2(element.typeParameters); + _writeFormalParameters2(element.formalParameters, forElement: true); + } + + void writeMethodElement(MethodElementImpl element) { + _writeType(element.returnType); + _write(' '); + _write(element.name ?? '<null-name>'); + _writeTypeParameters2(element.typeParameters); + _writeFormalParameters2( + element.formalParameters, + forElement: true, + allowMultiline: true, + ); + } + + void writeMixinElement(MixinElementImpl element) { if (element.isBase) { _write('base '); } _write('mixin '); _write(element.displayName); - _writeTypeParameters(element.typeParameters); + _writeTypeParameters2(element.typeParameters); _writeTypesIfNotEmpty(' on ', element.superclassConstraints); _writeTypesIfNotEmpty(' implements ', element.interfaces); } + void writeNeverElement(NeverElementImpl element) { + _write('Never'); + } + void writeNeverType(NeverType type) { _write('Never'); _writeNullability(type.nullabilitySuffix); @@ -339,8 +293,7 @@ _write('{'); for (var field in namedFields) { _writeType(field.type); - _write(' '); - _write(field.name); + _write(' ${field.name}'); if (index++ < fieldCount - 1) { _write(', '); } @@ -357,14 +310,26 @@ _writeNullability(type.nullabilitySuffix); } - void writeTypeAliasElement(TypeAliasFragmentImpl element) { - if (element.isAugmentation) { - _write('augment '); - } + void writeSetterElement(SetterElementImpl element) { + writeExecutableElement(element, 'set ${element.displayName}'); + } + void writeTopLevelFunctionElement(TopLevelFunctionElementImpl element) { + _writeType(element.returnType); + _write(' '); + _write(element.name ?? ' <null-name>'); + _writeTypeParameters2(element.typeParameters); + _writeFormalParameters2( + element.formalParameters, + forElement: true, + allowMultiline: true, + ); + } + + void writeTypeAliasElement(TypeAliasElementImpl element) { _write('typedef '); _write(element.displayName); - _writeTypeParameters(element.typeParameters); + _writeTypeParameters2(element.typeParameters); _write(' = '); var aliasedElement = element.aliasedElement; @@ -375,27 +340,10 @@ } } - void writeTypeParameter(TypeParameterFragmentImpl element) { + void writeTypeParameterElement(TypeParameterElementImpl element) { var variance = element.variance; if (!element.isLegacyCovariant && variance != Variance.unrelated) { - _write(variance.keyword); - _write(' '); - } - - _write(element.displayName); - - var bound = element.bound; - if (bound != null) { - _write(' extends '); - _writeType(bound); - } - } - - void writeTypeParameter2(TypeParameterElementImpl element) { - var variance = element.variance; - if (!element.isLegacyCovariant && variance != Variance.unrelated) { - _write(variance.keyword); - _write(' '); + _write('${variance.keyword} '); } _write(element.displayName); @@ -430,16 +378,9 @@ _write('_'); } - void writeVariableElement(VariableFragmentImpl element) { - _writeType(element.element.type); - _write(' '); - _write(element.displayName); - } - void writeVariableElement2(VariableElement2OrMember element) { _writeType(element.type); - _write(' '); - _write(element.displayName); + _write(' ${element.displayName}'); } void writeVoidType() { @@ -472,65 +413,6 @@ } } - void _writeFormalParameters( - List<FormalParameterFragmentImpl> parameters, { - required bool forElement, - bool allowMultiline = false, - }) { - // Assume the display string looks better wrapped when there are at least - // three parameters. This avoids having to pre-compute the single-line - // version and know the length of the function name/return type. - var multiline = allowMultiline && _multiline && parameters.length >= 3; - - // The prefix for open groups is included in separator for single-line but - // not for multiline so must be added explicitly. - var openGroupPrefix = multiline ? ' ' : ''; - var separator = multiline ? ',' : ', '; - var trailingComma = multiline ? ',\n' : ''; - var parameterPrefix = multiline ? '\n ' : ''; - - _write('('); - - _WriteFormalParameterKind? lastKind; - var lastClose = ''; - - void openGroup(_WriteFormalParameterKind kind, String open, String close) { - if (lastKind != kind) { - _write(lastClose); - if (lastKind != null) { - // We only need to include the space before the open group if there - // was a previous parameter, otherwise it goes immediately after the - // open paren. - _write(openGroupPrefix); - } - _write(open); - lastKind = kind; - lastClose = close; - } - } - - for (var i = 0; i < parameters.length; i++) { - if (i != 0) { - _write(separator); - } - - var parameter = parameters[i]; - if (parameter.isRequiredPositional) { - openGroup(_WriteFormalParameterKind.requiredPositional, '', ''); - } else if (parameter.isOptionalPositional) { - openGroup(_WriteFormalParameterKind.optionalPositional, '[', ']'); - } else if (parameter.isNamed) { - openGroup(_WriteFormalParameterKind.named, '{', '}'); - } - _write(parameterPrefix); - _writeWithoutDelimiters(parameter, forElement: forElement); - } - - _write(trailingComma); - _write(lastClose); - _write(')'); - } - void _writeFormalParameters2( List<FormalParameterElementMixin> parameters, { required bool forElement, @@ -628,19 +510,6 @@ } } - void _writeTypeParameters(List<TypeParameterFragmentImpl> elements) { - if (elements.isEmpty) return; - - _write('<'); - for (var i = 0; i < elements.length; i++) { - if (i != 0) { - _write(', '); - } - elements[i].appendTo(this); - } - _write('>'); - } - void _writeTypeParameters2(List<TypeParameterElement> elements) { if (elements.isEmpty) return; @@ -670,32 +539,6 @@ } } - void _writeWithoutDelimiters( - FormalParameterFragmentImpl element, { - required bool forElement, - }) { - if (element.isRequiredNamed) { - _write('required '); - } - - // TODO(scheglov): write a placeholder, or remove completely - // When we do correct separate writing elements. - _writeType(element.element.type); - - if (forElement || element.isNamed) { - _write(' '); - _write(element.displayName); - } - - if (forElement) { - var defaultValueCode = element.element.defaultValueCode; - if (defaultValueCode != null) { - _write(' = '); - _write(defaultValueCode); - } - } - } - void _writeWithoutDelimiters2( FormalParameterElementMixin element, { required bool forElement, @@ -707,8 +550,9 @@ _writeType(element.type); if (forElement || element.isNamed) { - _write(' '); - _write(element.displayName); + if (element.name case var name?) { + _write(' $name'); + } } if (forElement) {
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart index 8fe00ce..854003d 100644 --- a/pkg/analyzer/lib/src/dart/element/element.dart +++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -149,6 +149,13 @@ ClassElementImpl(this.reference, this._firstFragment) { reference.element = this; firstFragment.element = this; + + isAbstract = firstFragment.isAbstract; + isBase = firstFragment.isBase; + isFinal = firstFragment.isFinal; + isInterface = firstFragment.isInterface; + isMixinClass = firstFragment.isMixinClass; + isSealed = firstFragment.isSealed; } /// If we can find all possible subtypes of this class, return them. @@ -269,11 +276,23 @@ @override @trackedIncludedIntoId - bool get isAbstract => firstFragment.isAbstract; + bool get isAbstract { + return hasModifier(Modifier.ABSTRACT); + } + + set isAbstract(bool isAbstract) { + setModifier(Modifier.ABSTRACT, isAbstract); + } @override @trackedIncludedIntoId - bool get isBase => firstFragment.isBase; + bool get isBase { + return hasModifier(Modifier.BASE); + } + + set isBase(bool isBase) { + setModifier(Modifier.BASE, isBase); + } @override @trackedIncludedIntoId @@ -335,11 +354,23 @@ @override @trackedIncludedIntoId - bool get isFinal => firstFragment.isFinal; + bool get isFinal { + return hasModifier(Modifier.FINAL); + } + + set isFinal(bool isFinal) { + setModifier(Modifier.FINAL, isFinal); + } @override @trackedIncludedIntoId - bool get isInterface => firstFragment.isInterface; + bool get isInterface { + return hasModifier(Modifier.INTERFACE); + } + + set isInterface(bool isInterface) { + setModifier(Modifier.INTERFACE, isInterface); + } @override @trackedIncludedIntoId @@ -347,11 +378,23 @@ @override @trackedIncludedIntoId - bool get isMixinClass => firstFragment.isMixinClass; + bool get isMixinClass { + return hasModifier(Modifier.MIXIN_CLASS); + } + + set isMixinClass(bool isMixinClass) { + setModifier(Modifier.MIXIN_CLASS, isMixinClass); + } @override @trackedIncludedIntoId - bool get isSealed => firstFragment.isSealed; + bool get isSealed { + return hasModifier(Modifier.SEALED); + } + + set isSealed(bool isSealed) { + setModifier(Modifier.SEALED, isSealed); + } @override @trackedIncludedIntoId @@ -375,6 +418,11 @@ } @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeClassElement(this); + } + + @override @trackedIndirectly bool isExtendableIn(LibraryElement library) { if (library == this.library) { @@ -548,8 +596,7 @@ } /// An [InterfaceFragmentImpl] which is a class. -class ClassFragmentImpl extends ClassOrMixinFragmentImpl - implements ClassFragment { +class ClassFragmentImpl extends InterfaceFragmentImpl implements ClassFragment { @override late final ClassElementImpl element; @@ -577,11 +624,14 @@ setModifier(Modifier.ABSTRACT, isAbstract); } - @override bool get isBase { return hasModifier(Modifier.BASE); } + set isBase(bool isBase) { + setModifier(Modifier.BASE, isBase); + } + bool get isConstructable => !isSealed && !isAbstract; bool get isDartCoreEnum { @@ -667,28 +717,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeClassElement(this); - } -} - -abstract class ClassOrMixinFragmentImpl extends InterfaceFragmentImpl { - /// Initialize a newly created class element to have the given [name] at the - /// given [offset] in the file that contains the declaration of this element. - ClassOrMixinFragmentImpl({ - required super.name, - required super.firstTokenOffset, - }); - - bool get isBase { - return hasModifier(Modifier.BASE); - } - - set isBase(bool isBase) { - setModifier(Modifier.BASE, isBase); - } } class ConstantInitializerImpl implements ConstantInitializer { @@ -716,7 +744,6 @@ class ConstructorElementImpl extends ExecutableElementImpl with FragmentedExecutableElementMixin<ConstructorFragmentImpl>, - FragmentedFunctionTypedElementMixin<ConstructorFragmentImpl>, FragmentedTypeParameterizedElementMixin<ConstructorFragmentImpl>, FragmentedAnnotatableElementMixin<ConstructorFragmentImpl>, FragmentedElementMixin<ConstructorFragmentImpl>, @@ -856,7 +883,12 @@ @override InterfaceTypeImpl get returnType { - return firstFragment.returnType; + var result = _returnType; + if (result != null) { + return result as InterfaceTypeImpl; + } + + return _returnType = enclosingElement.thisType; } @override @@ -884,6 +916,11 @@ @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeConstructorElement(this); + } + /// Ensures that dependencies of this constructor, such as default values /// of formal parameters, are evaluated. void computeConstantDependencies() { @@ -891,17 +928,6 @@ } @override - String displayString({bool multiline = false, bool preferTypeAlias = false}) { - // TODO(scheglov): de-duplicate - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - builder.writeConstructorElement(this); - return builder.toString(); - } - - @override void visitChildren<T>(ElementVisitor2<T> visitor) { for (var child in children) { child.accept(visitor); @@ -1073,38 +1099,6 @@ firstTokenOffset ?? enclosingElement.offset; - @override - InterfaceTypeImpl get returnType { - var result = _returnType; - if (result != null) { - return result as InterfaceTypeImpl; - } - - result = enclosingElement.element.thisType; - return _returnType = result as InterfaceTypeImpl; - } - - @override - FunctionTypeImpl get type { - // TODO(scheglov): Remove "element" in the breaking changes branch. - return _type ??= FunctionTypeImpl( - typeParameters: typeParameters.map((f) => f.asElement2).toList(), - parameters: parameters.map((f) => f.asElement2).toList(), - returnType: returnType, - nullabilitySuffix: NullabilitySuffix.none, - ); - } - - @override - set type(FunctionType type) { - assert(false); - } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeConstructorFragment(this); - } - /// Ensures that dependencies of this constructor, such as default values /// of formal parameters, are evaluated. void computeConstantDependencies() { @@ -1316,6 +1310,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeDynamicElement(this); + } } /// The synthetic element representing the declaration of the type `dynamic`. @@ -1887,7 +1886,7 @@ /// Append a textual representation of this element to the given [builder]. void appendTo(ElementDisplayStringBuilder builder) { - builder.writeAbstractElement2(this); + builder.writeAbstractElement(this); } @override @@ -1943,6 +1942,10 @@ return isAccessibleIn(library); } + void readModifiers(SummaryDataReader reader) { + _modifiers = EnumSet(reader.readInt64()); + } + /// Update [modifier] of this element to [value]. void setModifier(Modifier modifier, bool value) { _modifiers = _modifiers.updated(modifier, value); @@ -2001,6 +2004,10 @@ void visitChildren2<T>(ElementVisitor2<T> visitor) { visitChildren(visitor); } + + void writeModifiers(BufferedSink writer) { + _modifiers.write(writer); + } } class EnumElementImpl extends InterfaceElementImpl implements EnumElement { @@ -2056,6 +2063,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeEnumElement(this); + } } /// An [InterfaceFragmentImpl] which is an enum. @@ -2091,11 +2103,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeEnumElement(this); - } } /// Common base class for all analyzer-internal classes that implement @@ -2121,6 +2128,7 @@ with DeferredResolutionReadingMixin implements ExecutableElement2OrMember, AnnotatableElementImpl { TypeImpl? _returnType; + FunctionTypeImpl? _type; @override ExecutableElementImpl get baseElement => this; @@ -2136,6 +2144,9 @@ @override List<Element> get children2 => children; + @override + ExecutableFragmentImpl get firstFragment; + /// Whether the type of this element references a type parameter of the /// enclosing element. This includes not only explicitly specified type /// annotations, but also inferred types. @@ -2143,17 +2154,17 @@ /// Top-level declarations don't have enclosing element type parameters, /// so for them this flag is always `false`. bool get hasEnclosingTypeParameterReference { - var firstFragment = this.firstFragment as ExecutableFragmentImpl; + var firstFragment = this.firstFragment; return firstFragment.hasEnclosingTypeParameterReference; } bool get invokesSuperSelf { - var firstFragment = this.firstFragment as ExecutableFragmentImpl; + var firstFragment = this.firstFragment; return firstFragment.hasModifier(Modifier.INVOKES_SUPER_SELF); } ExecutableFragmentImpl get lastFragment { - var result = firstFragment as ExecutableFragmentImpl; + var result = firstFragment; while (true) { if (result.nextFragment case ExecutableFragmentImpl nextFragment) { result = nextFragment; @@ -2165,7 +2176,7 @@ @override LibraryElementImpl get library { - var firstFragment = this.firstFragment as ExecutableFragmentImpl; + var firstFragment = this.firstFragment; return firstFragment.library; } @@ -2181,6 +2192,8 @@ if (_returnType == null && isSynthetic) { if (this case GetterElementImpl thisGetter) { thisGetter.variable!.type; + } else if (this case SetterElementImpl thisSetter) { + thisSetter.variable!.type; } } @@ -2189,6 +2202,29 @@ set returnType(TypeImpl value) { _returnType = value; + // We do this because of return type inference. At the moment when we + // create a local function element we don't know yet its return type, + // because we have not done static type analysis yet. + // It somewhere it between we access the type of this element, so it gets + // cached in the element. When we are done static type analysis, we then + // should clear this cached type to make it right. + // TODO(scheglov): Remove when type analysis is done in the single pass. + _type = null; + } + + @override + FunctionTypeImpl get type { + return _type ??= FunctionTypeImpl( + typeParameters: typeParameters.cast(), + parameters: formalParameters, + returnType: returnType, + nullabilitySuffix: NullabilitySuffix.none, + ); + } + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeExecutableElement(this, name!); } } @@ -2199,12 +2235,6 @@ /// element. List<FormalParameterFragmentImpl> _parameters = const []; - /// The inferred return type of this executable element. - TypeImpl? _returnType; - - /// The type of function defined by this executable element. - FunctionTypeImpl? _type; - /// Initialize a newly created executable element to have the given [name] and /// [offset]. ExecutableFragmentImpl({required super.firstTokenOffset}); @@ -2358,57 +2388,6 @@ List<FormalParameterFragmentImpl> get parameters_unresolved { return _parameters; } - - /// The return type specified by this fragment. - TypeImpl get returnType { - _ensureReadResolution(); - - // If a synthetic getter, we might need to infer the type. - if (_returnType == null && isSynthetic) { - if (this case GetterFragmentImpl thisGetter) { - thisGetter.element.variable!.type; - } else if (this case SetterFragmentImpl thisSetter) { - thisSetter.element.variable!.type; - } - } - - return _returnType!; - } - - set returnType(DartType returnType) { - // TODO(paulberry): eliminate this cast by changing the setter parameter - // type to `TypeImpl`. - _returnType = returnType as TypeImpl; - // We do this because of return type inference. At the moment when we - // create a local function element we don't know yet its return type, - // because we have not done static type analysis yet. - // It somewhere it between we access the type of this element, so it gets - // cached in the element. When we are done static type analysis, we then - // should clear this cached type to make it right. - // TODO(scheglov): Remove when type analysis is done in the single pass. - _type = null; - } - - /// The type defined by this element. - FunctionTypeImpl get type { - if (_type != null) return _type!; - - return _type = FunctionTypeImpl( - typeParameters: typeParameters.map((f) => f.asElement2).toList(), - parameters: parameters.map((f) => f.asElement2).toList(), - returnType: returnType, - nullabilitySuffix: NullabilitySuffix.none, - ); - } - - set type(FunctionTypeImpl type) { - _type = type; - } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeExecutableFragment(this, displayName); - } } class ExtensionElementImpl extends InstanceElementImpl @@ -2463,6 +2442,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeExtensionElement(this); + } } class ExtensionFragmentImpl extends InstanceFragmentImpl @@ -2523,11 +2507,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeExtensionElement(this); - } } class ExtensionTypeElementImpl extends InterfaceElementImpl @@ -2615,6 +2594,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeExtensionTypeElement(this); + } } class ExtensionTypeFragmentImpl extends InterfaceFragmentImpl @@ -2668,11 +2652,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeExtensionTypeElement(this); - } } /// Common base class for all analyzer-internal classes that implement @@ -2994,6 +2973,11 @@ @override late TypeImpl type; + /// Whether this formal parameter inherits from a covariant formal parameter. + /// This happens when it overrides a method in a supertype that has a + /// corresponding covariant formal parameter. + bool inheritsCovariant = false; + FormalParameterElementImpl(this.wrappedElement) { FormalParameterFragmentImpl? fragment = wrappedElement; while (fragment != null) { @@ -3054,8 +3038,12 @@ bool get isConst => wrappedElement.isConst; @override - // TODO(augmentations): Implement the merge of formal parameters. - bool get isCovariant => wrappedElement.isCovariant; + bool get isCovariant { + if (firstFragment.isExplicitlyCovariant || inheritsCovariant) { + return true; + } + return false; + } @override // TODO(augmentations): Implement the merge of formal parameters. @@ -3155,6 +3143,11 @@ T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeFormalParameterElement(this); + } + + @override void visitChildren<T>(ElementVisitor2<T> visitor) { for (var child in children) { child.accept(visitor); @@ -3226,11 +3219,6 @@ /// Prefer using `isXyz` instead, e.g. [isRequiredNamed]. final ParameterKind parameterKind; - /// True if this parameter inherits from a covariant parameter. This happens - /// when it overrides a method in a supertype that has a corresponding - /// covariant parameter. - bool inheritsCovariant = false; - /// The element corresponding to this fragment. FormalParameterElementImpl? _element; @@ -3293,15 +3281,6 @@ @override Fragment? get enclosingFragment => enclosingElement as Fragment?; - /// Whether the parameter is covariant, meaning it is allowed to have a - /// narrower type in an override. - bool get isCovariant { - if (isExplicitlyCovariant || inheritsCovariant) { - return true; - } - return false; - } - /// Return true if this parameter is explicitly marked as being covariant. bool get isExplicitlyCovariant { return hasModifier(Modifier.COVARIANT); @@ -3429,11 +3408,6 @@ _typeParameters = typeParameters; } - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeFormalParameter(this); - } - FormalParameterElementImpl _createElement( FormalParameterFragment firstFragment, ) => FormalParameterElementImpl(firstFragment as FormalParameterFragmentImpl); @@ -3503,19 +3477,6 @@ } return result; } - - String displayString({bool multiline = false, bool preferTypeAlias = false}) { - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - var fragment = firstFragment; - if (fragment is! FragmentImpl) { - throw UnsupportedError('Fragment is not an ElementImpl'); - } - (fragment as FragmentImpl).appendTo(builder); - return builder.toString(); - } } mixin FragmentedExecutableElementMixin<E extends ExecutableFragmentImpl> @@ -3559,38 +3520,6 @@ bool get isStatic => (firstFragment as ExecutableFragmentImpl).isStatic; } -mixin FragmentedFunctionTypedElementMixin<E extends ExecutableFragment> - implements FragmentedElementMixin<E> { - // TODO(augmentations): This might be wrong. The parameters need to be a - // merge of the parameters of all of the fragments, but this probably doesn't - // account for missing data (such as the parameter types). - List<FormalParameterElementMixin> get formalParameters { - var fragment = firstFragment; - return switch (fragment) { - FunctionTypedFragmentImpl(:var parameters) => - parameters.map((fragment) => fragment.asElement2).toList(), - ExecutableFragmentImpl(:var parameters) => - parameters.map((fragment) => fragment.asElement2).toList(), - _ => - throw UnsupportedError( - 'Cannot get formal parameters for ${fragment.runtimeType}', - ), - }; - } - - // TODO(augmentations): This is wrong. The function type needs to be a merge - // of the function types of all of the fragments, but I don't know how to - // perform that merge. - FunctionTypeImpl get type { - if (firstFragment is ExecutableFragmentImpl) { - return (firstFragment as ExecutableFragmentImpl).type; - } else if (firstFragment is FunctionTypedFragmentImpl) { - return (firstFragment as FunctionTypedFragmentImpl).type; - } - throw UnimplementedError(); - } -} - mixin FragmentedTypeParameterizedElementMixin< E extends TypeParameterizedFragment > @@ -3806,11 +3735,6 @@ return identical(this, other); } - /// Append a textual representation of this element to the given [builder]. - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeAbstractElement(this); - } - /// Set this element as the enclosing element for given [element]. void encloseElement(FragmentImpl element) { element.enclosingElement = this; @@ -3823,36 +3747,6 @@ } } - /// Returns the presentation of this element as it should appear when - /// presented to users. - /// - /// If [withNullability] is `true`, then [NullabilitySuffix.question] and - /// [NullabilitySuffix.star] in types will be represented as `?` and `*`. - /// [NullabilitySuffix.none] does not have any explicit presentation. - /// - /// If [withNullability] is `false`, nullability suffixes will not be - /// included into the presentation. - /// - /// If [multiline] is `true`, the string may be wrapped over multiple lines - /// with newlines to improve formatting. For example function signatures may - /// be formatted as if they had trailing commas. - /// - /// Clients should not depend on the content of the returned value as it will - /// be changed if doing so would improve the UX. - String getDisplayString({ - @Deprecated('Only non-nullable by default mode is supported') - bool withNullability = true, - bool multiline = false, - bool preferTypeAlias = false, - }) { - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - appendTo(builder); - return builder.toString(); - } - /// Return `true` if this element has the given [modifier] associated with it. bool hasModifier(Modifier modifier) => _modifiers[modifier]; @@ -3874,7 +3768,7 @@ @override String toString() { - return getDisplayString(); + return "fragmentOf: $element"; } void writeModifiers(BufferedSink writer) { @@ -3941,11 +3835,6 @@ /// The parameters defined by this executable element. List<FormalParameterFragmentImpl> get parameters; - set returnType(DartType returnType); - - /// The type defined by this element. - FunctionTypeImpl get type; - /// The type parameters declared by this element directly. /// /// This does not include type parameters that are declared by any enclosing @@ -4024,7 +3913,7 @@ String? get name3 => name; @override - DartType get returnType => _wrappedElement.returnType; + TypeImpl get returnType => _wrappedElement.returnType; @override FunctionType get type => _wrappedElement.type; @@ -4047,6 +3936,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeGenericFunctionTypeElement(this); + } } /// The element used for a generic function type. @@ -4130,14 +4024,12 @@ /// Set the return type defined by this function type element to the given /// [returnType]. - @override set returnType(DartType returnType) { // TODO(paulberry): eliminate this cast by changing the setter parameter // type to `TypeImpl`. _returnType = returnType as TypeImpl; } - @override FunctionTypeImpl get type { if (_type != null) return _type!; @@ -4155,11 +4047,6 @@ set type(FunctionTypeImpl type) { _type = type; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeGenericFunctionTypeElement(this); - } } /// Common base class for all analyzer-internal classes that implement @@ -4173,7 +4060,6 @@ class GetterElementImpl extends PropertyAccessorElementImpl with FragmentedExecutableElementMixin<GetterFragmentImpl>, - FragmentedFunctionTypedElementMixin<GetterFragmentImpl>, FragmentedTypeParameterizedElementMixin<GetterFragmentImpl>, FragmentedAnnotatableElementMixin<GetterFragmentImpl>, FragmentedElementMixin<GetterFragmentImpl>, @@ -4254,6 +4140,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeGetterElement(this); + } } class GetterFragmentImpl extends PropertyAccessorFragmentImpl @@ -4276,11 +4167,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeExecutableFragment(this, 'get $displayName'); - } } /// A concrete implementation of a [HideElementCombinator]. @@ -4479,15 +4365,6 @@ _setters = [..._setters, element]; } - @override - String displayString({ - bool multiline = false, - bool preferTypeAlias = false, - }) => firstFragment.getDisplayString( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - @Deprecated('Use displayString instead') @override String displayString2({ @@ -4947,6 +4824,10 @@ List<ConstructorElementImpl> _constructors = _Sentinel.constructorElement; + /// A flag indicating whether the types associated with the instance members + /// of this class have been inferred. + bool hasBeenInferred = false; + @override List<InterfaceTypeImpl> get allSupertypes { return _allSupertypes ??= library.session.classHierarchy @@ -5303,10 +5184,6 @@ InterfaceTypeImpl? _supertype; - /// A flag indicating whether the types associated with the instance members - /// of this class have been inferred. - bool hasBeenInferred = false; - List<ConstructorFragmentImpl> _constructors = _Sentinel.constructorFragment; /// Initialize a newly created class element to have the given [name] at the @@ -5628,13 +5505,9 @@ T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); @override - String displayString({ - bool multiline = false, - bool preferTypeAlias = false, - }) => _wrappedFragment.getDisplayString( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeLabelElement(this); + } @Deprecated('Use displayString instead') @override @@ -6149,16 +6022,6 @@ builder.writeLibraryElement(this); } - @override - String displayString({bool multiline = false, bool preferTypeAlias = false}) { - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - appendTo(builder); - return builder.toString(); - } - @Deprecated('Use displayString instead') @override String displayString2({ @@ -6812,11 +6675,6 @@ fragment.enclosingElement = this; } - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeCompilationUnitElement(this); - } - /// Indicates whether it is unnecessary to report an undefined identifier /// error for an identifier reference with the given [name] and optional /// [prefix]. @@ -6971,7 +6829,6 @@ ); fragment.isSynthetic = true; fragment.isStatic = true; - fragment.returnType = library.typeProvider.futureDynamicType; fragment.enclosingElement = library.definingCompilationUnit; return TopLevelFunctionElementImpl(elementReference, fragment) @@ -7056,12 +6913,6 @@ String? get name3 => name; @override - TypeImpl get returnType => _wrappedFragment.returnType; - - @override - FunctionTypeImpl get type => _wrappedFragment.type; - - @override List<TypeParameterElement> get typeParameters => _wrappedFragment.typeParameters .map((fragment) => (fragment as TypeParameterFragment).element) @@ -7085,13 +6936,9 @@ T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); @override - String displayString({ - bool multiline = false, - bool preferTypeAlias = false, - }) => _wrappedFragment.getDisplayString( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeLocalFunctionElement(this); + } @Deprecated('Use displayString instead') @override @@ -7208,16 +7055,6 @@ @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); - @override - String displayString({bool multiline = false, bool preferTypeAlias = false}) { - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); - builder.writeVariableElement2(this); - return builder.toString(); - } - @Deprecated('Use displayString instead') @override String displayString2({ @@ -7697,7 +7534,6 @@ class MethodElementImpl extends ExecutableElementImpl with FragmentedExecutableElementMixin<MethodFragmentImpl>, - FragmentedFunctionTypedElementMixin<MethodFragmentImpl>, FragmentedTypeParameterizedElementMixin<MethodFragmentImpl>, FragmentedAnnotatableElementMixin<MethodFragmentImpl>, FragmentedElementMixin<MethodFragmentImpl>, @@ -7712,6 +7548,15 @@ @override final MethodFragmentImpl firstFragment; + /// Is `true` if this method is `operator==`, and there is no explicit + /// type specified for its formal parameter, in this method or in any + /// overridden methods other than the one declared in `Object`. + bool isOperatorEqualWithParameterTypeFromObject = false; + + /// The error reported during type inference for this variable, or `null` if + /// this variable is not a subject of type inference, or there was no error. + TopLevelInferenceError? typeInferenceError; + MethodElementImpl({ required this.name, required this.reference, @@ -7780,6 +7625,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeMethodElement(this); + } } class MethodFragmentImpl extends ExecutableFragmentImpl @@ -7799,15 +7649,6 @@ @override MethodFragmentImpl? nextFragment; - /// Is `true` if this method is `operator==`, and there is no explicit - /// type specified for its formal parameter, in this method or in any - /// overridden methods other than the one declared in `Object`. - bool isOperatorEqualWithParameterTypeFromObject = false; - - /// The error reported during type inference for this variable, or `null` if - /// this variable is not a subject of type inference, or there was no error. - TopLevelInferenceError? typeInferenceError; - /// Initialize a newly created method element to have the given [name] at the /// given [offset]. MethodFragmentImpl({required this.name, required super.firstTokenOffset}); @@ -7876,6 +7717,8 @@ MixinElementImpl(this.reference, this.firstFragment) { reference.element = this; firstFragment.element = this; + + isBase = firstFragment.isBase; } @override @@ -7891,7 +7734,13 @@ } @override - bool get isBase => firstFragment.isBase; + bool get isBase { + return hasModifier(Modifier.BASE); + } + + set isBase(bool isBase) { + setModifier(Modifier.BASE, isBase); + } @override ElementKind get kind => ElementKind.MIXIN; @@ -7916,6 +7765,11 @@ T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeMixinElement(this); + } + + @override bool isImplementableIn(LibraryElement library) { if (library == this.library) { return true; @@ -7931,8 +7785,7 @@ } /// A [ClassFragmentImpl] representing a mixin declaration. -class MixinFragmentImpl extends ClassOrMixinFragmentImpl - implements MixinFragment { +class MixinFragmentImpl extends InterfaceFragmentImpl implements MixinFragment { @override late final MixinElementImpl element; @@ -7947,11 +7800,14 @@ /// given [offset] in the file that contains the declaration of this element. MixinFragmentImpl({required super.name, required super.firstTokenOffset}); - @override bool get isBase { return hasModifier(Modifier.BASE); } + set isBase(bool isBase) { + setModifier(Modifier.BASE, isBase); + } + @override List<InterfaceTypeImpl> get mixins => const []; @@ -7993,11 +7849,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeMixinElement(this); - } } /// The constants for all of the modifiers defined by the Dart language and for @@ -8410,6 +8261,11 @@ @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeNeverElement(this); + } + DartType instantiate({required NullabilitySuffix nullabilitySuffix}) { switch (nullabilitySuffix) { case NullabilitySuffix.question: @@ -8718,13 +8574,8 @@ } @override - String displayString({bool multiline = false, bool preferTypeAlias = false}) { - var builder = ElementDisplayStringBuilder( - multiline: multiline, - preferTypeAlias: preferTypeAlias, - ); + void appendTo(ElementDisplayStringBuilder builder) { builder.writePrefixElement(this); - return builder.toString(); } @Deprecated('Use displayString instead') @@ -9038,12 +8889,10 @@ var element = this; if (element.getter case var getterElement?) { getterElement.returnType = type; - getterElement.firstFragment.returnType = type; } if (element.setter case var setterElement?) { if (setterElement.isSynthetic) { setterElement.returnType = VoidTypeImpl.instance; - setterElement.firstFragment.returnType = VoidTypeImpl.instance; (setterElement.formalParameters.single as FormalParameterElementImpl) .type = type; } @@ -9058,6 +8907,11 @@ } List<PropertyInducingFragmentImpl> get _fragments; + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeVariableElement2(this); + } } /// Instances of this class are set for fields and top-level variables @@ -9147,7 +9001,6 @@ class SetterElementImpl extends PropertyAccessorElementImpl with FragmentedExecutableElementMixin<SetterFragmentImpl>, - FragmentedFunctionTypedElementMixin<SetterFragmentImpl>, FragmentedTypeParameterizedElementMixin<SetterFragmentImpl>, FragmentedAnnotatableElementMixin<SetterFragmentImpl>, FragmentedElementMixin<SetterFragmentImpl>, @@ -9247,6 +9100,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeSetterElement(this); + } } class SetterFragmentImpl extends PropertyAccessorFragmentImpl @@ -9281,11 +9139,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeExecutableFragment(this, 'set $displayName'); - } } /// A concrete implementation of a [ShowElementCombinator]. @@ -9487,7 +9340,6 @@ class TopLevelFunctionElementImpl extends ExecutableElementImpl with FragmentedExecutableElementMixin<FunctionFragmentImpl>, - FragmentedFunctionTypedElementMixin<FunctionFragmentImpl>, FragmentedTypeParameterizedElementMixin<FunctionFragmentImpl>, FragmentedAnnotatableElementMixin<FunctionFragmentImpl>, FragmentedElementMixin<FunctionFragmentImpl>, @@ -9568,6 +9420,11 @@ @Deprecated('Use accept instead') @override T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); + + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeTopLevelFunctionElement(this); + } } /// A concrete implementation of a [TopLevelFunctionFragment]. @@ -9751,17 +9608,19 @@ @override final TypeAliasFragmentImpl firstFragment; + TypeImpl? _aliasedType; + TypeAliasElementImpl(this.reference, this.firstFragment) { reference.element = this; firstFragment.element = this; } @override - Element? get aliasedElement { + ElementImpl? get aliasedElement { switch (firstFragment.aliasedElement) { - case InstanceFragment instance: + case InstanceFragmentImpl instance: return instance.element; - case GenericFunctionTypeFragment instance: + case GenericFunctionTypeFragmentImpl instance: return instance.element; } return null; @@ -9774,14 +9633,19 @@ } @override - TypeImpl get aliasedType => firstFragment.aliasedType; + TypeImpl get aliasedType { + _ensureReadResolution(); + return _aliasedType!; + } - set aliasedType(TypeImpl value) { - firstFragment.aliasedType = value; + set aliasedType(DartType rawType) { + // TODO(paulberry): eliminate this cast by changing the type of the + // `rawType` parameter. + _aliasedType = rawType as TypeImpl; } /// The aliased type, might be `null` if not yet linked. - TypeImpl? get aliasedTypeRaw => firstFragment.aliasedTypeRaw; + TypeImpl? get aliasedTypeRaw => _aliasedType; @override TypeAliasElementImpl get baseElement => this; @@ -9882,6 +9746,11 @@ T? accept2<T>(ElementVisitor2<T> visitor) => accept(visitor); @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeTypeAliasElement(this); + } + + @override TypeImpl instantiate({ required List<DartType> typeArguments, required NullabilitySuffix nullabilitySuffix, @@ -9992,7 +9861,6 @@ bool isFunctionTypeAliasBased = false; FragmentImpl? _aliasedElement; - TypeImpl? _aliasedType; @override late TypeAliasElementImpl element; @@ -10017,25 +9885,6 @@ return _aliasedElement; } - /// The aliased type. - /// - /// If non-function type aliases feature is enabled for the enclosing library, - /// this type might be just anything. If the feature is disabled, return - /// a [FunctionType]. - TypeImpl get aliasedType { - _ensureReadResolution(); - return _aliasedType!; - } - - set aliasedType(DartType rawType) { - // TODO(paulberry): eliminate this cast by changing the type of the - // `rawType` parameter. - _aliasedType = rawType as TypeImpl; - } - - /// The aliased type, might be `null` if not yet linked. - TypeImpl? get aliasedTypeRaw => _aliasedType; - @override List<Fragment> get children => const []; @@ -10076,11 +9925,6 @@ fragment.previousFragment = this; nextFragment = fragment; } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeTypeAliasElement(this); - } } abstract class TypeDefiningElementImpl extends ElementImpl @@ -10177,7 +10021,7 @@ @override void appendTo(ElementDisplayStringBuilder builder) { - builder.writeTypeParameter2(this); + builder.writeTypeParameterElement(this); } @override @@ -10333,11 +10177,6 @@ set variance(shared.Variance? newVariance) => _variance = newVariance; - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeTypeParameter(this); - } - /// Computes the variance of the type parameters in the [type]. shared.Variance computeVarianceInType(DartType type) { if (type is TypeParameterTypeImpl) { @@ -10497,6 +10336,11 @@ // TODO(scheglov): eventually move logic from PropertyInducingElementImpl } + @override + void appendTo(ElementDisplayStringBuilder builder) { + builder.writeVariableElement2(this); + } + /// Return a representation of the value of this variable, forcing the value /// to be computed if it had not previously been computed, or `null` if either /// this variable was not declared with the 'const' modifier or if the value @@ -10651,11 +10495,6 @@ } throw StateError('($runtimeType) $this'); } - - @override - void appendTo(ElementDisplayStringBuilder builder) { - builder.writeVariableElement(this); - } } abstract class _ExistingFragmentImpl extends FragmentImpl
diff --git a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart index 4a12b85..51f5b08 100644 --- a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart +++ b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
@@ -981,7 +981,6 @@ resultFragment.isSynthetic = true; resultFragment.parameters = transformedParameters.map((e) => e.firstFragment).toList(); - resultFragment.returnType = executable.returnType; resultFragment.typeParameters = executable.typeParameters .map((e) => e.firstFragment as TypeParameterFragmentImpl) @@ -993,6 +992,7 @@ reference: elementReference, firstFragment: resultFragment, ); + result.returnType = executable.returnType; return result; } @@ -1014,9 +1014,9 @@ resultFragment.isSynthetic = true; resultFragment.parameters = transformedParameters.map((e) => e.firstFragment).toList(); - resultFragment.returnType = executable.returnType; var result = SetterElementImpl(setterReference, resultFragment); + result.returnType = executable.returnType; var resultField = FieldFragmentImpl( name: executable.name, @@ -1084,7 +1084,6 @@ resultFragment.enclosingElement = targetClass.firstFragment; resultFragment.typeParameters = resultType.typeParameters.map((e) => e.firstFragment).toList(); - resultFragment.returnType = resultType.returnType; // TODO(scheglov): check if can type cast instead resultFragment.parameters = resultType.parameters @@ -1097,6 +1096,7 @@ reference: elementReference, firstFragment: resultFragment, ); + resultElement.returnType = resultType.returnType; return resultElement; } else { @@ -1137,10 +1137,11 @@ ); resultFragment = fragment; - resultElement = SetterElementImpl(elementReference, fragment); + var element = SetterElementImpl(elementReference, fragment); + element.returnType = resultType.returnType; + resultElement = element; } resultFragment.enclosingElement = targetClass.firstFragment; - resultFragment.returnType = resultType.returnType; // TODO(scheglov): check if can type cast instead resultFragment.parameters = resultType.parameters @@ -1161,9 +1162,9 @@ resultFragment.element.variable = fieldElement; if (firstElement is GetterElement) { - fieldElement.type = resultFragment.returnType; + fieldElement.type = resultType.returnType; } else { - var type = resultFragment.parameters[0].element.type; + var type = resultType.formalParameters[0].type; fieldElement.type = type; }
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart index 24f2ef6..a86d820 100644 --- a/pkg/analyzer/lib/src/dart/element/member.dart +++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -991,7 +991,7 @@ @override void appendTo(ElementDisplayStringBuilder builder) { - builder.writeFormalParameter2(this); + builder.writeFormalParameterElement(this); } @override
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart index cfd4dd2..bf4b595 100644 --- a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart +++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
@@ -184,13 +184,11 @@ ); } - void _resolve2(FunctionExpressionImpl node, DartType? imposedType) { + void _resolve2(FunctionExpressionImpl node, TypeImpl? imposedType) { var functionElement = node.declaredFragment!.element; if (_shouldUpdateReturnType(node)) { - var firstFragment = - functionElement.firstFragment as ExecutableFragmentImpl; - firstFragment.returnType = imposedType ?? DynamicTypeImpl.instance; + functionElement.returnType = imposedType ?? DynamicTypeImpl.instance; } node.recordStaticType(functionElement.type, resolver: _resolver);
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart index 642733e..2f3cde2 100644 --- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart +++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -759,7 +759,8 @@ node.returnType?.accept(this); if (_elementWalker == null) { - fragment.returnType = node.returnType?.type ?? _dynamicType; + fragment.element.returnType = + node.returnType?.type ?? _dynamicType; } _defineFormalParameters(fragment.element.formalParameters); @@ -793,7 +794,7 @@ node.declaredFragment = fragment; fragment.hasImplicitReturnType = true; - fragment.returnType = DynamicTypeImpl.instance; + fragment.element.returnType = DynamicTypeImpl.instance; FunctionBody body = node.body; fragment.isAsynchronous = body.isAsynchronous;
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart index 503c4b2..c46fb13 100644 --- a/pkg/analyzer/lib/src/error/inheritance_override.dart +++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -937,7 +937,7 @@ bool _reportNoCombinedSuperSignature(MethodDeclarationImpl node) { var fragment = node.declaredFragment; if (fragment is MethodFragmentImpl) { - var inferenceError = fragment.typeInferenceError; + var inferenceError = fragment.element.typeInferenceError; if (inferenceError?.kind == TopLevelInferenceErrorKind.overrideNoCombinedSuperSignature) { reporter.atToken(
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart index 7944be7..4d44131 100644 --- a/pkg/analyzer/lib/src/generated/resolver.dart +++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -5294,7 +5294,7 @@ node.type.accept(this); var aliasedElement = element.aliasedElement; - if (aliasedElement is GenericFunctionTypeElement) { + if (aliasedElement is GenericFunctionTypeElementImpl) { nameScope = FormalParameterScope( TypeParameterScope(nameScope, aliasedElement.typeParameters), aliasedElement.formalParameters,
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart index 182fc3c..d167820 100644 --- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart +++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -1217,7 +1217,6 @@ AstBinaryFlags.isRequired(flags) ? Tokens.required_() : null, ); var actualType = _reader.readRequiredType(); - _reader.readByte(); // TODO(scheglov): inherits covariant var fragment = FormalParameterFragmentImpl( firstTokenOffset: null,
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart index 6c4904d..64274fa 100644 --- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart +++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -751,9 +751,6 @@ _writeOptionalNode(node.type); _storeNormalFormalParameter(node, node.keyword); - - var element = node.declaredFragment!; - _sink.writeByte(element.inheritsCovariant ? 1 : 0); } @override
diff --git a/pkg/analyzer/lib/src/summary2/bundle_reader.dart b/pkg/analyzer/lib/src/summary2/bundle_reader.dart index 6b78484..d520924 100644 --- a/pkg/analyzer/lib/src/summary2/bundle_reader.dart +++ b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
@@ -266,6 +266,7 @@ var fragments = _readFragmentsById<ClassFragmentImpl>(); // TODO(scheglov): link fragments. var element = ClassElementImpl(reference, fragments.first); + element.readModifiers(_reader); // Configure for reading members lazily. _lazyRead((offset) { @@ -359,6 +360,7 @@ var enclosingElement = element.enclosingElement as InstanceElementImpl; reader._addTypeParameters2(enclosingElement.typeParameters); + element.returnType = reader.readRequiredType(); element.superConstructor = reader.readConstructorElementMixin(); element.redirectedConstructor = reader.readConstructorElementMixin(); }), @@ -400,7 +402,6 @@ fragment.parameters, ); _readFragmentMetadata(fragment, reader); - fragment.returnType = reader.readRequiredType(); fragment.constantInitializers = reader.readNodeList(); }, ); @@ -745,6 +746,7 @@ parameter.metadata = reader._readMetadata(unitElement: unitElement); _readTypeParameters2(unitElement, reader, parameter.typeParameters); _readFormalParameters2(unitElement, reader, parameter.parameters); + parameter.element.inheritsCovariant = reader.readBool(); var type = reader.readType() ?? InvalidTypeImpl.instance; parameter.element.type = type; parameter.constantInitializer = reader.readOptionalExpression(); @@ -832,7 +834,6 @@ fragment.parameters, ); _readFragmentMetadata(fragment, reader); - fragment.returnType = reader.readRequiredType(); }, ); }); @@ -916,6 +917,7 @@ reference: reference, firstFragment: fragments.first, ); + element.typeInferenceError = _readTopLevelInferenceError(); // TODO(scheglov): type parameters // TODO(scheglov): formal parameters @@ -943,7 +945,6 @@ var fragment = MethodFragmentImpl(name: name, firstTokenOffset: null); fragment.readModifiers(_reader); - fragment.typeInferenceError = _readTopLevelInferenceError(); fragment.typeParameters = _readTypeParameters(); fragment.parameters = _readParameters(); return fragment; @@ -964,7 +965,6 @@ fragment.parameters, ); _readFragmentMetadata(fragment, reader); - fragment.returnType = reader.readRequiredType(); }, ); }); @@ -976,6 +976,7 @@ var fragments = _readFragmentsById<MixinFragmentImpl>(); // TODO(scheglov): link fragments. var element = MixinElementImpl(reference, fragments.first); + element.readModifiers(_reader); // TODO(scheglov): consider reading lazily for (var fragment in element.fragments) { @@ -1160,7 +1161,6 @@ fragment.parameters, ); _readFragmentMetadata(fragment, reader); - fragment.returnType = reader.readRequiredType(); }, ); }); @@ -1243,7 +1243,6 @@ fragment.parameters, ); _readFragmentMetadata(fragment, reader); - fragment.returnType = reader.readRequiredType(); }, ); }); @@ -1305,8 +1304,16 @@ _libraryElement.typeAliases = _reader.readTypedList(() { var reference = _readReference(); var fragments = _readFragmentsById<TypeAliasFragmentImpl>(); - // TODO(scheglov): link fragments. var element = TypeAliasElementImpl(reference, fragments.first); + + element.deferReadResolution( + _createDeferredReadResolutionCallback((reader) { + // TODO(scheglov): remove cast + reader._addTypeParameters2(element.typeParameters.cast()); + element.aliasedType = reader.readRequiredType(); + }), + ); + return element; }); } @@ -1335,7 +1342,6 @@ ); _readFragmentMetadata(fragment, reader); fragment.aliasedElement = reader._readAliasedElement(unitElement); - fragment.aliasedType = reader.readRequiredType(); }, ); });
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart index 19c08ea..585d8e7 100644 --- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart +++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -151,6 +151,7 @@ _sink.writeList(element.fragments, (fragment) { _writeFragmentId(fragment); }); + element.writeModifiers(_sink); // We read members lazily. _writeForLazyRead(() { @@ -201,6 +202,7 @@ _writeElementResolution(() { // TODO(scheglov): avoid cast _resolutionSink.withTypeParameters(element.typeParameters.cast(), () { + _resolutionSink.writeType(element.returnType); _resolutionSink.writeElement(element.superConstructor); _resolutionSink.writeElement(element.redirectedConstructor); // TODO(scheglov): formal parameters @@ -215,7 +217,6 @@ _writeTypeParameters(fragment.typeParameters, () { _sink.writeList(fragment.formalParameters, _writeParameterElement); _resolutionSink._writeMetadata(fragment.metadata); - _resolutionSink.writeType(fragment.returnType); _resolutionSink._writeNodeList(fragment.constantInitializers); }); }); @@ -488,7 +489,6 @@ _writeTypeParameters(fragment.typeParameters, () { _sink.writeList(fragment.formalParameters, _writeParameterElement); _resolutionSink._writeMetadata(fragment.metadata); - _resolutionSink.writeType(fragment.returnType); }); }); } @@ -545,6 +545,7 @@ _sink.writeList(elements, (element) { _writeReference(element.reference); _sink.writeList(element.fragments, _writeFragmentId); + _sink._writeTopLevelInferenceError(element.typeInferenceError); _writeElementResolution(() { // TODO(scheglov): avoid cast @@ -558,11 +559,9 @@ void _writeMethodFragment(MethodFragmentImpl fragment) { _writeTemplateFragment(fragment, () { - _sink._writeTopLevelInferenceError(fragment.typeInferenceError); _writeTypeParameters(fragment.typeParameters, () { _sink.writeList(fragment.formalParameters, _writeParameterElement); _resolutionSink._writeMetadata(fragment.metadata); - _resolutionSink.writeType(fragment.returnType); }); }); } @@ -573,6 +572,7 @@ _sink.writeList(element.fragments, (fragment) { _writeFragmentId(fragment); }); + element.writeModifiers(_sink); // TODO(scheglov): consider reading lazily _resolutionSink.withTypeParameters(element.typeParameters, () { @@ -643,6 +643,7 @@ _writeTypeParameters(element.typeParameters, () { _writeList(element.parameters, _writeParameterElement); + _resolutionSink.writeBool(element.element.inheritsCovariant); _resolutionSink.writeType(element.element.type); _resolutionSink._writeOptionalNode(element.constantInitializer); @@ -696,7 +697,6 @@ _writeTypeParameters(fragment.typeParameters, () { _sink.writeList(fragment.formalParameters, _writeParameterElement); _resolutionSink._writeMetadata(fragment.metadata); - _resolutionSink.writeType(fragment.returnType); }); }); } @@ -732,7 +732,6 @@ _writeTypeParameters(fragment.typeParameters, () { _sink.writeList(fragment.formalParameters, _writeParameterElement); _resolutionSink._writeMetadata(fragment.metadata); - _resolutionSink.writeType(fragment.returnType); }); }); } @@ -748,7 +747,12 @@ _sink.writeList(elements, (element) { _writeReference(element.reference); _sink.writeList(element.fragments, _writeFragmentId); - // TODO(scheglov): resolution too? + + _writeElementResolution(() { + _resolutionSink.withTypeParameters(element.typeParameters.cast(), () { + _resolutionSink.writeType(element.aliasedType); + }); + }); }); } @@ -758,7 +762,6 @@ _writeTypeParameters(fragment.typeParameters, () { _resolutionSink._writeMetadata(fragment.metadata); _resolutionSink._writeAliasedElement(fragment.aliasedElement); - _resolutionSink.writeType(fragment.aliasedType); }); }); }
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart index 4a3db9d..3c0f043 100644 --- a/pkg/analyzer/lib/src/summary2/element_builder.dart +++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -107,8 +107,7 @@ for (var executable in instanceElement.children) { if (executable case ExecutableElementImpl executable) { // TODO(scheglov): should be a flag on the element instead - (executable.firstFragment as ExecutableFragmentImpl) - .isExtensionTypeMember = true; + executable.firstFragment.isExtensionTypeMember = true; } } }
diff --git a/pkg/analyzer/lib/src/summary2/element_flags.dart b/pkg/analyzer/lib/src/summary2/element_flags.dart index 6b14a07..6a9beb0 100644 --- a/pkg/analyzer/lib/src/summary2/element_flags.dart +++ b/pkg/analyzer/lib/src/summary2/element_flags.dart
@@ -332,9 +332,8 @@ class ParameterElementFlags { static const int _hasImplicitType = 1 << 0; - static const int _inheritsCovariant = 1 << 1; - static const int _isExplicitlyCovariant = 1 << 2; - static const int _isFinal = 1 << 3; + static const int _isExplicitlyCovariant = 1 << 1; + static const int _isFinal = 1 << 2; static void read( SummaryDataReader reader, @@ -342,7 +341,6 @@ ) { var byte = reader.readByte(); element.hasImplicitType = (byte & _hasImplicitType) != 0; - element.inheritsCovariant = (byte & _inheritsCovariant) != 0; element.isExplicitlyCovariant = (byte & _isExplicitlyCovariant) != 0; element.isFinal = (byte & _isFinal) != 0; } @@ -350,7 +348,6 @@ static void write(BufferedSink sink, FormalParameterFragmentImpl element) { var result = 0; result |= element.hasImplicitType ? _hasImplicitType : 0; - result |= element.inheritsCovariant ? _inheritsCovariant : 0; result |= element.isExplicitlyCovariant ? _isExplicitlyCovariant : 0; result |= element.isFinal ? _isFinal : 0; sink.writeByte(result);
diff --git a/pkg/analyzer/lib/src/summary2/extension_type.dart b/pkg/analyzer/lib/src/summary2/extension_type.dart index 993d996..f80b553 100644 --- a/pkg/analyzer/lib/src/summary2/extension_type.dart +++ b/pkg/analyzer/lib/src/summary2/extension_type.dart
@@ -159,7 +159,6 @@ representationElement.type = type; // TODO(scheglov): we repeat similar code in many places representationElement.getter!.returnType = type; - representationElement.getter!.firstFragment.returnType = type; element.firstFragment.typeErasure = type.extensionTypeErasure; element.firstFragment.interfaces =
diff --git a/pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart b/pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart index a154876..5ba79b9 100644 --- a/pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart +++ b/pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart
@@ -10,7 +10,6 @@ import 'package:analyzer/src/dart/element/type_system.dart'; import 'package:analyzer/src/error/inference_error.dart'; import 'package:analyzer/src/util/collection.dart'; -import 'package:analyzer/src/utilities/extensions/element.dart'; import 'package:collection/collection.dart'; /// An object used to infer the type of instance fields and the return types of @@ -19,9 +18,9 @@ /// https://github.com/dart-lang/language/blob/main/resources/type-system/inference.md class InstanceMemberInferrer { final InheritanceManager3 inheritance; - final Set<InterfaceFragmentImpl> elementsBeingInferred = {}; + final Set<InterfaceElementImpl> elementsBeingInferred = {}; - late InterfaceFragmentImpl currentInterfaceElement; + late InterfaceElementImpl currentInterfaceElement; /// Initialize a newly create inferrer. InstanceMemberInferrer(this.inheritance); @@ -30,24 +29,22 @@ return currentInterfaceElement.library.typeSystem; } - /// Infer type information for all of the instance members in the given - /// compilation [unit]. - void inferCompilationUnit(LibraryFragmentImpl unit) { - _inferClasses(unit.classes); - _inferClasses(unit.enums); - _inferExtensionTypes(unit.extensionTypes); - _inferClasses(unit.mixins); + void inferLibrary(LibraryElementImpl library) { + _inferClasses(library.classes); + _inferClasses(library.enums); + _inferExtensionTypes(library.extensionTypes); + _inferClasses(library.mixins); } /// Return `true` if the elements corresponding to the [elements] have the /// same kind as the [element]. bool _allSameElementKind( - ExecutableFragmentImpl element, - List<ExecutableFragmentImpl> elements, + ExecutableElementImpl element, + List<ExecutableElement2OrMember> elements, ) { - var elementKind = element.element.kind; + var elementKind = element.kind; for (int i = 0; i < elements.length; i++) { - if (elements[i].element.kind != elementKind) { + if (elements[i].kind != elementKind) { return false; } } @@ -58,7 +55,7 @@ /// given [parameter]. If the parameter is positional, then it appears at the /// given [index] in its enclosing element's list of parameters. FormalParameterElementMixin? _getCorrespondingParameter( - FormalParameterFragmentImpl parameter, + FormalParameterElementImpl parameter, int index, List<FormalParameterElementMixin> methodParameters, ) { @@ -88,24 +85,34 @@ return null; } - /// If the given [accessor] represents a non-synthetic instance property - /// accessor for which no type was provided, infer its types. + /// If the given [getter] represents a non-synthetic instance getter for + /// which no type was provided, infer its types. + /// + /// If the given [setter] represents a non-synthetic instance getter for + /// which no type was provided, infer its types. /// /// If the given [field] represents a non-synthetic instance field for /// which no type was provided, infer the type of the field. void _inferAccessorOrField({ - PropertyAccessorFragmentImpl? accessor, - FieldFragmentImpl? field, + GetterElementImpl? getter, + SetterElementImpl? setter, + FieldElementImpl? field, }) { Uri elementLibraryUri; String elementName; - if (accessor != null) { - if (accessor.isSynthetic || accessor.isStatic) { + if (getter != null) { + if (getter.isSynthetic || getter.isStatic) { return; } - elementLibraryUri = accessor.library.source.uri; - elementName = accessor.displayName; + elementLibraryUri = getter.library.source.uri; + elementName = getter.displayName; + } else if (setter != null) { + if (setter.isSynthetic || setter.isStatic) { + return; + } + elementLibraryUri = setter.library.source.uri; + elementName = setter.displayName; } else if (field != null) { if (field.isSynthetic || field.isStatic) { return; @@ -118,7 +125,7 @@ var getterName = Name(elementLibraryUri, elementName); var overriddenGetters = inheritance.getOverridden( - currentInterfaceElement.element, + currentInterfaceElement, getterName, ); if (overriddenGetters != null) { @@ -130,7 +137,7 @@ var setterName = Name(elementLibraryUri, '$elementName='); var overriddenSetters = inheritance.getOverridden( - currentInterfaceElement.element, + currentInterfaceElement, setterName, ); overriddenSetters ??= const []; @@ -162,8 +169,8 @@ return DynamicTypeImpl.instance; } - if (accessor != null && accessor is GetterFragmentImpl) { - if (!accessor.hasImplicitReturnType) { + if (getter != null) { + if (!getter.hasImplicitReturnType) { return; } @@ -177,9 +184,8 @@ // signature of said getter in the direct superinterfaces. if (overriddenGetters.isNotEmpty) { var returnType = combinedGetterType(); - accessor.returnType = returnType; - accessor.element.returnType = returnType; - var fieldElement = accessor.element.variable as FieldElementImpl; + getter.returnType = returnType; + var fieldElement = getter.variable as FieldElementImpl; fieldElement.type = returnType; return; } @@ -190,9 +196,8 @@ // setter in the direct superinterfaces. if (overriddenGetters.isEmpty && overriddenSetters.isNotEmpty) { var returnType = combinedSetterType(); - accessor.returnType = returnType; - accessor.element.returnType = returnType; - var fieldElement = accessor.element.variable as FieldElementImpl; + getter.returnType = returnType; + var fieldElement = getter.variable as FieldElementImpl; fieldElement.type = returnType; return; } @@ -200,18 +205,19 @@ return; } - if (accessor != null && accessor is SetterFragmentImpl) { - var parameters = accessor.parameters; - if (parameters.isEmpty) { + if (setter != null) { + var formalParameters = + setter.formalParameters.cast<FormalParameterElementImpl>(); + if (formalParameters.isEmpty) { return; } - var parameter = parameters[0]; + var valueFormalParameter = formalParameters[0]; - if (overriddenSetters.any((s) => _isCovariantSetter(s.declarationImpl))) { - parameter.inheritsCovariant = true; + if (overriddenSetters.any((s) => _isCovariantSetter(s.baseElement))) { + valueFormalParameter.inheritsCovariant = true; } - if (!parameter.hasImplicitType) { + if (!valueFormalParameter.hasImplicitType) { return; } @@ -221,8 +227,8 @@ // in the direct superinterfaces. if (overriddenGetters.isNotEmpty && overriddenSetters.isEmpty) { var valueType = combinedGetterType(); - parameter.element.type = valueType; - var fieldElement = accessor.element.variable as FieldElementImpl; + valueFormalParameter.type = valueType; + var fieldElement = setter.variable as FieldElementImpl; if (fieldElement.getter == null) { fieldElement.type = valueType; } @@ -239,8 +245,8 @@ // combined member signature of said setter in the direct superinterfaces. if (overriddenSetters.isNotEmpty) { var valueType = combinedSetterType(); - parameter.element.type = valueType; - var fieldElement = accessor.element.variable as FieldElementImpl; + valueFormalParameter.type = valueType; + var fieldElement = setter.variable as FieldElementImpl; fieldElement.type = valueType; return; } @@ -249,13 +255,12 @@ } if (field != null) { - var setter = field.element.setter?.firstFragment; + var setter = field.setter; if (setter != null) { - if (overriddenSetters.any( - (s) => _isCovariantSetter(s.declarationImpl), - )) { - var parameter = setter.parameters[0]; - parameter.inheritsCovariant = true; + if (overriddenSetters.any((s) => _isCovariantSetter(s.baseElement))) { + var formalParameter = setter.formalParameters[0]; + (formalParameter as FormalParameterElementImpl).inheritsCovariant = + true; } } @@ -317,19 +322,15 @@ } /// Infer type information for all of the instance members in the given - /// [classFragment]. - void _inferClass(InterfaceFragmentImpl classFragment) { - if (classFragment.isAugmentation) { + /// [element]. + void _inferClass(InterfaceElementImpl element) { + if (element.hasBeenInferred) { return; } - if (classFragment.hasBeenInferred) { - return; - } + _setInducedModifier(element); - _setInducedModifier(classFragment); - - if (!elementsBeingInferred.add(classFragment)) { + if (!elementsBeingInferred.add(element)) { // We have found a circularity in the class hierarchy. For now we just // stop trying to infer any type information for any classes that // inherit from any class in the cycle. We could potentially limit the @@ -343,38 +344,40 @@ // Ensure that all of instance members in the supertypes have had types // inferred for them. // - var element = classFragment.element; - _inferType(classFragment.supertype); + _inferType(element.supertype); element.mixins.forEach(_inferType); element.interfaces.forEach(_inferType); // // Then infer the types for the members. // // TODO(scheglov): get other members from the container - currentInterfaceElement = classFragment; - for (var field in classFragment.fields) { + currentInterfaceElement = element; + for (var field in element.fields) { _inferAccessorOrField(field: field); } - for (var accessor in classFragment.accessors) { - _inferAccessorOrField(accessor: accessor); + for (var getter in element.getters) { + _inferAccessorOrField(getter: getter); } - for (var method in classFragment.methods) { + for (var setter in element.setters) { + _inferAccessorOrField(setter: setter); + } + for (var method in element.methods) { _inferExecutable(method); } // // Infer initializing formal parameter types. This must happen after // field types are inferred. // - for (var constructor in classFragment.constructors) { + for (var constructor in element.constructors) { _inferConstructor(constructor); } - classFragment.hasBeenInferred = true; + element.hasBeenInferred = true; } finally { - elementsBeingInferred.remove(classFragment); + elementsBeingInferred.remove(element); } } - void _inferClasses(List<InterfaceFragmentImpl> elements) { + void _inferClasses(List<InterfaceElementImpl> elements) { for (var element in elements) { try { _inferClass(element); @@ -385,59 +388,57 @@ } } - void _inferConstructor(ConstructorFragmentImpl constructor) { - for (var parameter in constructor.parameters) { - if (parameter.hasImplicitType) { - if (parameter is FieldFormalParameterFragmentImpl) { - var field = parameter.field; + void _inferConstructor(ConstructorElementImpl constructor) { + for (var formalParameter in constructor.formalParameters) { + if (formalParameter.hasImplicitType) { + if (formalParameter is FieldFormalParameterElementImpl) { + var field = formalParameter.field; if (field != null) { - parameter.element.type = field.element.type; + formalParameter.type = field.type; } - } else if (parameter is SuperFormalParameterFragmentImpl) { - var superParameter = parameter.element.superConstructorParameter; + } else if (formalParameter is SuperFormalParameterElementImpl) { + var superParameter = formalParameter.superConstructorParameter; if (superParameter != null) { - parameter.element.type = superParameter.type; + formalParameter.type = superParameter.type; } else { - parameter.element.type = DynamicTypeImpl.instance; + formalParameter.type = DynamicTypeImpl.instance; } } } } var classElement = constructor.enclosingElement; - if (classElement is ClassFragmentImpl && classElement.isMixinApplication) { - _inferMixinApplicationConstructor( - classElement.element, - constructor.element, - ); + if (classElement is ClassElementImpl && classElement.isMixinApplication) { + _inferMixinApplicationConstructor(classElement, constructor); } } /// If the given [element] represents a non-synthetic instance method, /// getter or setter, infer the return type and any parameter type(s) where /// they were not provided. - void _inferExecutable(MethodFragmentImpl element) { + void _inferExecutable(MethodElementImpl element) { if (element.isSynthetic || element.isStatic) { return; } - var name = Name(element.library.source.uri, element.name ?? ''); + var name = Name.forElement(element); + if (name == null) { + return; + } + var overriddenElements = inheritance.getOverridden( - currentInterfaceElement.element, + currentInterfaceElement, name, ); if (overriddenElements == null || - !_allSameElementKind( - element, - overriddenElements.map((e) => e.declarationImpl).toList(), - )) { + !_allSameElementKind(element, overriddenElements)) { return; } FunctionTypeImpl? combinedSignatureType; var hasImplicitType = element.hasImplicitReturnType || - element.parameters.any((e) => e.hasImplicitType); + element.formalParameters.any((e) => e.hasImplicitType); if (hasImplicitType) { var conflicts = <Conflict>[]; combinedSignatureType = inheritance.combineSignatureTypes( @@ -448,7 +449,7 @@ ); if (combinedSignatureType != null) { combinedSignatureType = _toOverriddenFunctionType( - element.element, + element, combinedSignatureType, ); } else { @@ -479,35 +480,32 @@ if (element.hasImplicitReturnType && element.displayName != '[]=') { if (combinedSignatureType != null) { element.returnType = combinedSignatureType.returnType; - // TODO(scheglov): leave only element - element.element.returnType = combinedSignatureType.returnType; } else { element.returnType = DynamicTypeImpl.instance; - // TODO(scheglov): leave only element - element.element.returnType = DynamicTypeImpl.instance; } } // // Infer the parameter types. // - var parameters = element.parameters; - for (var index = 0; index < parameters.length; index++) { - var parameter = parameters[index]; - _inferParameterCovariance(parameter, index, overriddenElements); + var formalParameters = element.formalParameters; + for (var index = 0; index < formalParameters.length; index++) { + var formalParameter = formalParameters[index]; + _inferParameterCovariance( + formalParameter as FormalParameterElementImpl, + index, + overriddenElements, + ); - if (parameter.hasImplicitType) { - _inferParameterType(parameter, index, combinedSignatureType); + if (formalParameter.hasImplicitType) { + _inferParameterType(formalParameter, index, combinedSignatureType); } } - _resetOperatorEqualParameterTypeToDynamic( - element, - overriddenElements.map((e) => e.declarationImpl).toList(), - ); + _resetOperatorEqualParameterTypeToDynamic(element, overriddenElements); } - void _inferExtensionTypes(List<ExtensionTypeFragmentImpl> extensionTypes) { + void _inferExtensionTypes(List<ExtensionTypeElementImpl> extensionTypes) { for (var extensionType in extensionTypes) { for (var constructor in extensionType.constructors) { _inferConstructor(constructor); @@ -560,7 +558,7 @@ /// If a parameter is covariant, any parameters that override it are too. void _inferParameterCovariance( - FormalParameterFragmentImpl parameter, + FormalParameterElementImpl parameter, int index, Iterable<ExecutableElement2OrMember> overridden, ) { @@ -578,7 +576,7 @@ /// [combinedSignatureType], which might be `null` if there is no valid /// combined signature for signatures from direct superinterfaces. void _inferParameterType( - FormalParameterFragmentImpl parameter, + FormalParameterElementImpl parameter, int index, FunctionTypeImpl? combinedSignatureType, ) { @@ -589,12 +587,12 @@ combinedSignatureType.parameters, ); if (matchingParameter != null) { - parameter.element.type = matchingParameter.type; + parameter.type = matchingParameter.type; } else { - parameter.element.type = DynamicTypeImpl.instance; + parameter.type = DynamicTypeImpl.instance; } } else { - parameter.element.type = DynamicTypeImpl.instance; + parameter.type = DynamicTypeImpl.instance; } } @@ -602,7 +600,7 @@ /// interface [type]. void _inferType(InterfaceTypeImpl? type) { if (type != null) { - var element = type.elementImpl; + var element = type.element; _inferClass(element); } } @@ -615,36 +613,35 @@ /// /// https://github.com/dart-lang/language/issues/569 void _resetOperatorEqualParameterTypeToDynamic( - MethodFragmentImpl element, - List<ExecutableFragmentImpl> overriddenElements, + MethodElementImpl element, + List<ExecutableElement2OrMember> overriddenElements, ) { if (element.name != '==') return; - var parameters = element.parameters; - if (parameters.length != 1) { + var formalParameters = element.formalParameters; + if (formalParameters.length != 1) { element.isOperatorEqualWithParameterTypeFromObject = false; return; } - var parameter = parameters[0]; - if (!parameter.hasImplicitType) { + var formalParameter = formalParameters[0]; + if (!formalParameter.hasImplicitType) { element.isOperatorEqualWithParameterTypeFromObject = false; return; } for (var overridden in overriddenElements) { - overridden = overridden.declaration; + overridden = overridden.baseElement; // Skip Object itself. - var enclosingElement = - ElementImplExtension(overridden).enclosingElementImpl; - if (enclosingElement is ClassFragmentImpl && + var enclosingElement = overridden.enclosingElement; + if (enclosingElement is ClassElementImpl && enclosingElement.isDartCoreObject) { continue; } // Keep the type if it is not directly from Object. - if (overridden is MethodFragmentImpl && + if (overridden is MethodElementImpl && !overridden.isOperatorEqualWithParameterTypeFromObject) { element.isOperatorEqualWithParameterTypeFromObject = false; return; @@ -656,9 +653,9 @@ /// Find and mark the induced modifier of an element, if the [classElement] is /// 'sealed'. - void _setInducedModifier(InterfaceFragmentImpl classElement) { + void _setInducedModifier(InterfaceElementImpl classElement) { // Only sealed elements propagate induced modifiers. - if (classElement is! ClassFragmentImpl || !classElement.isSealed) { + if (classElement is! ClassElementImpl || !classElement.isSealed) { return; } @@ -666,7 +663,7 @@ var interfaces = classElement.interfaces; var mixins = classElement.mixins; - if (mixins.any((type) => type.elementImpl.isFinal)) { + if (mixins.any((type) => type.element.isFinal)) { // A sealed declaration is considered 'final' if it has a direct // superclass which is 'final'. classElement.isFinal = true; @@ -674,17 +671,17 @@ } if (supertype != null) { - if (supertype.elementImpl.isFinal) { + if (supertype.element.isFinal) { // A sealed declaration is considered 'final' if it has a direct // superclass which is 'final'. classElement.isFinal = true; return; } - if (supertype.elementImpl.isBase) { + if (supertype.element.isBase) { // A sealed declaration is considered 'final' if it has a // direct superclass which is 'interface' and it has a direct // superinterface which is 'base'. - if (mixins.any((type) => type.elementImpl.isInterface)) { + if (mixins.any((type) => type.element.isInterface)) { classElement.isFinal = true; return; } @@ -694,12 +691,12 @@ classElement.isBase = true; return; } - if (supertype.elementImpl.isInterface) { + if (supertype.element.isInterface) { // A sealed declaration is considered 'final' if it has a // direct superclass which is 'interface' and it has a direct // superinterface which is 'base'. - if (interfaces.any((type) => type.elementImpl.isBase) || - mixins.any((type) => type.elementImpl.isBase)) { + if (interfaces.any((type) => type.element.isBase) || + mixins.any((type) => type.element.isBase)) { classElement.isFinal = true; return; } @@ -711,23 +708,19 @@ } } - if (interfaces.any( - (type) => type.elementImpl.isBase || type.elementImpl.isFinal, - ) || - mixins.any( - (type) => type.elementImpl.isBase || type.elementImpl.isFinal, - )) { + if (interfaces.any((type) => type.element.isBase || type.element.isFinal) || + mixins.any((type) => type.element.isBase || type.element.isFinal)) { // A sealed declaration is considered 'base' if it has a direct // superinterface which is 'base' or 'final'. classElement.isBase = true; return; } - if (mixins.any((type) => type.elementImpl.isInterface)) { + if (mixins.any((type) => type.element.isInterface)) { // A sealed declaration is considered 'final' if it has a // direct superclass which is 'interface' and it has a direct // superinterface which is 'base'. - if (interfaces.any((type) => type.elementImpl.isBase)) { + if (interfaces.any((type) => type.element.isBase)) { classElement.isFinal = true; return; } @@ -750,7 +743,7 @@ /// parameters. For example, given `m<T>(t)` overriding `m<S>(S s)` we /// should infer this as `m<T>(T t)`. FunctionTypeImpl? _toOverriddenFunctionType( - ExecutableElement2OrMember element, + MethodElementImpl element, FunctionTypeImpl overriddenType, ) { var elementTypeParameters = element.typeParameters; @@ -771,25 +764,20 @@ ); } - static bool _isCovariantSetter(ExecutableFragmentImpl element) { - if (element is PropertyAccessorFragmentImpl) { - var parameters = element.parameters; + static bool _isCovariantSetter(ExecutableElementImpl element) { + if (element is PropertyAccessorElementImpl) { + var parameters = element.formalParameters; return parameters.isNotEmpty && parameters[0].isCovariant; } return false; } - static void _setFieldType(FieldFragmentImpl field, TypeImpl type) { - field.element.type = type; - // TODO(scheglov): We repeat this code. - field.element.getter?.returnType = type; - field.element.getter?.firstFragment.returnType = type; - - var setterElement = field.element.setter; - if (setterElement != null) { - setterElement.returnType = VoidTypeImpl.instance; - setterElement.firstFragment.returnType = VoidTypeImpl.instance; - setterElement.valueFormalParameter.type = type; + static void _setFieldType(FieldElementImpl field, TypeImpl type) { + field.type = type; + field.getter?.returnType = type; + if (field.setter case var setter?) { + setter.returnType = VoidTypeImpl.instance; + setter.valueFormalParameter.type = type; } } } @@ -797,22 +785,33 @@ /// A class of exception that is not used anywhere else. class _CycleException implements Exception {} -extension on InterfaceFragmentImpl { +extension on InterfaceElementImpl { bool get isBase { - var self = this; - if (self is ClassOrMixinFragmentImpl) return self.isBase; - return false; + switch (this) { + case ClassElementImpl self: + return self.isBase; + case MixinElementImpl self: + return self.isBase; + default: + return false; + } } bool get isFinal { - var self = this; - if (self is ClassFragmentImpl) return self.isFinal; - return false; + switch (this) { + case ClassElementImpl self: + return self.isFinal; + default: + return false; + } } bool get isInterface { - var self = this; - if (self is ClassFragmentImpl) return self.isInterface; - return false; + switch (this) { + case ClassElementImpl self: + return self.isInterface; + default: + return false; + } } }
diff --git a/pkg/analyzer/lib/src/summary2/library_builder.dart b/pkg/analyzer/lib/src/summary2/library_builder.dart index 7a0361e..6451d2e 100644 --- a/pkg/analyzer/lib/src/summary2/library_builder.dart +++ b/pkg/analyzer/lib/src/summary2/library_builder.dart
@@ -228,7 +228,6 @@ enum_.valuesElement.element.type = valuesType; // TODO(scheglov): We repeat this code. enum_.valuesElement.element.getter!.returnType = valuesType; - enum_.valuesElement.element.getter!.firstFragment.returnType = valuesType; } }
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart index 3c9337b..88be2de 100644 --- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart +++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -100,9 +100,7 @@ void _performOverrideInference() { var inferrer = InstanceMemberInferrer(linker.inheritance); for (var builder in linker.builders.values) { - for (var unit in builder.element.units) { - inferrer.inferCompilationUnit(unit); - } + inferrer.inferLibrary(builder.element); } } }
diff --git a/pkg/analyzer/lib/src/summary2/types_builder.dart b/pkg/analyzer/lib/src/summary2/types_builder.dart index 4c6720a..84ffa28 100644 --- a/pkg/analyzer/lib/src/summary2/types_builder.dart +++ b/pkg/analyzer/lib/src/summary2/types_builder.dart
@@ -178,7 +178,7 @@ } var fragment = node.declaredFragment!; var element = fragment.element; - fragment.returnType = returnType; + element.returnType = returnType; switch (element) { case GetterElementImpl(): @@ -224,7 +224,6 @@ } var fragment = node.declaredFragment!; var element = fragment.element; - fragment.returnType = returnType; switch (element) { case GetterElementImpl(): element.returnType = returnType; @@ -266,11 +265,9 @@ if (variableElement is PropertyInducingElementImpl) { if (variableElement.getter case var getterElement?) { getterElement.returnType = type; - getterElement.firstFragment.returnType = type; } if (variableElement.setter case var setterElement?) { setterElement.returnType = VoidTypeImpl.instance; - setterElement.firstFragment.returnType = VoidTypeImpl.instance; (setterElement.formalParameters.single as FormalParameterElementImpl) .type = type; @@ -346,7 +343,7 @@ var fragment = node.declaredFragment!; var function = fragment.aliasedElement as GenericFunctionTypeFragmentImpl; function.returnType = node.returnType?.type ?? _dynamicType; - fragment.aliasedType = function.type; + fragment.element.aliasedType = function.type; } void _functionTypedFormalParameter(FunctionTypedFormalParameterImpl node) { @@ -367,15 +364,16 @@ void _genericTypeAlias(GenericTypeAliasImpl node) { var fragment = node.declaredFragment!; - var featureSet = fragment.library.featureSet; + var element = fragment.element; + var featureSet = element.library.featureSet; var typeNode = node.type; if (featureSet.isEnabled(Feature.nonfunction_type_aliases)) { - fragment.aliasedType = typeNode.typeOrThrow; + element.aliasedType = typeNode.typeOrThrow; } else if (typeNode is GenericFunctionType) { - fragment.aliasedType = typeNode.typeOrThrow; + element.aliasedType = typeNode.typeOrThrow; } else { - fragment.aliasedType = _errorFunctionType(); + element.aliasedType = _errorFunctionType(); } }
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart index d4f7a00..382ccce 100644 --- a/pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart +++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart
@@ -1055,7 +1055,7 @@ TopLevelFunctionFragmentImpl _function( String name, - DartType returnType, { + TypeImpl returnType, { List<TypeParameterFragmentImpl> typeFormals = const [], List<FormalParameterElement> parameters = const [], }) { @@ -1065,9 +1065,11 @@ parameters .map((p) => p.firstFragment as FormalParameterFragmentImpl) .toList() - ..returnType = returnType ..typeParameters = typeFormals; - TopLevelFunctionElementImpl(Reference.root(), fragment); + + var element = TopLevelFunctionElementImpl(Reference.root(), fragment); + element.returnType = returnType; + return fragment; } @@ -1099,12 +1101,13 @@ fieldElement.type = type; var getterFragment = GetterFragmentImpl(name: name, firstTokenOffset: null); + getterFragment.isStatic = isStatic; + getterFragment.isSynthetic = false; + var getterElement = GetterElementImpl(Reference.root(), getterFragment); fieldElement.getter = getterElement; getterElement.variable = fieldElement; - getterFragment.isStatic = isStatic; - getterFragment.isSynthetic = false; - getterFragment.returnType = type; + getterElement.returnType = type; return getterFragment; } @@ -1122,7 +1125,7 @@ MethodFragmentImpl _method( String name, - DartType returnType, { + TypeImpl returnType, { List<TypeParameterFragmentImpl> typeFormals = const [], List<FormalParameterElement> parameters = const [], }) { @@ -1132,13 +1135,15 @@ parameters .map((p) => p.firstFragment as FormalParameterFragmentImpl) .toList() - ..returnType = returnType ..typeParameters = typeFormals; - MethodElementImpl( + + var element = MethodElementImpl( name: name, reference: Reference.root(), firstFragment: fragment, ); + element.returnType = returnType; + return fragment; }
diff --git a/pkg/analyzer/lib/src/utilities/extensions/element.dart b/pkg/analyzer/lib/src/utilities/extensions/element.dart index bbb7561..8ef366e 100644 --- a/pkg/analyzer/lib/src/utilities/extensions/element.dart +++ b/pkg/analyzer/lib/src/utilities/extensions/element.dart
@@ -7,7 +7,6 @@ import 'package:analyzer/dart/element/type.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'; import 'package:meta/meta.dart'; class MockLibraryImportElement implements Element { @@ -151,10 +150,6 @@ } } -extension ElementImplExtension on FragmentImpl { - FragmentImpl? get enclosingElementImpl => enclosingElement; -} - extension ElementOrNullExtension on FragmentImpl? { Element? get asElement2 { var self = this; @@ -200,8 +195,7 @@ } extension ExecutableElement2OrMemberExtension on ExecutableElement2OrMember { - ExecutableFragmentImpl get declarationImpl => - baseElement.firstFragment as ExecutableFragmentImpl; + ExecutableFragmentImpl get declarationImpl => baseElement.firstFragment; } extension ExecutableElementImpl2Extension on ExecutableElementImpl { @@ -303,10 +297,6 @@ } } -extension InterfaceTypeImplExtension on InterfaceTypeImpl { - InterfaceFragmentImpl get elementImpl => element.firstFragment; -} - extension JoinPatternVariableElementImplExtension on JoinPatternVariableFragmentImpl { JoinPatternVariableElementImpl get asElement2 {
diff --git a/pkg/analyzer/test/generated/elements_types_mixin.dart b/pkg/analyzer/test/generated/elements_types_mixin.dart index b112d2d..b113db5 100644 --- a/pkg/analyzer/test/generated/elements_types_mixin.dart +++ b/pkg/analyzer/test/generated/elements_types_mixin.dart
@@ -469,13 +469,13 @@ MethodFragmentImpl(name: name, firstTokenOffset: null) ..isStatic = isStatic ..parameters = formalParameters.map((e) => e.asElement).toList() - ..returnType = returnType ..typeParameters = typeParameters.map((e) => e.asElement).toList(); - MethodElementImpl( + var element = MethodElementImpl( name: name, reference: Reference.root(), firstFragment: fragment, ); + element.returnType = returnType; return fragment; } @@ -659,9 +659,10 @@ var fragment = TypeAliasFragmentImpl(name: name, firstTokenOffset: null); fragment.enclosingElement = testLibrary.definingCompilationUnit; fragment.typeParameters = typeParameters.map((e) => e.asElement).toList(); - fragment.aliasedType = aliasedType; - return TypeAliasElementImpl(Reference.root(), fragment); + var element = TypeAliasElementImpl(Reference.root(), fragment); + element.aliasedType = aliasedType; + return element; } TypeImpl typeAliasTypeNone(
diff --git a/pkg/analyzer/test/src/dart/element/display_string_test.dart b/pkg/analyzer/test/src/dart/element/display_string_test.dart index 8d6f45b..9ca721e 100644 --- a/pkg/analyzer/test/src/dart/element/display_string_test.dart +++ b/pkg/analyzer/test/src/dart/element/display_string_test.dart
@@ -2,7 +2,6 @@ // 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/src/dart/element/element.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart'; @@ -22,8 +21,8 @@ abstract class B<T> extends A {} '''); - var B = findElement2.class_('B').firstFragment as ClassFragmentImpl; - var displayString = B.getDisplayString(); + var B = findElement2.class_('B'); + var displayString = B.displayString(); expect(displayString, 'abstract class B<T> extends A'); } @@ -33,9 +32,7 @@ '''); var element = findElement2.extension_('StringExtension'); - var fragment = element.firstFragment as ExtensionFragmentImpl; - - var displayString = fragment.getDisplayString(); + var displayString = element.displayString(); expect(displayString, 'extension StringExtension on String'); } @@ -45,9 +42,7 @@ '''); var element = result.libraryElement2.extensions.single; - var fragment = element.firstFragment; - - var displayString = fragment.getDisplayString(); + var displayString = element.displayString(); expect(displayString, 'extension on String'); } @@ -57,9 +52,7 @@ '''); var element = findElement2.extensionType('MyString'); - var fragment = element.firstFragment as ExtensionTypeFragmentImpl; - - var displayString = fragment.getDisplayString(); + var displayString = element.displayString(); expect( displayString, 'extension type MyString<T>(String it) implements String', @@ -74,13 +67,11 @@ '''); var methodElement = findElement2.method('longMethodName'); - var methodFragment = methodElement.firstFragment as MethodFragmentImpl; - - var singleLine = methodFragment.getDisplayString(); + var singleLine = methodElement.displayString(); expect(singleLine, ''' String? longMethodName(String? aaa, [String? bbb = 'a', String? ccc])'''); - var multiLine = methodFragment.getDisplayString(multiline: true); + var multiLine = methodElement.displayString(multiline: true); expect(multiLine, ''' String? longMethodName( String? aaa, [ @@ -101,16 +92,14 @@ '''); var methodElement = findElement2.method('longMethodName'); - var methodFragment = methodElement.firstFragment as MethodFragmentImpl; - - var singleLine = methodFragment.getDisplayString(); + var singleLine = methodElement.displayString(); expect( singleLine, ''' String? longMethodName(String? aaa, [String? Function(String?, String?, String?) bbb, String? ccc])''', ); - var multiLine = methodFragment.getDisplayString(multiline: true); + var multiLine = methodElement.displayString(multiline: true); expect(multiLine, ''' String? longMethodName( String? aaa, [ @@ -125,9 +114,7 @@ '''); var element = findElement2.topGet('a'); - var fragment = element.firstFragment as GetterFragmentImpl; - - expect(fragment.getDisplayString(), 'String get a'); + expect(element.displayString(), 'String get a'); } test_property_setter() async { @@ -136,9 +123,7 @@ '''); var element = findElement2.topSet('a'); - var fragment = element.firstFragment as SetterFragmentImpl; - - expect(fragment.getDisplayString(), 'set a(String value)'); + expect(element.displayString(), 'set a(String value)'); } test_shortMethod() async { @@ -149,12 +134,10 @@ '''); var element = findElement2.method('m'); - var fragment = element.firstFragment as MethodFragmentImpl; - - var singleLine = fragment.getDisplayString(); + var singleLine = element.displayString(); expect(singleLine, 'String? m(String? a, [String? b])'); - var multiLine = fragment.getDisplayString(multiline: true); + var multiLine = element.displayString(multiline: true); // The signature is short enough that it remains on one line even for // multiline: true. expect(multiLine, 'String? m(String? a, [String? b])');
diff --git a/pkg/dds/CHANGELOG.md b/pkg/dds/CHANGELOG.md index 02accf2..413ca5f 100644 --- a/pkg/dds/CHANGELOG.md +++ b/pkg/dds/CHANGELOG.md
@@ -1,3 +1,6 @@ +# 5.0.5 +- [DAP] The change in DDS 5.0.4 to individually add/remove breakpoints has been reverted and may be restored in a future version. + # 5.0.4 - [DAP] Breakpoints are now added/removed individually instead of all being cleared and re-added during a `setBreakpoints` request. This improves performance and can avoid breakpoints flickering between unresolved/resolved when adding new breakpoints in the same file.
diff --git a/pkg/dds/lib/src/dap/adapters/dart.dart b/pkg/dds/lib/src/dap/adapters/dart.dart index a27d865..5909aa1 100644 --- a/pkg/dds/lib/src/dap/adapters/dart.dart +++ b/pkg/dds/lib/src/dap/adapters/dart.dart
@@ -1577,70 +1577,26 @@ : name!; // Use a completer to track when the response is sent, so any events related - // to new breakpoints will not be sent to the client before the response - // here which provides the IDs to the client. + // to these breakpoints are not sent before the client has the IDs. final completer = Completer<void>(); - // Map the provided breakpoints onto either new or existing instances of - // [ClientBreakpoint] that we use to track the clients breakpoints - // internally. - final clientBreakpoints = breakpoints.map((bp) { - return - // First try to match an existing breakpoint so we can avoid deleting - // and re-creating all breakpoints if a new one is added to a file. - isolateManager.findExistingClientBreakpoint(uri, bp) ?? - ClientBreakpoint(bp, completer.future); - }).toList(); + final clientBreakpoints = breakpoints + .map((bp) => ClientBreakpoint(bp, completer.future)) + .toList(); + await isolateManager.setBreakpoints(uri, clientBreakpoints); - // Any breakpoints that are not in our new set will need to be removed from - // the VM. - // - // Because multiple client breakpoints may resolve to the same VM breakpoint - // we must exclude any that still remain in one of the kept breakpoints. - final referencedVmBreakpoints = - clientBreakpoints.map((bp) => bp.forThread.values).toSet(); - final breakpointsToRemove = isolateManager.clientBreakpointsByUri[uri] - ?.toSet() - // Remove any we're reusing. - .difference(clientBreakpoints.toSet()) - // Remove any that map to VM breakpoints that are still referenced - // because we'll want to keep them. - .where((clientBreakpoint) => clientBreakpoint.forThread.values - .none(referencedVmBreakpoints.contains)); - - // Store this new set of breakpoints as the current set for this URI. - isolateManager.recordLatestClientBreakpoints(uri, clientBreakpoints); - - // Prepare the response with the existing values before we start updating. - final breakpointResponse = SetBreakpointsResponseBody( + sendResponse(SetBreakpointsResponseBody( breakpoints: clientBreakpoints + // Send breakpoints back as unverified and with our generated IDs so we + // can update them with a 'breakpoint' event when we get the + // 'BreakpointAdded'/'BreakpointResolved' events from the VM. .map((bp) => Breakpoint( id: bp.id, - verified: bp.verified, - line: bp.verified ? bp.resolvedLine : null, - column: bp.verified ? bp.resolvedColumn : null, - message: bp.verified ? null : bp.verifiedMessage, - reason: bp.verified ? null : bp.verifiedReason)) + verified: false, + message: 'Breakpoint has not yet been resolved', + reason: 'pending')) .toList(), - ); - - // Update the breakpoints for all existing threads. - await Future.wait(isolateManager.threads.map((thread) async { - // Remove the deleted breakpoints. - if (breakpointsToRemove != null) { - await Future.wait(breakpointsToRemove.map((clientBreakpoint) => - isolateManager.removeBreakpoint(clientBreakpoint, thread))); - } - - // Add the new breakpoints. - await Future.wait(clientBreakpoints.map((clientBreakpoint) async { - if (!clientBreakpoint.isKnownToVm) { - await isolateManager.addBreakpoint(clientBreakpoint, thread, uri); - } - })); - })); - - sendResponse(breakpointResponse); + )); completer.complete(); }
diff --git a/pkg/dds/lib/src/dap/isolate_manager.dart b/pkg/dds/lib/src/dap/isolate_manager.dart index d135634..bfc2f49 100644 --- a/pkg/dds/lib/src/dap/isolate_manager.dart +++ b/pkg/dds/lib/src/dap/isolate_manager.dart
@@ -63,9 +63,9 @@ /// [debugExternalPackageLibraries] in one step. bool debugExternalPackageLibraries = true; - /// Tracks breakpoints last provided by the client (by the client URI) so they - /// can be sent to new isolates that appear after initial breakpoints were sent. - final Map<String, List<ClientBreakpoint>> clientBreakpointsByUri = {}; + /// Tracks breakpoints last provided by the client so they can be sent to new + /// isolates that appear after initial breakpoints were sent. + final Map<String, List<ClientBreakpoint>> _clientBreakpointsByUri = {}; /// Tracks client breakpoints by the ID assigned by the VM so we can look up /// conditions/logpoints when hitting breakpoints. @@ -89,11 +89,22 @@ /// breakpoint). /// /// When new breakpoints are added by the client, we must check this map to - /// see it's an already-resolved breakpoint so that we can send resolution + /// see it's al already-resolved breakpoint so that we can send resolution /// info to the client. final Map<_UniqueVmBreakpointId, vm.Event> _breakpointResolvedEventsByVmId = {}; + /// Tracks breakpoints created in the VM so they can be removed when the + /// editor sends new breakpoints (currently the editor just sends a new list + /// and not requests to add/remove). + /// + /// Breakpoints are indexed by their ID so that duplicates are not stored even + /// if multiple client breakpoints resolve to a single VM breakpoint. + /// + /// IsolateId -> Uri -> breakpointId -> VM Breakpoint. + final Map<String, Map<String, Map<String, vm.Breakpoint>>> + _vmBreakpointsByIsolateIdAndUri = {}; + /// The exception pause mode last provided by the client. /// /// This will be sent to isolates as they are created, and to all existing @@ -496,27 +507,32 @@ )); } - // Tracks the latest set of breakpoints sent by the client that should - // be sent to any new isolates that start. - void recordLatestClientBreakpoints( + /// Records breakpoints for [uri]. + /// + /// [breakpoints] represents the new set and entirely replaces anything given + /// before. + Future<void> setBreakpoints( String uri, List<ClientBreakpoint> breakpoints, - ) { - clientBreakpointsByUri[uri] = breakpoints; + ) async { + // Track the breakpoints to get sent to any new isolates that start. + _clientBreakpointsByUri[uri] = breakpoints; + + // Send the breakpoints to all existing threads. + await Future.wait(_threadsByThreadId.values + .map((thread) => _sendBreakpoints(thread, uri: uri))); } /// Clears all breakpoints. Future<void> clearAllBreakpoints() async { - // Group all breakpoints for all URIs before clearing the list. - final clientBreakpointsToDelete = - clientBreakpointsByUri.values.expand((bps) => bps).toList(); - clientBreakpointsByUri.clear(); + // Clear all breakpoints for each URI. Do not remove the items from the map + // as that will stop them being tracked/sent by the call below. + _clientBreakpointsByUri.updateAll((key, value) => []); - // Remove all breakpoints for all threads. - await Future.wait(clientBreakpointsToDelete.map((clientBreakpoint) { - return Future.wait(_threadsByThreadId.values - .map((thread) => removeBreakpoint(clientBreakpoint, thread))); - })); + // Send the breakpoints to all existing threads. + await Future.wait( + _threadsByThreadId.values.map((thread) => _sendBreakpoints(thread)), + ); } /// Records exception pause mode as one of 'None', 'Unhandled' or 'All'. All @@ -576,12 +592,7 @@ _sendExceptionPauseMode(thread), ], eagerError: true); - await Future.wait(clientBreakpointsByUri.entries.map((mapEntry) async { - var clientUri = mapEntry.key; - var clientBreakpoints = mapEntry.value; - await Future.wait(clientBreakpoints.map((clientBreakpoint) => - addBreakpoint(clientBreakpoint, thread, clientUri))); - })); + await _sendBreakpoints(thread); } on vm.SentinelException { // It's possible during these async requests that the isolate went away // (for example a shutdown/restart) and we no longer care about @@ -879,19 +890,12 @@ // This is always resolved because of the check above. final location = breakpoint.location; final resolvedLocation = location as vm.SourceLocation; - - // Track that this breakpoint has been resolved, so that if we are asked to - // set the same breakpoint in future, we can immediately return - // resolved=true in the response. - clientBreakpoint.resolved(resolvedLocation.line, resolvedLocation.column); - final updatedBreakpoint = Breakpoint( id: clientBreakpoint.id, - line: clientBreakpoint.resolvedLine, - column: clientBreakpoint.resolvedColumn, - verified: clientBreakpoint.verified, + line: resolvedLocation.line, + column: resolvedLocation.column, + verified: true, ); - // Ensure we don't send the breakpoint event until the client has been // given the breakpoint ID by queueing it. clientBreakpoint.queueAction( @@ -928,18 +932,11 @@ userMessage = terseMessageMatch.group(1) ?? userMessage; } - // Record the failure state only if we don't already have a success state - // because if we set a breakpoint in some isolates but not others, we do not - // want to show that as unresolved. - if (!clientBreakpoint.verified) { - clientBreakpoint.unresolved(reason: 'failed', message: userMessage); - } - final updatedBreakpoint = Breakpoint( id: clientBreakpoint.id, - verified: clientBreakpoint.verified, - message: clientBreakpoint.verifiedMessage, - reason: clientBreakpoint.verifiedReason, + verified: false, + message: userMessage, + reason: 'failed', ); // Ensure we don't send the breakpoint event until the client has been // given the breakpoint ID by queueing it. @@ -1042,58 +1039,13 @@ await service.reloadSources(isolateId); } - /// Tries to find an existing [ClientBreakpoint] matching the location of the - /// provided [breakpoint] so that it can be reused/kept when updating - /// breakpoints. - ClientBreakpoint? findExistingClientBreakpoint( - String clientUri, SourceBreakpoint breakpoint) { - var clientBreakpoints = clientBreakpointsByUri[clientUri]; - if (clientBreakpoints == null) { - return null; - } - - return clientBreakpoints.firstWhereOrNull((clientBreakpoint) => - // These conditions must cover all fields that would be sent to the VM. - // They do not need to include things like `condition` which we check - // DAP-side. - - // We always compare breakpoints based on the original location and not - // the resolved location, because clients will not update the underlying - // breakpoints with resolution, they will only assign a temporary - // overriden location. - // - // See https://github.com/microsoft/vscode/issues/250453. - clientBreakpoint.breakpoint.line == breakpoint.line && - clientBreakpoint.breakpoint.column == breakpoint.column); - } - - /// Converts local Google3 or SDK file paths to URIs VM can recognize. + /// Sets breakpoints for an individual isolate. /// - /// ``` - /// sdk-path/lib/core/print.dart -> org-dartlang-sdk://sdk/lib/core/print.dart - /// google/*/google3/<path> -> google3://<path> - /// ``` - /// - /// VM is capable of setting breakpoints using both original (`package` - /// scheme) URIs or their resolved variants - which means no convertion - /// is necessary if local path is the same as the resolved path known to the - /// VM. - /// - /// Google3 paths and Dart SDK paths however require special handling: - /// because in both cases resolved paths we given using *multi-root - /// filesystem* accessed via a special scheme (`google3` and - /// `org-dartlang-sdk` respectively) to hide local file layout from the - /// front-end. - Uri _fixSDKOrGoogle3Paths(Uri sourcePathUri) { - return _adapter.convertUriToOrgDartlangSdk(sourcePathUri) ?? - _convertPathToGoogle3Uri(sourcePathUri) ?? - sourcePathUri; - } - - /// Creates a breakpoint in [clientUri] for [thread] in the VM that - /// corresponds to [clientBreakpoint] received from the client. - Future<void> addBreakpoint(ClientBreakpoint clientBreakpoint, - ThreadInfo thread, String clientUri) async { + /// If [uri] is provided, only breakpoints for that URI will be sent (used + /// when breakpoints are modified for a single file in the editor). Otherwise + /// breakpoints for all previously set URIs will be sent (used for + /// newly-created isolates). + Future<void> _sendBreakpoints(ThreadInfo thread, {String? uri}) async { final service = _adapter.vmService; if (!debug || service == null) { return; @@ -1101,63 +1053,78 @@ final isolateId = thread.isolate.id!; - try { - // Some file URIs (like SDK sources) need to be converted to - // appropriate internal URIs to be able to set breakpoints. - final vmUri = _fixSDKOrGoogle3Paths(Uri.parse(clientUri)); - final vmBp = await service.addBreakpointWithScriptUri( - isolateId, vmUri.toString(), clientBreakpoint.breakpoint.line, - column: clientBreakpoint.breakpoint.column); - clientBreakpoint.forThread[thread] = vmBp; - final uniqueBreakpointId = (isolateId: isolateId, breakpointId: vmBp.id!); + // If we were passed a single URI, we should send breakpoints only for that + // (this means the request came from the client), otherwise we should send + // all of them (because this is a new/restarting isolate). + final uris = uri != null ? [uri] : _clientBreakpointsByUri.keys.toList(); - // Store this client breakpoint by the VM ID, so when we get events - // from the VM we can map them back to client breakpoints (for example - // to send resolved events). - _clientBreakpointsByVmId - .putIfAbsent(uniqueBreakpointId, () => []) - .add(clientBreakpoint); + for (final uri in uris) { + // Clear existing breakpoints. + final existingBreakpointsForIsolate = + _vmBreakpointsByIsolateIdAndUri.putIfAbsent(isolateId, () => {}); + final existingBreakpointsForIsolateAndUri = + existingBreakpointsForIsolate.putIfAbsent(uri, () => {}); + // Before doing async work, take a copy of the breakpoints to remove + // and remove them from the list, so any subsequent calls here don't + // try to remove the same ones multiple times. + final breakpointsToRemove = + existingBreakpointsForIsolateAndUri.values.toList(); + existingBreakpointsForIsolateAndUri.clear(); + await Future.forEach<vm.Breakpoint>(breakpointsToRemove, (bp) async { + try { + await service.removeBreakpoint(isolateId, bp.id!); + } catch (e) { + // Swallow errors removing breakpoints rather than failing the whole + // request as it's very possible that an isolate exited while we were + // sending this and the request will fail. + _adapter.logger?.call('Failed to remove old breakpoint $e'); + } + }); - // Queue any resolved events that may have already arrived - // (either because the VM sent them before responding to us, or - // because it gave us an existing VM breakpoint because it resolved to - // the same location as another). - final resolvedEvent = _breakpointResolvedEventsByVmId[uniqueBreakpointId]; - if (resolvedEvent != null) { - queueBreakpointResolutionEvent(resolvedEvent, clientBreakpoint); - } - } catch (e) { - // Swallow errors setting breakpoints rather than failing the whole - // request as it's very easy for editors to send us breakpoints that - // aren't valid any more. - _adapter.logger?.call('Failed to add breakpoint $e'); - queueFailedBreakpointEvent(e, clientBreakpoint); - } - } + // Set new breakpoints. + final newBreakpoints = _clientBreakpointsByUri[uri] ?? const []; + await Future.forEach<ClientBreakpoint>(newBreakpoints, (bp) async { + try { + // Some file URIs (like SDK sources) need to be converted to + // appropriate internal URIs to be able to set breakpoints. + final vmUri = await thread.resolvePathToUri(Uri.parse(uri)); - /// Removes [clientBreakpoint] from [thread] in the VM. - Future<void> removeBreakpoint( - ClientBreakpoint clientBreakpoint, ThreadInfo thread) async { - final service = _adapter.vmService; - if (!debug || service == null) { - return; - } + if (vmUri == null) { + return; + } - final isolateId = thread.isolate.id!; - final vmBreakpoint = clientBreakpoint.forThread[thread]; - if (vmBreakpoint == null) { - // This isolate didn't have this breakpoint. - return; - } + final vmBp = await service.addBreakpointWithScriptUri( + isolateId, vmUri.toString(), bp.breakpoint.line, + column: bp.breakpoint.column); + final vmBpId = vmBp.id!; + final uniqueBreakpointId = + (isolateId: isolateId, breakpointId: vmBp.id!); + existingBreakpointsForIsolateAndUri[vmBpId] = vmBp; - try { - await service.removeBreakpoint(isolateId, vmBreakpoint.id!); - clientBreakpoint.forThread.remove(thread); - } catch (e) { - // Swallow errors removing breakpoints rather than failing the whole - // request as it's very possible that an isolate exited while we were - // sending this and the request will fail. - _adapter.logger?.call('Failed to remove old breakpoint $e'); + // Store this client breakpoint by the VM ID, so when we get events + // from the VM we can map them back to client breakpoints (for example + // to send resolved events). + _clientBreakpointsByVmId + .putIfAbsent(uniqueBreakpointId, () => []) + .add(bp); + + // Queue any resolved events that may have already arrived + // (either because the VM sent them before responding to us, or + // because it gave us an existing VM breakpoint because it resolved to + // the same location as another). + final resolvedEvent = + _breakpointResolvedEventsByVmId[uniqueBreakpointId]; + if (resolvedEvent != null) { + queueBreakpointResolutionEvent(resolvedEvent, bp); + } + } catch (e) { + // Swallow errors setting breakpoints rather than failing the whole + // request as it's very easy for editors to send us breakpoints that + // aren't valid any more. + _adapter.logger?.call('Failed to add breakpoint $e'); + queueFailedBreakpointEvent(e, bp); + } + }); } } @@ -1403,32 +1370,49 @@ return _currentEvaluationZoneId; } - /// Resolves a source file URI into a original `package://` or SDK URI. + /// Resolves a source file path (or URI) into a URI for the VM. /// - /// ``` - /// sdk-path/lib/core/print.dart -> org-dartlang-sdk://sdk/lib/core/print.dart + /// sdk-path/lib/core/print.dart -> dart:core/print.dart /// c:\foo\bar -> package:foo/bar - /// ``` + /// dart-macro+file:///c:/foo/bar -> dart-macro+package:foo/bar /// - /// This helper is used when trying to find [vm.Script] by matching its - /// `uri`. - Future<Uri?> _convertToPackageOrSdkPath(Uri sourcePathUri) async { - final uri = _manager._fixSDKOrGoogle3Paths(sourcePathUri); - if (uri.isScheme('org-dartlang-sdk')) { - return uri; // No package path exists for SDK sources. + /// This is required so that when the user sets a breakpoint in an SDK source + /// (which they may have navigated to via the Analysis Server) we generate a + /// valid URI that the VM would create a breakpoint for. + /// + /// Because the VM supports using `file:` URIs in many places, we usually do + /// not need to convert file paths into `package:` URIs, however this will + /// be done if [forceResolveFileUris] is `true`. + Future<Uri?> resolvePathToUri( + Uri sourcePathUri, { + bool forceResolveFileUris = false, + }) async { + final sdkUri = _manager._adapter.convertUriToOrgDartlangSdk(sourcePathUri); + if (sdkUri != null) { + return sdkUri; } + final google3Uri = _convertPathToGoogle3Uri(sourcePathUri); + final uri = google3Uri ?? sourcePathUri; + + // As an optimisation, we don't resolve file -> package URIs in many cases + // because the VM can set breakpoints for file: URIs anyway. However for + // G3 or if [forceResolveFileUris] is set, we will. + final performResolve = google3Uri != null || forceResolveFileUris; + // TODO(dantup): Consider caching results for this like we do for // resolveUriToPath (and then forceResolveFileUris can be removed and just // always used). - final packageUriList = await _manager._adapter.vmService - ?.lookupPackageUris(isolate.id!, [uri.toString()]); + final packageUriList = performResolve + ? await _manager._adapter.vmService + ?.lookupPackageUris(isolate.id!, [uri.toString()]) + : null; final packageUriString = packageUriList?.uris?.firstOrNull; if (packageUriString != null) { // Use package URI if we resolved something return Uri.parse(packageUriString); - } else if (uri.isScheme('google3')) { + } else if (google3Uri != null) { // If we failed to resolve and was a Google3 URI, return null return null; } else { @@ -1615,6 +1599,28 @@ /// that are round-tripped to the client. int storeData(Object data) => _manager.storeData(this, data); + Uri? _convertPathToGoogle3Uri(Uri input) { + // TODO(dantup): Do we need to handle non-file here? Eg. can we have + // dart-macro+file:/// for a google3 path? + if (!input.isScheme('file')) { + return null; + } + final inputPath = input.toFilePath(); + + const search = '/google3/'; + if (inputPath.startsWith('/google') && inputPath.contains(search)) { + var idx = inputPath.indexOf(search); + var remainingPath = inputPath.substring(idx + search.length); + return Uri( + scheme: 'google3', + host: '', + path: remainingPath, + ); + } + + return null; + } + /// Converts a VM-returned URI to a file-like URI, taking org-dartlang-sdk /// schemes into account. /// @@ -1700,9 +1706,12 @@ Future<vm.LibraryRef?> getLibraryForFileUri(Uri scriptFileUri) async { // We start with a file URI and need to find the Library (via the script). // - // We need to handle mismatched drive letters, and also file vs package + // We need to handle msimatched drive letters, and also file vs package // URIs. - final scriptResolvedUri = await _convertToPackageOrSdkPath(scriptFileUri); + final scriptResolvedUri = await resolvePathToUri( + scriptFileUri, + forceResolveFileUris: true, + ); final candidateUris = { scriptFileUri.toString(), normalizeUri(scriptFileUri).toString(), @@ -1740,45 +1749,6 @@ final SourceBreakpoint breakpoint; final int id; - /// Whether this breakpoint has been sent to the VM (and not removed). - bool get isKnownToVm => forThread.isNotEmpty; - - /// A map of [ThreadInfo] -> [vm.Breakpoint] recording the VM breakpoint for - /// each isolate for this client breakpoint. - /// - /// Note: It's possible for multiple [ClientBreakpoint]s to resolve to the - /// same VM breakpoint! - Map<ThreadInfo, vm.Breakpoint> forThread = {}; - - /// Whether this breakpoint was previously been verified. - bool get verified => _verified; - - bool _verified = false; - - /// A user-friendly explanation of why this breakpoint could not be resolved - /// (if [verified] is `false`, otherwise `null`). - String? get verifiedMessage => _verifiedMessage; - - String? _verifiedMessage = 'Breakpoint has not yet been resolved'; - - /// A machine-readable reason (specified by DAP) of why this breakpoint is not - /// resolved (if [verified] is `false`, otherwise `null`). - String? get verifiedReason => _verifiedReason; - - String? _verifiedReason = 'pending'; - - /// The line that this breakpoint resolved to, or the request line if not - /// resolved. - int get resolvedLine => _resolvedLine ?? breakpoint.line; - - int? _resolvedLine; - - /// The column that this breakpoint resolved to, or the request column if not - /// resolved. - int? get resolvedColumn => _resolvedColumn ?? breakpoint.column; - - int? _resolvedColumn; - /// A [Future] that completes with the last action that sends breakpoint /// information to the client, to ensure breakpoint events are always sent /// in-order and after the initial response sending the IDs to the client. @@ -1795,22 +1765,6 @@ _lastActionFuture = actionFuture; return actionFuture; } - - /// Marks that this breakpoint was resolved. - void resolved(int? line, int? column) { - _verified = true; - _verifiedReason = null; - _verifiedMessage = null; - _resolvedLine = line; - _resolvedColumn = column; - } - - /// Marks that this breakpoint was not resolved and why. - void unresolved({required String reason, required String message}) { - _verified = false; - _verifiedReason = reason; - _verifiedMessage = message; - } } /// Tracks actions resulting from `BreakpointAdded`/`BreakpointResolved` events @@ -1843,25 +1797,3 @@ StoredData(this.thread, this.data); } - -Uri? _convertPathToGoogle3Uri(Uri input) { - // TODO(dantup): Do we need to handle non-file here? Eg. can we have - // dart-macro+file:/// for a google3 path? - if (!input.isScheme('file')) { - return null; - } - final inputPath = input.toFilePath(); - - const search = '/google3/'; - if (inputPath.startsWith('/google') && inputPath.contains(search)) { - var idx = inputPath.indexOf(search); - var remainingPath = inputPath.substring(idx + search.length); - return Uri( - scheme: 'google3', - host: '', - path: remainingPath, - ); - } - - return null; -}
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml index eb5e983..89c4c0e 100644 --- a/pkg/dds/pubspec.yaml +++ b/pkg/dds/pubspec.yaml
@@ -1,5 +1,5 @@ name: dds -version: 5.0.4 +version: 5.0.5 description: >- A library used to spawn the Dart Developer Service, used to communicate with a Dart VM Service instance.
diff --git a/pkg/dds/test/dap/integration/dart_test_test.dart b/pkg/dds/test/dap/integration/dart_test_test.dart index 228d9d6..4011824 100644 --- a/pkg/dds/test/dap/integration/dart_test_test.dart +++ b/pkg/dds/test/dap/integration/dart_test_test.dart
@@ -203,7 +203,7 @@ // Add breakpoints to the 4 lines after the current one, one at a time. // Capture the IDs of all breakpoints added. - final breakpointLinesToSend = <int>[]; + final breakpointLinesToSend = <int>[breakpointLine]; final addedBreakpoints = <int>{}; for (var i = 1; i <= 4; i++) { breakpointLinesToSend.add(breakpointLine + i);
diff --git a/pkg/dds/test/dap/integration/debug_breakpoints_test.dart b/pkg/dds/test/dap/integration/debug_breakpoints_test.dart index 533c0ef..365e60d 100644 --- a/pkg/dds/test/dap/integration/debug_breakpoints_test.dart +++ b/pkg/dds/test/dap/integration/debug_breakpoints_test.dart
@@ -51,7 +51,7 @@ // Add breakpoints to the 4 lines after the current one, one at a time. // Capture the IDs of all breakpoints added. - final breakpointLinesToSend = <int>[]; + final breakpointLinesToSend = <int>[breakpointLine]; final addedBreakpoints = <int>{}; for (var i = 1; i <= 4; i++) { breakpointLinesToSend.add(breakpointLine + i); @@ -75,86 +75,6 @@ expect(resolvedBreakpoints, addedBreakpoints); }); - testWithUriConfigurations(() => dap, - 'does not re-resolve existing breakpoints when new ones are added', - () async { - final client = dap.client; - final testFile = dap.createTestFile(simpleMultiBreakpointProgram); - final breakpointLine = lineWith(testFile, breakpointMarker); - - // Start the app and hit the initial breakpoint. - await client.hitBreakpoint(testFile, breakpointLine); - - // Collect any breakpoint events in a simple text format for verifying. - final breakpointEvents = <String>[]; - final breakpointResolveSubscription = - client.breakpointChangeEvents.listen((event) { - var breakpoint = event.breakpoint; - var id = breakpoint.id!; - var verified = breakpoint.verified; - var reason = breakpoint.reason; - var description = verified ? 'verified' : 'not verified ($reason)'; - breakpointEvents.add('Breakpoint $id $description'); - }); - - // Test adding breakpoints to the 4 lines after the first breakpoint, one - // at a time. Each request contains the total set of breakpoints (so the - // first request has one breakpoint and the last request has all 4). In - // each response, we expect the previous breakpoints to be - // already-verified and to not get events for them. For the last one - // breakpoint, it will not be verified and we will then get an event. - var breakpointLines = <int>[]; - var seenBreakpointIds = <int>{}; - for (var i = 1; i <= 4; i++) { - breakpointEvents.clear(); // Clear any events from previous iterations. - - // Add an additional breakpoint on the next line. - breakpointLines.add(breakpointLine + i); - final response = await client.setBreakpoints(testFile, breakpointLines); - expect(response.breakpoints, hasLength(i)); - - // Wait up to a few seconds for a resolved events to come through. - final testUntil = - DateTime.now().toUtc().add(const Duration(seconds: 5)); - while (DateTime.now().toUtc().isBefore(testUntil) && - breakpointEvents.isEmpty) { - await pumpEventQueue(times: 5000); - } - - // Verify the results for this iteration. - for (var j = 0; j < i; j++) { - // j is zero-based but i is one-based - final breakpoint = response.breakpoints[j]; - final id = breakpoint.id!; - - // All but the last should be verified already and have existing IDs. - if (j == i - 1) { - expect(seenBreakpointIds.contains(id), isFalse, - reason: - 'Last breakpoint (index $j) should have a new unseen ID'); - expect(breakpoint.verified, isFalse, - reason: - 'Last breakpoint (index $j) should not yet be verified'); - seenBreakpointIds.add(id); - } else { - expect(seenBreakpointIds.contains(id), isTrue, - reason: - 'Non-last breakpoint (index $j) should have an already-seen ID because it was reused'); - expect(breakpoint.verified, isTrue, - reason: - 'Non-last breakpoint (index $j) should already be verified'); - } - } - - // We should have had one event for that last one to be verified (others - // were already verified). - expect(breakpointEvents, - ['Breakpoint ${response.breakpoints.last.id} verified']); - } - - await breakpointResolveSubscription.cancel(); - }); - testWithUriConfigurations( () => dap, 'provides reason for failed breakpoints', () async { final client = dap.client;
diff --git a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.expect b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.expect index 41ae4ad..75eb436 100644 --- a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.expect
@@ -1,7 +1,7 @@ // // Problems outside component: // -// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.10. // // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // ^ //
diff --git a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.modular.expect index 41ae4ad..75eb436 100644 --- a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.modular.expect
@@ -1,7 +1,7 @@ // // Problems outside component: // -// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.10. // // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // ^ //
diff --git a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.outline.expect index 41ae4ad..75eb436 100644 --- a/pkg/front_end/testcases/general/too_high_version/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/too_high_version/main.dart.strong.outline.expect
@@ -1,7 +1,7 @@ // // Problems outside component: // -// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/too_high_version/too_high/lib/too_high_lib.dart:1:1: Error: The language version 100.200 specified for the package 'too_high' is too high. The highest supported language version is 3.10. // // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // ^ //
diff --git a/pkg/front_end/testcases/general/version_too_high.dart.strong.expect b/pkg/front_end/testcases/general/version_too_high.dart.strong.expect index 9bed2ff..9d50a63 100644 --- a/pkg/front_end/testcases/general/version_too_high.dart.strong.expect +++ b/pkg/front_end/testcases/general/version_too_high.dart.strong.expect
@@ -2,7 +2,7 @@ // // Problems in library: // -// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.10. // // @dart=100.200 // ^^^^^^^^^^^^^^^^ //
diff --git a/pkg/front_end/testcases/general/version_too_high.dart.strong.modular.expect b/pkg/front_end/testcases/general/version_too_high.dart.strong.modular.expect index 9bed2ff..9d50a63 100644 --- a/pkg/front_end/testcases/general/version_too_high.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/version_too_high.dart.strong.modular.expect
@@ -2,7 +2,7 @@ // // Problems in library: // -// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.10. // // @dart=100.200 // ^^^^^^^^^^^^^^^^ //
diff --git a/pkg/front_end/testcases/general/version_too_high.dart.strong.outline.expect b/pkg/front_end/testcases/general/version_too_high.dart.strong.outline.expect index d0eb4db..11c4683 100644 --- a/pkg/front_end/testcases/general/version_too_high.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/version_too_high.dart.strong.outline.expect
@@ -2,7 +2,7 @@ // // Problems in library: // -// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.10. // // @dart=100.200 // ^^^^^^^^^^^^^^^^ //
diff --git a/pkg/front_end/testcases/general/version_too_high.dart.strong.transformed.expect b/pkg/front_end/testcases/general/version_too_high.dart.strong.transformed.expect index 9bed2ff..9d50a63 100644 --- a/pkg/front_end/testcases/general/version_too_high.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/version_too_high.dart.strong.transformed.expect
@@ -2,7 +2,7 @@ // // Problems in library: // -// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.9. +// pkg/front_end/testcases/general/version_too_high.dart:5:1: Error: The specified language version 100.200 is too high. The highest supported language version is 3.10. // // @dart=100.200 // ^^^^^^^^^^^^^^^^ //
diff --git a/pkg/front_end/testcases/pubspec.yaml b/pkg/front_end/testcases/pubspec.yaml index a40f5b5..b8de8ed 100644 --- a/pkg/front_end/testcases/pubspec.yaml +++ b/pkg/front_end/testcases/pubspec.yaml
@@ -2,5 +2,5 @@ # This package is not intended for consumption on pub.dev. DO NOT publish. publish_to: none environment: - sdk: ^3.9.0-0 + sdk: ^3.10.0-0 resolution: workspace
diff --git a/pkg/kernel/lib/default_language_version.dart b/pkg/kernel/lib/default_language_version.dart index 1652442..5c448ac 100644 --- a/pkg/kernel/lib/default_language_version.dart +++ b/pkg/kernel/lib/default_language_version.dart
@@ -9,4 +9,4 @@ import "ast.dart"; -const Version defaultLanguageVersion = const Version(3, 9); +const Version defaultLanguageVersion = const Version(3, 10);
diff --git a/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart b/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart index d0dee64..b47e763 100644 --- a/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart +++ b/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart
@@ -25,7 +25,6 @@ void registerNodeProcessors(NodeLintRegistry registry, RuleContext context) { var visitor = _Visitor(this, context); registry.addBinaryExpression(this, visitor); - registry.addConditionalExpression(this, visitor); } } @@ -42,14 +41,8 @@ @override void visitBinaryExpression(BinaryExpression node) { - if (node.operator.type - case TokenType.EQ_EQ || - TokenType.BANG_EQ || - TokenType.BAR || - TokenType.BAR_BAR || - TokenType.AMPERSAND || - TokenType.AMPERSAND_AMPERSAND || - TokenType.CARET) { + if (node.operator.type == TokenType.EQ_EQ || + node.operator.type == TokenType.BANG_EQ) { var left = node.leftOperand; var right = node.rightOperand; if (right is BooleanLiteral && isBool(left.staticType)) { @@ -59,18 +52,4 @@ } } } - - @override - void visitConditionalExpression(ConditionalExpression node) { - if (node.thenExpression case BooleanLiteral(:var offset) && var literal) { - if (node.elseExpression case BooleanLiteral(:var end)) { - rule.reportAtOffset(offset, end - offset); - } else if (isBool(node.elseExpression.staticType)) { - rule.reportAtNode(literal); - } - } else if (node.elseExpression case BooleanLiteral literal - when isBool(node.thenExpression.staticType)) { - rule.reportAtNode(literal); - } - } }
diff --git a/pkg/linter/lib/src/rules/strict_top_level_inference.dart b/pkg/linter/lib/src/rules/strict_top_level_inference.dart index c70a91c..fc06366 100644 --- a/pkg/linter/lib/src/rules/strict_top_level_inference.dart +++ b/pkg/linter/lib/src/rules/strict_top_level_inference.dart
@@ -184,14 +184,15 @@ } } - void _checkMethod(MethodDeclaration node, MethodFragmentImpl element) { + void _checkMethod(MethodDeclaration node, MethodFragmentImpl fragment) { + var element = fragment.element; if (element.typeInferenceError != null) { // Inferring the return type and/or one or more parameter types resulted // in a type inference error. Do not report lint in this case. return; } - var container = element.enclosingFragment!.element; + var container = fragment.enclosingFragment!.element; var noOverride = node.isStatic || container is ExtensionElement ||
diff --git a/pkg/linter/test/rules/no_literal_bool_comparisons_test.dart b/pkg/linter/test/rules/no_literal_bool_comparisons_test.dart index 9698c2c..23cd723 100644 --- a/pkg/linter/test/rules/no_literal_bool_comparisons_test.dart +++ b/pkg/linter/test/rules/no_literal_bool_comparisons_test.dart
@@ -17,29 +17,18 @@ @override String get lintRule => LintNames.no_literal_bool_comparisons; - test_ampersand_true() async { + test_true_eqeq_x_localVariable_nonNullableBool() async { await assertDiagnostics( r''' -void f(bool value) { - if (value & true) {} +void f(bool x) { + while (true == x) {} } ''', - [lint(35, 4)], + [lint(26, 4)], ); } - test_ampersandAmpersand_true() async { - await assertDiagnostics( - r''' -void f(bool value) { - if (value && true) {} -} -''', - [lint(36, 4)], - ); - } - - test_bangeq_true_expression_nonNullableBool() async { + test_x_bangeq_true_expression_nonNullableBool() async { await assertDiagnostics( r''' void f(bool x, bool y) { @@ -50,97 +39,7 @@ ); } - test_bar_true() async { - await assertDiagnostics( - r''' -void f(bool value) { - if (value | true) {} -} -''', - [lint(35, 4)], - ); - } - - test_barBar_true() async { - await assertDiagnostics( - r''' -void f(bool value) { - if (value || true) {} -} -''', - [lint(36, 4)], - ); - } - - test_caret_true() async { - await assertDiagnostics( - r''' -void f(bool value) { - if (value ^ true) {} -} -''', - [lint(35, 4)], - ); - } - - test_conditional_both_true() async { - await assertDiagnostics( - r''' -void f(bool value1, bool value2) { - print(value1 ? true : true); -} -''', - [lint(52, 11)], - ); - } - - test_conditional_else_true() async { - await assertDiagnostics( - r''' -void f(bool value1, bool value2) { - print(value1 ? value2 : true); -} -''', - [lint(61, 4)], - ); - } - - test_conditional_neither_booleans() async { - await assertNoDiagnostics(r''' -void f(bool value1) { - print(value1 ? null : null); -} -'''); - } - - test_conditional_then_null_else_false() async { - await assertNoDiagnostics(r''' -void f(bool value1) { - print(value1 ? null : false); -} -'''); - } - - test_conditional_then_true() async { - await assertDiagnostics( - r''' -void f(bool value1, bool value2) { - print(value1 ? true : value2); -} -''', - [lint(52, 4)], - ); - } - - test_conditional_then_true_else_null() async { - await assertNoDiagnostics(r''' -void f(bool value1) { - print(value1 ? null : false); -} -'''); - } - - test_eqeq_true_field_nonNullableBool() async { + test_x_eqeq_true_field_nonNullableBool() async { await assertDiagnostics( r''' void f(C c) { @@ -154,18 +53,7 @@ ); } - test_eqeq_true_invocation() async { - await assertDiagnostics( - r''' -void f(bool Function() fn) { - if (fn() == true) {} -} -''', - [lint(43, 4)], - ); - } - - test_eqeq_true_localVariable_nonNullableBool() async { + test_x_eqeq_true_localVariable_nonNullableBool() async { await assertDiagnostics( r''' void f(bool x) { @@ -176,35 +64,11 @@ ); } - test_eqeq_true_nullableBool() async { + test_x_eqeq_true_nullableBool() async { await assertNoDiagnostics(r''' void f(bool? x) { print(x == true); } '''); } - - test_eqeq_true_propertyAccess() async { - await assertDiagnostics( - r''' -extension E on List { - void m() { - if (this.isNotEmpty == true) {} - } -} -''', - [lint(62, 4)], - ); - } - - test_true_eqeq_localVariable_nonNullableBool() async { - await assertDiagnostics( - r''' -void f(bool x) { - while (true == x) {} -} -''', - [lint(26, 4)], - ); - } }
diff --git a/pkg/vm_service/test/dot_shorthands_test.dart b/pkg/vm_service/test/dot_shorthands_test.dart index 9e064c8..457a2ef 100644 --- a/pkg/vm_service/test/dot_shorthands_test.dart +++ b/pkg/vm_service/test/dot_shorthands_test.dart
@@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // SharedOptions=--enable-experiment=dot-shorthands -// @dart = 3.9 +// @dart = 3.10 import 'dart:developer';
diff --git a/pubspec.yaml b/pubspec.yaml index 6f994c2..193b9c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml
@@ -11,7 +11,7 @@ # # It needs to be updated before testing language features introduced in the # next language version. - sdk: ^3.9.0-0 + sdk: ^3.10.0-0 # These are the packages that are contained in the SDK. workspace:
diff --git a/runtime/tests/vm/dart/isolates/concurrent_megamorphic_call_test.dart b/runtime/tests/vm/dart/isolates/concurrent_megamorphic_call_test.dart new file mode 100644 index 0000000..722a1bb --- /dev/null +++ b/runtime/tests/vm/dart/isolates/concurrent_megamorphic_call_test.dart
@@ -0,0 +1,8027 @@ +// Copyright (c) 2025, 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 "dart:isolate"; +import "package:expect/expect.dart"; + +child(_) { + doCallsUp(); +} + +main(args) async { + await Isolate.spawn(child, null); + doCallsDown(); +} + +@pragma("vm:never-inline") +doCall(dynamic c) { + return c.foo(); // Megamorphic! +} + +class C0 { + foo() { + return 0; + } +} + +class C1 { + foo() { + return 1; + } +} + +class C2 { + foo() { + return 2; + } +} + +class C3 { + foo() { + return 3; + } +} + +class C4 { + foo() { + return 4; + } +} + +class C5 { + foo() { + return 5; + } +} + +class C6 { + foo() { + return 6; + } +} + +class C7 { + foo() { + return 7; + } +} + +class C8 { + foo() { + return 8; + } +} + +class C9 { + foo() { + return 9; + } +} + +class C10 { + foo() { + return 10; + } +} + +class C11 { + foo() { + return 11; + } +} + +class C12 { + foo() { + return 12; + } +} + +class C13 { + foo() { + return 13; + } +} + +class C14 { + foo() { + return 14; + } +} + +class C15 { + foo() { + return 15; + } +} + +class C16 { + foo() { + return 16; + } +} + +class C17 { + foo() { + return 17; + } +} + +class C18 { + foo() { + return 18; + } +} + +class C19 { + foo() { + return 19; + } +} + +class C20 { + foo() { + return 20; + } +} + +class C21 { + foo() { + return 21; + } +} + +class C22 { + foo() { + return 22; + } +} + +class C23 { + foo() { + return 23; + } +} + +class C24 { + foo() { + return 24; + } +} + +class C25 { + foo() { + return 25; + } +} + +class C26 { + foo() { + return 26; + } +} + +class C27 { + foo() { + return 27; + } +} + +class C28 { + foo() { + return 28; + } +} + +class C29 { + foo() { + return 29; + } +} + +class C30 { + foo() { + return 30; + } +} + +class C31 { + foo() { + return 31; + } +} + +class C32 { + foo() { + return 32; + } +} + +class C33 { + foo() { + return 33; + } +} + +class C34 { + foo() { + return 34; + } +} + +class C35 { + foo() { + return 35; + } +} + +class C36 { + foo() { + return 36; + } +} + +class C37 { + foo() { + return 37; + } +} + +class C38 { + foo() { + return 38; + } +} + +class C39 { + foo() { + return 39; + } +} + +class C40 { + foo() { + return 40; + } +} + +class C41 { + foo() { + return 41; + } +} + +class C42 { + foo() { + return 42; + } +} + +class C43 { + foo() { + return 43; + } +} + +class C44 { + foo() { + return 44; + } +} + +class C45 { + foo() { + return 45; + } +} + +class C46 { + foo() { + return 46; + } +} + +class C47 { + foo() { + return 47; + } +} + +class C48 { + foo() { + return 48; + } +} + +class C49 { + foo() { + return 49; + } +} + +class C50 { + foo() { + return 50; + } +} + +class C51 { + foo() { + return 51; + } +} + +class C52 { + foo() { + return 52; + } +} + +class C53 { + foo() { + return 53; + } +} + +class C54 { + foo() { + return 54; + } +} + +class C55 { + foo() { + return 55; + } +} + +class C56 { + foo() { + return 56; + } +} + +class C57 { + foo() { + return 57; + } +} + +class C58 { + foo() { + return 58; + } +} + +class C59 { + foo() { + return 59; + } +} + +class C60 { + foo() { + return 60; + } +} + +class C61 { + foo() { + return 61; + } +} + +class C62 { + foo() { + return 62; + } +} + +class C63 { + foo() { + return 63; + } +} + +class C64 { + foo() { + return 64; + } +} + +class C65 { + foo() { + return 65; + } +} + +class C66 { + foo() { + return 66; + } +} + +class C67 { + foo() { + return 67; + } +} + +class C68 { + foo() { + return 68; + } +} + +class C69 { + foo() { + return 69; + } +} + +class C70 { + foo() { + return 70; + } +} + +class C71 { + foo() { + return 71; + } +} + +class C72 { + foo() { + return 72; + } +} + +class C73 { + foo() { + return 73; + } +} + +class C74 { + foo() { + return 74; + } +} + +class C75 { + foo() { + return 75; + } +} + +class C76 { + foo() { + return 76; + } +} + +class C77 { + foo() { + return 77; + } +} + +class C78 { + foo() { + return 78; + } +} + +class C79 { + foo() { + return 79; + } +} + +class C80 { + foo() { + return 80; + } +} + +class C81 { + foo() { + return 81; + } +} + +class C82 { + foo() { + return 82; + } +} + +class C83 { + foo() { + return 83; + } +} + +class C84 { + foo() { + return 84; + } +} + +class C85 { + foo() { + return 85; + } +} + +class C86 { + foo() { + return 86; + } +} + +class C87 { + foo() { + return 87; + } +} + +class C88 { + foo() { + return 88; + } +} + +class C89 { + foo() { + return 89; + } +} + +class C90 { + foo() { + return 90; + } +} + +class C91 { + foo() { + return 91; + } +} + +class C92 { + foo() { + return 92; + } +} + +class C93 { + foo() { + return 93; + } +} + +class C94 { + foo() { + return 94; + } +} + +class C95 { + foo() { + return 95; + } +} + +class C96 { + foo() { + return 96; + } +} + +class C97 { + foo() { + return 97; + } +} + +class C98 { + foo() { + return 98; + } +} + +class C99 { + foo() { + return 99; + } +} + +class C100 { + foo() { + return 100; + } +} + +class C101 { + foo() { + return 101; + } +} + +class C102 { + foo() { + return 102; + } +} + +class C103 { + foo() { + return 103; + } +} + +class C104 { + foo() { + return 104; + } +} + +class C105 { + foo() { + return 105; + } +} + +class C106 { + foo() { + return 106; + } +} + +class C107 { + foo() { + return 107; + } +} + +class C108 { + foo() { + return 108; + } +} + +class C109 { + foo() { + return 109; + } +} + +class C110 { + foo() { + return 110; + } +} + +class C111 { + foo() { + return 111; + } +} + +class C112 { + foo() { + return 112; + } +} + +class C113 { + foo() { + return 113; + } +} + +class C114 { + foo() { + return 114; + } +} + +class C115 { + foo() { + return 115; + } +} + +class C116 { + foo() { + return 116; + } +} + +class C117 { + foo() { + return 117; + } +} + +class C118 { + foo() { + return 118; + } +} + +class C119 { + foo() { + return 119; + } +} + +class C120 { + foo() { + return 120; + } +} + +class C121 { + foo() { + return 121; + } +} + +class C122 { + foo() { + return 122; + } +} + +class C123 { + foo() { + return 123; + } +} + +class C124 { + foo() { + return 124; + } +} + +class C125 { + foo() { + return 125; + } +} + +class C126 { + foo() { + return 126; + } +} + +class C127 { + foo() { + return 127; + } +} + +class C128 { + foo() { + return 128; + } +} + +class C129 { + foo() { + return 129; + } +} + +class C130 { + foo() { + return 130; + } +} + +class C131 { + foo() { + return 131; + } +} + +class C132 { + foo() { + return 132; + } +} + +class C133 { + foo() { + return 133; + } +} + +class C134 { + foo() { + return 134; + } +} + +class C135 { + foo() { + return 135; + } +} + +class C136 { + foo() { + return 136; + } +} + +class C137 { + foo() { + return 137; + } +} + +class C138 { + foo() { + return 138; + } +} + +class C139 { + foo() { + return 139; + } +} + +class C140 { + foo() { + return 140; + } +} + +class C141 { + foo() { + return 141; + } +} + +class C142 { + foo() { + return 142; + } +} + +class C143 { + foo() { + return 143; + } +} + +class C144 { + foo() { + return 144; + } +} + +class C145 { + foo() { + return 145; + } +} + +class C146 { + foo() { + return 146; + } +} + +class C147 { + foo() { + return 147; + } +} + +class C148 { + foo() { + return 148; + } +} + +class C149 { + foo() { + return 149; + } +} + +class C150 { + foo() { + return 150; + } +} + +class C151 { + foo() { + return 151; + } +} + +class C152 { + foo() { + return 152; + } +} + +class C153 { + foo() { + return 153; + } +} + +class C154 { + foo() { + return 154; + } +} + +class C155 { + foo() { + return 155; + } +} + +class C156 { + foo() { + return 156; + } +} + +class C157 { + foo() { + return 157; + } +} + +class C158 { + foo() { + return 158; + } +} + +class C159 { + foo() { + return 159; + } +} + +class C160 { + foo() { + return 160; + } +} + +class C161 { + foo() { + return 161; + } +} + +class C162 { + foo() { + return 162; + } +} + +class C163 { + foo() { + return 163; + } +} + +class C164 { + foo() { + return 164; + } +} + +class C165 { + foo() { + return 165; + } +} + +class C166 { + foo() { + return 166; + } +} + +class C167 { + foo() { + return 167; + } +} + +class C168 { + foo() { + return 168; + } +} + +class C169 { + foo() { + return 169; + } +} + +class C170 { + foo() { + return 170; + } +} + +class C171 { + foo() { + return 171; + } +} + +class C172 { + foo() { + return 172; + } +} + +class C173 { + foo() { + return 173; + } +} + +class C174 { + foo() { + return 174; + } +} + +class C175 { + foo() { + return 175; + } +} + +class C176 { + foo() { + return 176; + } +} + +class C177 { + foo() { + return 177; + } +} + +class C178 { + foo() { + return 178; + } +} + +class C179 { + foo() { + return 179; + } +} + +class C180 { + foo() { + return 180; + } +} + +class C181 { + foo() { + return 181; + } +} + +class C182 { + foo() { + return 182; + } +} + +class C183 { + foo() { + return 183; + } +} + +class C184 { + foo() { + return 184; + } +} + +class C185 { + foo() { + return 185; + } +} + +class C186 { + foo() { + return 186; + } +} + +class C187 { + foo() { + return 187; + } +} + +class C188 { + foo() { + return 188; + } +} + +class C189 { + foo() { + return 189; + } +} + +class C190 { + foo() { + return 190; + } +} + +class C191 { + foo() { + return 191; + } +} + +class C192 { + foo() { + return 192; + } +} + +class C193 { + foo() { + return 193; + } +} + +class C194 { + foo() { + return 194; + } +} + +class C195 { + foo() { + return 195; + } +} + +class C196 { + foo() { + return 196; + } +} + +class C197 { + foo() { + return 197; + } +} + +class C198 { + foo() { + return 198; + } +} + +class C199 { + foo() { + return 199; + } +} + +class C200 { + foo() { + return 200; + } +} + +class C201 { + foo() { + return 201; + } +} + +class C202 { + foo() { + return 202; + } +} + +class C203 { + foo() { + return 203; + } +} + +class C204 { + foo() { + return 204; + } +} + +class C205 { + foo() { + return 205; + } +} + +class C206 { + foo() { + return 206; + } +} + +class C207 { + foo() { + return 207; + } +} + +class C208 { + foo() { + return 208; + } +} + +class C209 { + foo() { + return 209; + } +} + +class C210 { + foo() { + return 210; + } +} + +class C211 { + foo() { + return 211; + } +} + +class C212 { + foo() { + return 212; + } +} + +class C213 { + foo() { + return 213; + } +} + +class C214 { + foo() { + return 214; + } +} + +class C215 { + foo() { + return 215; + } +} + +class C216 { + foo() { + return 216; + } +} + +class C217 { + foo() { + return 217; + } +} + +class C218 { + foo() { + return 218; + } +} + +class C219 { + foo() { + return 219; + } +} + +class C220 { + foo() { + return 220; + } +} + +class C221 { + foo() { + return 221; + } +} + +class C222 { + foo() { + return 222; + } +} + +class C223 { + foo() { + return 223; + } +} + +class C224 { + foo() { + return 224; + } +} + +class C225 { + foo() { + return 225; + } +} + +class C226 { + foo() { + return 226; + } +} + +class C227 { + foo() { + return 227; + } +} + +class C228 { + foo() { + return 228; + } +} + +class C229 { + foo() { + return 229; + } +} + +class C230 { + foo() { + return 230; + } +} + +class C231 { + foo() { + return 231; + } +} + +class C232 { + foo() { + return 232; + } +} + +class C233 { + foo() { + return 233; + } +} + +class C234 { + foo() { + return 234; + } +} + +class C235 { + foo() { + return 235; + } +} + +class C236 { + foo() { + return 236; + } +} + +class C237 { + foo() { + return 237; + } +} + +class C238 { + foo() { + return 238; + } +} + +class C239 { + foo() { + return 239; + } +} + +class C240 { + foo() { + return 240; + } +} + +class C241 { + foo() { + return 241; + } +} + +class C242 { + foo() { + return 242; + } +} + +class C243 { + foo() { + return 243; + } +} + +class C244 { + foo() { + return 244; + } +} + +class C245 { + foo() { + return 245; + } +} + +class C246 { + foo() { + return 246; + } +} + +class C247 { + foo() { + return 247; + } +} + +class C248 { + foo() { + return 248; + } +} + +class C249 { + foo() { + return 249; + } +} + +class C250 { + foo() { + return 250; + } +} + +class C251 { + foo() { + return 251; + } +} + +class C252 { + foo() { + return 252; + } +} + +class C253 { + foo() { + return 253; + } +} + +class C254 { + foo() { + return 254; + } +} + +class C255 { + foo() { + return 255; + } +} + +class C256 { + foo() { + return 256; + } +} + +class C257 { + foo() { + return 257; + } +} + +class C258 { + foo() { + return 258; + } +} + +class C259 { + foo() { + return 259; + } +} + +class C260 { + foo() { + return 260; + } +} + +class C261 { + foo() { + return 261; + } +} + +class C262 { + foo() { + return 262; + } +} + +class C263 { + foo() { + return 263; + } +} + +class C264 { + foo() { + return 264; + } +} + +class C265 { + foo() { + return 265; + } +} + +class C266 { + foo() { + return 266; + } +} + +class C267 { + foo() { + return 267; + } +} + +class C268 { + foo() { + return 268; + } +} + +class C269 { + foo() { + return 269; + } +} + +class C270 { + foo() { + return 270; + } +} + +class C271 { + foo() { + return 271; + } +} + +class C272 { + foo() { + return 272; + } +} + +class C273 { + foo() { + return 273; + } +} + +class C274 { + foo() { + return 274; + } +} + +class C275 { + foo() { + return 275; + } +} + +class C276 { + foo() { + return 276; + } +} + +class C277 { + foo() { + return 277; + } +} + +class C278 { + foo() { + return 278; + } +} + +class C279 { + foo() { + return 279; + } +} + +class C280 { + foo() { + return 280; + } +} + +class C281 { + foo() { + return 281; + } +} + +class C282 { + foo() { + return 282; + } +} + +class C283 { + foo() { + return 283; + } +} + +class C284 { + foo() { + return 284; + } +} + +class C285 { + foo() { + return 285; + } +} + +class C286 { + foo() { + return 286; + } +} + +class C287 { + foo() { + return 287; + } +} + +class C288 { + foo() { + return 288; + } +} + +class C289 { + foo() { + return 289; + } +} + +class C290 { + foo() { + return 290; + } +} + +class C291 { + foo() { + return 291; + } +} + +class C292 { + foo() { + return 292; + } +} + +class C293 { + foo() { + return 293; + } +} + +class C294 { + foo() { + return 294; + } +} + +class C295 { + foo() { + return 295; + } +} + +class C296 { + foo() { + return 296; + } +} + +class C297 { + foo() { + return 297; + } +} + +class C298 { + foo() { + return 298; + } +} + +class C299 { + foo() { + return 299; + } +} + +class C300 { + foo() { + return 300; + } +} + +class C301 { + foo() { + return 301; + } +} + +class C302 { + foo() { + return 302; + } +} + +class C303 { + foo() { + return 303; + } +} + +class C304 { + foo() { + return 304; + } +} + +class C305 { + foo() { + return 305; + } +} + +class C306 { + foo() { + return 306; + } +} + +class C307 { + foo() { + return 307; + } +} + +class C308 { + foo() { + return 308; + } +} + +class C309 { + foo() { + return 309; + } +} + +class C310 { + foo() { + return 310; + } +} + +class C311 { + foo() { + return 311; + } +} + +class C312 { + foo() { + return 312; + } +} + +class C313 { + foo() { + return 313; + } +} + +class C314 { + foo() { + return 314; + } +} + +class C315 { + foo() { + return 315; + } +} + +class C316 { + foo() { + return 316; + } +} + +class C317 { + foo() { + return 317; + } +} + +class C318 { + foo() { + return 318; + } +} + +class C319 { + foo() { + return 319; + } +} + +class C320 { + foo() { + return 320; + } +} + +class C321 { + foo() { + return 321; + } +} + +class C322 { + foo() { + return 322; + } +} + +class C323 { + foo() { + return 323; + } +} + +class C324 { + foo() { + return 324; + } +} + +class C325 { + foo() { + return 325; + } +} + +class C326 { + foo() { + return 326; + } +} + +class C327 { + foo() { + return 327; + } +} + +class C328 { + foo() { + return 328; + } +} + +class C329 { + foo() { + return 329; + } +} + +class C330 { + foo() { + return 330; + } +} + +class C331 { + foo() { + return 331; + } +} + +class C332 { + foo() { + return 332; + } +} + +class C333 { + foo() { + return 333; + } +} + +class C334 { + foo() { + return 334; + } +} + +class C335 { + foo() { + return 335; + } +} + +class C336 { + foo() { + return 336; + } +} + +class C337 { + foo() { + return 337; + } +} + +class C338 { + foo() { + return 338; + } +} + +class C339 { + foo() { + return 339; + } +} + +class C340 { + foo() { + return 340; + } +} + +class C341 { + foo() { + return 341; + } +} + +class C342 { + foo() { + return 342; + } +} + +class C343 { + foo() { + return 343; + } +} + +class C344 { + foo() { + return 344; + } +} + +class C345 { + foo() { + return 345; + } +} + +class C346 { + foo() { + return 346; + } +} + +class C347 { + foo() { + return 347; + } +} + +class C348 { + foo() { + return 348; + } +} + +class C349 { + foo() { + return 349; + } +} + +class C350 { + foo() { + return 350; + } +} + +class C351 { + foo() { + return 351; + } +} + +class C352 { + foo() { + return 352; + } +} + +class C353 { + foo() { + return 353; + } +} + +class C354 { + foo() { + return 354; + } +} + +class C355 { + foo() { + return 355; + } +} + +class C356 { + foo() { + return 356; + } +} + +class C357 { + foo() { + return 357; + } +} + +class C358 { + foo() { + return 358; + } +} + +class C359 { + foo() { + return 359; + } +} + +class C360 { + foo() { + return 360; + } +} + +class C361 { + foo() { + return 361; + } +} + +class C362 { + foo() { + return 362; + } +} + +class C363 { + foo() { + return 363; + } +} + +class C364 { + foo() { + return 364; + } +} + +class C365 { + foo() { + return 365; + } +} + +class C366 { + foo() { + return 366; + } +} + +class C367 { + foo() { + return 367; + } +} + +class C368 { + foo() { + return 368; + } +} + +class C369 { + foo() { + return 369; + } +} + +class C370 { + foo() { + return 370; + } +} + +class C371 { + foo() { + return 371; + } +} + +class C372 { + foo() { + return 372; + } +} + +class C373 { + foo() { + return 373; + } +} + +class C374 { + foo() { + return 374; + } +} + +class C375 { + foo() { + return 375; + } +} + +class C376 { + foo() { + return 376; + } +} + +class C377 { + foo() { + return 377; + } +} + +class C378 { + foo() { + return 378; + } +} + +class C379 { + foo() { + return 379; + } +} + +class C380 { + foo() { + return 380; + } +} + +class C381 { + foo() { + return 381; + } +} + +class C382 { + foo() { + return 382; + } +} + +class C383 { + foo() { + return 383; + } +} + +class C384 { + foo() { + return 384; + } +} + +class C385 { + foo() { + return 385; + } +} + +class C386 { + foo() { + return 386; + } +} + +class C387 { + foo() { + return 387; + } +} + +class C388 { + foo() { + return 388; + } +} + +class C389 { + foo() { + return 389; + } +} + +class C390 { + foo() { + return 390; + } +} + +class C391 { + foo() { + return 391; + } +} + +class C392 { + foo() { + return 392; + } +} + +class C393 { + foo() { + return 393; + } +} + +class C394 { + foo() { + return 394; + } +} + +class C395 { + foo() { + return 395; + } +} + +class C396 { + foo() { + return 396; + } +} + +class C397 { + foo() { + return 397; + } +} + +class C398 { + foo() { + return 398; + } +} + +class C399 { + foo() { + return 399; + } +} + +class C400 { + foo() { + return 400; + } +} + +class C401 { + foo() { + return 401; + } +} + +class C402 { + foo() { + return 402; + } +} + +class C403 { + foo() { + return 403; + } +} + +class C404 { + foo() { + return 404; + } +} + +class C405 { + foo() { + return 405; + } +} + +class C406 { + foo() { + return 406; + } +} + +class C407 { + foo() { + return 407; + } +} + +class C408 { + foo() { + return 408; + } +} + +class C409 { + foo() { + return 409; + } +} + +class C410 { + foo() { + return 410; + } +} + +class C411 { + foo() { + return 411; + } +} + +class C412 { + foo() { + return 412; + } +} + +class C413 { + foo() { + return 413; + } +} + +class C414 { + foo() { + return 414; + } +} + +class C415 { + foo() { + return 415; + } +} + +class C416 { + foo() { + return 416; + } +} + +class C417 { + foo() { + return 417; + } +} + +class C418 { + foo() { + return 418; + } +} + +class C419 { + foo() { + return 419; + } +} + +class C420 { + foo() { + return 420; + } +} + +class C421 { + foo() { + return 421; + } +} + +class C422 { + foo() { + return 422; + } +} + +class C423 { + foo() { + return 423; + } +} + +class C424 { + foo() { + return 424; + } +} + +class C425 { + foo() { + return 425; + } +} + +class C426 { + foo() { + return 426; + } +} + +class C427 { + foo() { + return 427; + } +} + +class C428 { + foo() { + return 428; + } +} + +class C429 { + foo() { + return 429; + } +} + +class C430 { + foo() { + return 430; + } +} + +class C431 { + foo() { + return 431; + } +} + +class C432 { + foo() { + return 432; + } +} + +class C433 { + foo() { + return 433; + } +} + +class C434 { + foo() { + return 434; + } +} + +class C435 { + foo() { + return 435; + } +} + +class C436 { + foo() { + return 436; + } +} + +class C437 { + foo() { + return 437; + } +} + +class C438 { + foo() { + return 438; + } +} + +class C439 { + foo() { + return 439; + } +} + +class C440 { + foo() { + return 440; + } +} + +class C441 { + foo() { + return 441; + } +} + +class C442 { + foo() { + return 442; + } +} + +class C443 { + foo() { + return 443; + } +} + +class C444 { + foo() { + return 444; + } +} + +class C445 { + foo() { + return 445; + } +} + +class C446 { + foo() { + return 446; + } +} + +class C447 { + foo() { + return 447; + } +} + +class C448 { + foo() { + return 448; + } +} + +class C449 { + foo() { + return 449; + } +} + +class C450 { + foo() { + return 450; + } +} + +class C451 { + foo() { + return 451; + } +} + +class C452 { + foo() { + return 452; + } +} + +class C453 { + foo() { + return 453; + } +} + +class C454 { + foo() { + return 454; + } +} + +class C455 { + foo() { + return 455; + } +} + +class C456 { + foo() { + return 456; + } +} + +class C457 { + foo() { + return 457; + } +} + +class C458 { + foo() { + return 458; + } +} + +class C459 { + foo() { + return 459; + } +} + +class C460 { + foo() { + return 460; + } +} + +class C461 { + foo() { + return 461; + } +} + +class C462 { + foo() { + return 462; + } +} + +class C463 { + foo() { + return 463; + } +} + +class C464 { + foo() { + return 464; + } +} + +class C465 { + foo() { + return 465; + } +} + +class C466 { + foo() { + return 466; + } +} + +class C467 { + foo() { + return 467; + } +} + +class C468 { + foo() { + return 468; + } +} + +class C469 { + foo() { + return 469; + } +} + +class C470 { + foo() { + return 470; + } +} + +class C471 { + foo() { + return 471; + } +} + +class C472 { + foo() { + return 472; + } +} + +class C473 { + foo() { + return 473; + } +} + +class C474 { + foo() { + return 474; + } +} + +class C475 { + foo() { + return 475; + } +} + +class C476 { + foo() { + return 476; + } +} + +class C477 { + foo() { + return 477; + } +} + +class C478 { + foo() { + return 478; + } +} + +class C479 { + foo() { + return 479; + } +} + +class C480 { + foo() { + return 480; + } +} + +class C481 { + foo() { + return 481; + } +} + +class C482 { + foo() { + return 482; + } +} + +class C483 { + foo() { + return 483; + } +} + +class C484 { + foo() { + return 484; + } +} + +class C485 { + foo() { + return 485; + } +} + +class C486 { + foo() { + return 486; + } +} + +class C487 { + foo() { + return 487; + } +} + +class C488 { + foo() { + return 488; + } +} + +class C489 { + foo() { + return 489; + } +} + +class C490 { + foo() { + return 490; + } +} + +class C491 { + foo() { + return 491; + } +} + +class C492 { + foo() { + return 492; + } +} + +class C493 { + foo() { + return 493; + } +} + +class C494 { + foo() { + return 494; + } +} + +class C495 { + foo() { + return 495; + } +} + +class C496 { + foo() { + return 496; + } +} + +class C497 { + foo() { + return 497; + } +} + +class C498 { + foo() { + return 498; + } +} + +class C499 { + foo() { + return 499; + } +} + +class C500 { + foo() { + return 500; + } +} + +class C501 { + foo() { + return 501; + } +} + +class C502 { + foo() { + return 502; + } +} + +class C503 { + foo() { + return 503; + } +} + +class C504 { + foo() { + return 504; + } +} + +class C505 { + foo() { + return 505; + } +} + +class C506 { + foo() { + return 506; + } +} + +class C507 { + foo() { + return 507; + } +} + +class C508 { + foo() { + return 508; + } +} + +class C509 { + foo() { + return 509; + } +} + +class C510 { + foo() { + return 510; + } +} + +class C511 { + foo() { + return 511; + } +} + +class C512 { + foo() { + return 512; + } +} + +class C513 { + foo() { + return 513; + } +} + +class C514 { + foo() { + return 514; + } +} + +class C515 { + foo() { + return 515; + } +} + +class C516 { + foo() { + return 516; + } +} + +class C517 { + foo() { + return 517; + } +} + +class C518 { + foo() { + return 518; + } +} + +class C519 { + foo() { + return 519; + } +} + +class C520 { + foo() { + return 520; + } +} + +class C521 { + foo() { + return 521; + } +} + +class C522 { + foo() { + return 522; + } +} + +class C523 { + foo() { + return 523; + } +} + +class C524 { + foo() { + return 524; + } +} + +class C525 { + foo() { + return 525; + } +} + +class C526 { + foo() { + return 526; + } +} + +class C527 { + foo() { + return 527; + } +} + +class C528 { + foo() { + return 528; + } +} + +class C529 { + foo() { + return 529; + } +} + +class C530 { + foo() { + return 530; + } +} + +class C531 { + foo() { + return 531; + } +} + +class C532 { + foo() { + return 532; + } +} + +class C533 { + foo() { + return 533; + } +} + +class C534 { + foo() { + return 534; + } +} + +class C535 { + foo() { + return 535; + } +} + +class C536 { + foo() { + return 536; + } +} + +class C537 { + foo() { + return 537; + } +} + +class C538 { + foo() { + return 538; + } +} + +class C539 { + foo() { + return 539; + } +} + +class C540 { + foo() { + return 540; + } +} + +class C541 { + foo() { + return 541; + } +} + +class C542 { + foo() { + return 542; + } +} + +class C543 { + foo() { + return 543; + } +} + +class C544 { + foo() { + return 544; + } +} + +class C545 { + foo() { + return 545; + } +} + +class C546 { + foo() { + return 546; + } +} + +class C547 { + foo() { + return 547; + } +} + +class C548 { + foo() { + return 548; + } +} + +class C549 { + foo() { + return 549; + } +} + +class C550 { + foo() { + return 550; + } +} + +class C551 { + foo() { + return 551; + } +} + +class C552 { + foo() { + return 552; + } +} + +class C553 { + foo() { + return 553; + } +} + +class C554 { + foo() { + return 554; + } +} + +class C555 { + foo() { + return 555; + } +} + +class C556 { + foo() { + return 556; + } +} + +class C557 { + foo() { + return 557; + } +} + +class C558 { + foo() { + return 558; + } +} + +class C559 { + foo() { + return 559; + } +} + +class C560 { + foo() { + return 560; + } +} + +class C561 { + foo() { + return 561; + } +} + +class C562 { + foo() { + return 562; + } +} + +class C563 { + foo() { + return 563; + } +} + +class C564 { + foo() { + return 564; + } +} + +class C565 { + foo() { + return 565; + } +} + +class C566 { + foo() { + return 566; + } +} + +class C567 { + foo() { + return 567; + } +} + +class C568 { + foo() { + return 568; + } +} + +class C569 { + foo() { + return 569; + } +} + +class C570 { + foo() { + return 570; + } +} + +class C571 { + foo() { + return 571; + } +} + +class C572 { + foo() { + return 572; + } +} + +class C573 { + foo() { + return 573; + } +} + +class C574 { + foo() { + return 574; + } +} + +class C575 { + foo() { + return 575; + } +} + +class C576 { + foo() { + return 576; + } +} + +class C577 { + foo() { + return 577; + } +} + +class C578 { + foo() { + return 578; + } +} + +class C579 { + foo() { + return 579; + } +} + +class C580 { + foo() { + return 580; + } +} + +class C581 { + foo() { + return 581; + } +} + +class C582 { + foo() { + return 582; + } +} + +class C583 { + foo() { + return 583; + } +} + +class C584 { + foo() { + return 584; + } +} + +class C585 { + foo() { + return 585; + } +} + +class C586 { + foo() { + return 586; + } +} + +class C587 { + foo() { + return 587; + } +} + +class C588 { + foo() { + return 588; + } +} + +class C589 { + foo() { + return 589; + } +} + +class C590 { + foo() { + return 590; + } +} + +class C591 { + foo() { + return 591; + } +} + +class C592 { + foo() { + return 592; + } +} + +class C593 { + foo() { + return 593; + } +} + +class C594 { + foo() { + return 594; + } +} + +class C595 { + foo() { + return 595; + } +} + +class C596 { + foo() { + return 596; + } +} + +class C597 { + foo() { + return 597; + } +} + +class C598 { + foo() { + return 598; + } +} + +class C599 { + foo() { + return 599; + } +} + +class C600 { + foo() { + return 600; + } +} + +class C601 { + foo() { + return 601; + } +} + +class C602 { + foo() { + return 602; + } +} + +class C603 { + foo() { + return 603; + } +} + +class C604 { + foo() { + return 604; + } +} + +class C605 { + foo() { + return 605; + } +} + +class C606 { + foo() { + return 606; + } +} + +class C607 { + foo() { + return 607; + } +} + +class C608 { + foo() { + return 608; + } +} + +class C609 { + foo() { + return 609; + } +} + +class C610 { + foo() { + return 610; + } +} + +class C611 { + foo() { + return 611; + } +} + +class C612 { + foo() { + return 612; + } +} + +class C613 { + foo() { + return 613; + } +} + +class C614 { + foo() { + return 614; + } +} + +class C615 { + foo() { + return 615; + } +} + +class C616 { + foo() { + return 616; + } +} + +class C617 { + foo() { + return 617; + } +} + +class C618 { + foo() { + return 618; + } +} + +class C619 { + foo() { + return 619; + } +} + +class C620 { + foo() { + return 620; + } +} + +class C621 { + foo() { + return 621; + } +} + +class C622 { + foo() { + return 622; + } +} + +class C623 { + foo() { + return 623; + } +} + +class C624 { + foo() { + return 624; + } +} + +class C625 { + foo() { + return 625; + } +} + +class C626 { + foo() { + return 626; + } +} + +class C627 { + foo() { + return 627; + } +} + +class C628 { + foo() { + return 628; + } +} + +class C629 { + foo() { + return 629; + } +} + +class C630 { + foo() { + return 630; + } +} + +class C631 { + foo() { + return 631; + } +} + +class C632 { + foo() { + return 632; + } +} + +class C633 { + foo() { + return 633; + } +} + +class C634 { + foo() { + return 634; + } +} + +class C635 { + foo() { + return 635; + } +} + +class C636 { + foo() { + return 636; + } +} + +class C637 { + foo() { + return 637; + } +} + +class C638 { + foo() { + return 638; + } +} + +class C639 { + foo() { + return 639; + } +} + +class C640 { + foo() { + return 640; + } +} + +class C641 { + foo() { + return 641; + } +} + +class C642 { + foo() { + return 642; + } +} + +class C643 { + foo() { + return 643; + } +} + +class C644 { + foo() { + return 644; + } +} + +class C645 { + foo() { + return 645; + } +} + +class C646 { + foo() { + return 646; + } +} + +class C647 { + foo() { + return 647; + } +} + +class C648 { + foo() { + return 648; + } +} + +class C649 { + foo() { + return 649; + } +} + +class C650 { + foo() { + return 650; + } +} + +class C651 { + foo() { + return 651; + } +} + +class C652 { + foo() { + return 652; + } +} + +class C653 { + foo() { + return 653; + } +} + +class C654 { + foo() { + return 654; + } +} + +class C655 { + foo() { + return 655; + } +} + +class C656 { + foo() { + return 656; + } +} + +class C657 { + foo() { + return 657; + } +} + +class C658 { + foo() { + return 658; + } +} + +class C659 { + foo() { + return 659; + } +} + +class C660 { + foo() { + return 660; + } +} + +class C661 { + foo() { + return 661; + } +} + +class C662 { + foo() { + return 662; + } +} + +class C663 { + foo() { + return 663; + } +} + +class C664 { + foo() { + return 664; + } +} + +class C665 { + foo() { + return 665; + } +} + +class C666 { + foo() { + return 666; + } +} + +class C667 { + foo() { + return 667; + } +} + +class C668 { + foo() { + return 668; + } +} + +class C669 { + foo() { + return 669; + } +} + +class C670 { + foo() { + return 670; + } +} + +class C671 { + foo() { + return 671; + } +} + +class C672 { + foo() { + return 672; + } +} + +class C673 { + foo() { + return 673; + } +} + +class C674 { + foo() { + return 674; + } +} + +class C675 { + foo() { + return 675; + } +} + +class C676 { + foo() { + return 676; + } +} + +class C677 { + foo() { + return 677; + } +} + +class C678 { + foo() { + return 678; + } +} + +class C679 { + foo() { + return 679; + } +} + +class C680 { + foo() { + return 680; + } +} + +class C681 { + foo() { + return 681; + } +} + +class C682 { + foo() { + return 682; + } +} + +class C683 { + foo() { + return 683; + } +} + +class C684 { + foo() { + return 684; + } +} + +class C685 { + foo() { + return 685; + } +} + +class C686 { + foo() { + return 686; + } +} + +class C687 { + foo() { + return 687; + } +} + +class C688 { + foo() { + return 688; + } +} + +class C689 { + foo() { + return 689; + } +} + +class C690 { + foo() { + return 690; + } +} + +class C691 { + foo() { + return 691; + } +} + +class C692 { + foo() { + return 692; + } +} + +class C693 { + foo() { + return 693; + } +} + +class C694 { + foo() { + return 694; + } +} + +class C695 { + foo() { + return 695; + } +} + +class C696 { + foo() { + return 696; + } +} + +class C697 { + foo() { + return 697; + } +} + +class C698 { + foo() { + return 698; + } +} + +class C699 { + foo() { + return 699; + } +} + +class C700 { + foo() { + return 700; + } +} + +class C701 { + foo() { + return 701; + } +} + +class C702 { + foo() { + return 702; + } +} + +class C703 { + foo() { + return 703; + } +} + +class C704 { + foo() { + return 704; + } +} + +class C705 { + foo() { + return 705; + } +} + +class C706 { + foo() { + return 706; + } +} + +class C707 { + foo() { + return 707; + } +} + +class C708 { + foo() { + return 708; + } +} + +class C709 { + foo() { + return 709; + } +} + +class C710 { + foo() { + return 710; + } +} + +class C711 { + foo() { + return 711; + } +} + +class C712 { + foo() { + return 712; + } +} + +class C713 { + foo() { + return 713; + } +} + +class C714 { + foo() { + return 714; + } +} + +class C715 { + foo() { + return 715; + } +} + +class C716 { + foo() { + return 716; + } +} + +class C717 { + foo() { + return 717; + } +} + +class C718 { + foo() { + return 718; + } +} + +class C719 { + foo() { + return 719; + } +} + +class C720 { + foo() { + return 720; + } +} + +class C721 { + foo() { + return 721; + } +} + +class C722 { + foo() { + return 722; + } +} + +class C723 { + foo() { + return 723; + } +} + +class C724 { + foo() { + return 724; + } +} + +class C725 { + foo() { + return 725; + } +} + +class C726 { + foo() { + return 726; + } +} + +class C727 { + foo() { + return 727; + } +} + +class C728 { + foo() { + return 728; + } +} + +class C729 { + foo() { + return 729; + } +} + +class C730 { + foo() { + return 730; + } +} + +class C731 { + foo() { + return 731; + } +} + +class C732 { + foo() { + return 732; + } +} + +class C733 { + foo() { + return 733; + } +} + +class C734 { + foo() { + return 734; + } +} + +class C735 { + foo() { + return 735; + } +} + +class C736 { + foo() { + return 736; + } +} + +class C737 { + foo() { + return 737; + } +} + +class C738 { + foo() { + return 738; + } +} + +class C739 { + foo() { + return 739; + } +} + +class C740 { + foo() { + return 740; + } +} + +class C741 { + foo() { + return 741; + } +} + +class C742 { + foo() { + return 742; + } +} + +class C743 { + foo() { + return 743; + } +} + +class C744 { + foo() { + return 744; + } +} + +class C745 { + foo() { + return 745; + } +} + +class C746 { + foo() { + return 746; + } +} + +class C747 { + foo() { + return 747; + } +} + +class C748 { + foo() { + return 748; + } +} + +class C749 { + foo() { + return 749; + } +} + +class C750 { + foo() { + return 750; + } +} + +class C751 { + foo() { + return 751; + } +} + +class C752 { + foo() { + return 752; + } +} + +class C753 { + foo() { + return 753; + } +} + +class C754 { + foo() { + return 754; + } +} + +class C755 { + foo() { + return 755; + } +} + +class C756 { + foo() { + return 756; + } +} + +class C757 { + foo() { + return 757; + } +} + +class C758 { + foo() { + return 758; + } +} + +class C759 { + foo() { + return 759; + } +} + +class C760 { + foo() { + return 760; + } +} + +class C761 { + foo() { + return 761; + } +} + +class C762 { + foo() { + return 762; + } +} + +class C763 { + foo() { + return 763; + } +} + +class C764 { + foo() { + return 764; + } +} + +class C765 { + foo() { + return 765; + } +} + +class C766 { + foo() { + return 766; + } +} + +class C767 { + foo() { + return 767; + } +} + +class C768 { + foo() { + return 768; + } +} + +class C769 { + foo() { + return 769; + } +} + +class C770 { + foo() { + return 770; + } +} + +class C771 { + foo() { + return 771; + } +} + +class C772 { + foo() { + return 772; + } +} + +class C773 { + foo() { + return 773; + } +} + +class C774 { + foo() { + return 774; + } +} + +class C775 { + foo() { + return 775; + } +} + +class C776 { + foo() { + return 776; + } +} + +class C777 { + foo() { + return 777; + } +} + +class C778 { + foo() { + return 778; + } +} + +class C779 { + foo() { + return 779; + } +} + +class C780 { + foo() { + return 780; + } +} + +class C781 { + foo() { + return 781; + } +} + +class C782 { + foo() { + return 782; + } +} + +class C783 { + foo() { + return 783; + } +} + +class C784 { + foo() { + return 784; + } +} + +class C785 { + foo() { + return 785; + } +} + +class C786 { + foo() { + return 786; + } +} + +class C787 { + foo() { + return 787; + } +} + +class C788 { + foo() { + return 788; + } +} + +class C789 { + foo() { + return 789; + } +} + +class C790 { + foo() { + return 790; + } +} + +class C791 { + foo() { + return 791; + } +} + +class C792 { + foo() { + return 792; + } +} + +class C793 { + foo() { + return 793; + } +} + +class C794 { + foo() { + return 794; + } +} + +class C795 { + foo() { + return 795; + } +} + +class C796 { + foo() { + return 796; + } +} + +class C797 { + foo() { + return 797; + } +} + +class C798 { + foo() { + return 798; + } +} + +class C799 { + foo() { + return 799; + } +} + +class C800 { + foo() { + return 800; + } +} + +class C801 { + foo() { + return 801; + } +} + +class C802 { + foo() { + return 802; + } +} + +class C803 { + foo() { + return 803; + } +} + +class C804 { + foo() { + return 804; + } +} + +class C805 { + foo() { + return 805; + } +} + +class C806 { + foo() { + return 806; + } +} + +class C807 { + foo() { + return 807; + } +} + +class C808 { + foo() { + return 808; + } +} + +class C809 { + foo() { + return 809; + } +} + +class C810 { + foo() { + return 810; + } +} + +class C811 { + foo() { + return 811; + } +} + +class C812 { + foo() { + return 812; + } +} + +class C813 { + foo() { + return 813; + } +} + +class C814 { + foo() { + return 814; + } +} + +class C815 { + foo() { + return 815; + } +} + +class C816 { + foo() { + return 816; + } +} + +class C817 { + foo() { + return 817; + } +} + +class C818 { + foo() { + return 818; + } +} + +class C819 { + foo() { + return 819; + } +} + +class C820 { + foo() { + return 820; + } +} + +class C821 { + foo() { + return 821; + } +} + +class C822 { + foo() { + return 822; + } +} + +class C823 { + foo() { + return 823; + } +} + +class C824 { + foo() { + return 824; + } +} + +class C825 { + foo() { + return 825; + } +} + +class C826 { + foo() { + return 826; + } +} + +class C827 { + foo() { + return 827; + } +} + +class C828 { + foo() { + return 828; + } +} + +class C829 { + foo() { + return 829; + } +} + +class C830 { + foo() { + return 830; + } +} + +class C831 { + foo() { + return 831; + } +} + +class C832 { + foo() { + return 832; + } +} + +class C833 { + foo() { + return 833; + } +} + +class C834 { + foo() { + return 834; + } +} + +class C835 { + foo() { + return 835; + } +} + +class C836 { + foo() { + return 836; + } +} + +class C837 { + foo() { + return 837; + } +} + +class C838 { + foo() { + return 838; + } +} + +class C839 { + foo() { + return 839; + } +} + +class C840 { + foo() { + return 840; + } +} + +class C841 { + foo() { + return 841; + } +} + +class C842 { + foo() { + return 842; + } +} + +class C843 { + foo() { + return 843; + } +} + +class C844 { + foo() { + return 844; + } +} + +class C845 { + foo() { + return 845; + } +} + +class C846 { + foo() { + return 846; + } +} + +class C847 { + foo() { + return 847; + } +} + +class C848 { + foo() { + return 848; + } +} + +class C849 { + foo() { + return 849; + } +} + +class C850 { + foo() { + return 850; + } +} + +class C851 { + foo() { + return 851; + } +} + +class C852 { + foo() { + return 852; + } +} + +class C853 { + foo() { + return 853; + } +} + +class C854 { + foo() { + return 854; + } +} + +class C855 { + foo() { + return 855; + } +} + +class C856 { + foo() { + return 856; + } +} + +class C857 { + foo() { + return 857; + } +} + +class C858 { + foo() { + return 858; + } +} + +class C859 { + foo() { + return 859; + } +} + +class C860 { + foo() { + return 860; + } +} + +class C861 { + foo() { + return 861; + } +} + +class C862 { + foo() { + return 862; + } +} + +class C863 { + foo() { + return 863; + } +} + +class C864 { + foo() { + return 864; + } +} + +class C865 { + foo() { + return 865; + } +} + +class C866 { + foo() { + return 866; + } +} + +class C867 { + foo() { + return 867; + } +} + +class C868 { + foo() { + return 868; + } +} + +class C869 { + foo() { + return 869; + } +} + +class C870 { + foo() { + return 870; + } +} + +class C871 { + foo() { + return 871; + } +} + +class C872 { + foo() { + return 872; + } +} + +class C873 { + foo() { + return 873; + } +} + +class C874 { + foo() { + return 874; + } +} + +class C875 { + foo() { + return 875; + } +} + +class C876 { + foo() { + return 876; + } +} + +class C877 { + foo() { + return 877; + } +} + +class C878 { + foo() { + return 878; + } +} + +class C879 { + foo() { + return 879; + } +} + +class C880 { + foo() { + return 880; + } +} + +class C881 { + foo() { + return 881; + } +} + +class C882 { + foo() { + return 882; + } +} + +class C883 { + foo() { + return 883; + } +} + +class C884 { + foo() { + return 884; + } +} + +class C885 { + foo() { + return 885; + } +} + +class C886 { + foo() { + return 886; + } +} + +class C887 { + foo() { + return 887; + } +} + +class C888 { + foo() { + return 888; + } +} + +class C889 { + foo() { + return 889; + } +} + +class C890 { + foo() { + return 890; + } +} + +class C891 { + foo() { + return 891; + } +} + +class C892 { + foo() { + return 892; + } +} + +class C893 { + foo() { + return 893; + } +} + +class C894 { + foo() { + return 894; + } +} + +class C895 { + foo() { + return 895; + } +} + +class C896 { + foo() { + return 896; + } +} + +class C897 { + foo() { + return 897; + } +} + +class C898 { + foo() { + return 898; + } +} + +class C899 { + foo() { + return 899; + } +} + +class C900 { + foo() { + return 900; + } +} + +class C901 { + foo() { + return 901; + } +} + +class C902 { + foo() { + return 902; + } +} + +class C903 { + foo() { + return 903; + } +} + +class C904 { + foo() { + return 904; + } +} + +class C905 { + foo() { + return 905; + } +} + +class C906 { + foo() { + return 906; + } +} + +class C907 { + foo() { + return 907; + } +} + +class C908 { + foo() { + return 908; + } +} + +class C909 { + foo() { + return 909; + } +} + +class C910 { + foo() { + return 910; + } +} + +class C911 { + foo() { + return 911; + } +} + +class C912 { + foo() { + return 912; + } +} + +class C913 { + foo() { + return 913; + } +} + +class C914 { + foo() { + return 914; + } +} + +class C915 { + foo() { + return 915; + } +} + +class C916 { + foo() { + return 916; + } +} + +class C917 { + foo() { + return 917; + } +} + +class C918 { + foo() { + return 918; + } +} + +class C919 { + foo() { + return 919; + } +} + +class C920 { + foo() { + return 920; + } +} + +class C921 { + foo() { + return 921; + } +} + +class C922 { + foo() { + return 922; + } +} + +class C923 { + foo() { + return 923; + } +} + +class C924 { + foo() { + return 924; + } +} + +class C925 { + foo() { + return 925; + } +} + +class C926 { + foo() { + return 926; + } +} + +class C927 { + foo() { + return 927; + } +} + +class C928 { + foo() { + return 928; + } +} + +class C929 { + foo() { + return 929; + } +} + +class C930 { + foo() { + return 930; + } +} + +class C931 { + foo() { + return 931; + } +} + +class C932 { + foo() { + return 932; + } +} + +class C933 { + foo() { + return 933; + } +} + +class C934 { + foo() { + return 934; + } +} + +class C935 { + foo() { + return 935; + } +} + +class C936 { + foo() { + return 936; + } +} + +class C937 { + foo() { + return 937; + } +} + +class C938 { + foo() { + return 938; + } +} + +class C939 { + foo() { + return 939; + } +} + +class C940 { + foo() { + return 940; + } +} + +class C941 { + foo() { + return 941; + } +} + +class C942 { + foo() { + return 942; + } +} + +class C943 { + foo() { + return 943; + } +} + +class C944 { + foo() { + return 944; + } +} + +class C945 { + foo() { + return 945; + } +} + +class C946 { + foo() { + return 946; + } +} + +class C947 { + foo() { + return 947; + } +} + +class C948 { + foo() { + return 948; + } +} + +class C949 { + foo() { + return 949; + } +} + +class C950 { + foo() { + return 950; + } +} + +class C951 { + foo() { + return 951; + } +} + +class C952 { + foo() { + return 952; + } +} + +class C953 { + foo() { + return 953; + } +} + +class C954 { + foo() { + return 954; + } +} + +class C955 { + foo() { + return 955; + } +} + +class C956 { + foo() { + return 956; + } +} + +class C957 { + foo() { + return 957; + } +} + +class C958 { + foo() { + return 958; + } +} + +class C959 { + foo() { + return 959; + } +} + +class C960 { + foo() { + return 960; + } +} + +class C961 { + foo() { + return 961; + } +} + +class C962 { + foo() { + return 962; + } +} + +class C963 { + foo() { + return 963; + } +} + +class C964 { + foo() { + return 964; + } +} + +class C965 { + foo() { + return 965; + } +} + +class C966 { + foo() { + return 966; + } +} + +class C967 { + foo() { + return 967; + } +} + +class C968 { + foo() { + return 968; + } +} + +class C969 { + foo() { + return 969; + } +} + +class C970 { + foo() { + return 970; + } +} + +class C971 { + foo() { + return 971; + } +} + +class C972 { + foo() { + return 972; + } +} + +class C973 { + foo() { + return 973; + } +} + +class C974 { + foo() { + return 974; + } +} + +class C975 { + foo() { + return 975; + } +} + +class C976 { + foo() { + return 976; + } +} + +class C977 { + foo() { + return 977; + } +} + +class C978 { + foo() { + return 978; + } +} + +class C979 { + foo() { + return 979; + } +} + +class C980 { + foo() { + return 980; + } +} + +class C981 { + foo() { + return 981; + } +} + +class C982 { + foo() { + return 982; + } +} + +class C983 { + foo() { + return 983; + } +} + +class C984 { + foo() { + return 984; + } +} + +class C985 { + foo() { + return 985; + } +} + +class C986 { + foo() { + return 986; + } +} + +class C987 { + foo() { + return 987; + } +} + +class C988 { + foo() { + return 988; + } +} + +class C989 { + foo() { + return 989; + } +} + +class C990 { + foo() { + return 990; + } +} + +class C991 { + foo() { + return 991; + } +} + +class C992 { + foo() { + return 992; + } +} + +class C993 { + foo() { + return 993; + } +} + +class C994 { + foo() { + return 994; + } +} + +class C995 { + foo() { + return 995; + } +} + +class C996 { + foo() { + return 996; + } +} + +class C997 { + foo() { + return 997; + } +} + +class C998 { + foo() { + return 998; + } +} + +class C999 { + foo() { + return 999; + } +} + +doCallsUp() { + doCall(new C0()); + doCall(new C1()); + doCall(new C2()); + doCall(new C3()); + doCall(new C4()); + doCall(new C5()); + doCall(new C6()); + doCall(new C7()); + doCall(new C8()); + doCall(new C9()); + doCall(new C10()); + doCall(new C11()); + doCall(new C12()); + doCall(new C13()); + doCall(new C14()); + doCall(new C15()); + doCall(new C16()); + doCall(new C17()); + doCall(new C18()); + doCall(new C19()); + doCall(new C20()); + doCall(new C21()); + doCall(new C22()); + doCall(new C23()); + doCall(new C24()); + doCall(new C25()); + doCall(new C26()); + doCall(new C27()); + doCall(new C28()); + doCall(new C29()); + doCall(new C30()); + doCall(new C31()); + doCall(new C32()); + doCall(new C33()); + doCall(new C34()); + doCall(new C35()); + doCall(new C36()); + doCall(new C37()); + doCall(new C38()); + doCall(new C39()); + doCall(new C40()); + doCall(new C41()); + doCall(new C42()); + doCall(new C43()); + doCall(new C44()); + doCall(new C45()); + doCall(new C46()); + doCall(new C47()); + doCall(new C48()); + doCall(new C49()); + doCall(new C50()); + doCall(new C51()); + doCall(new C52()); + doCall(new C53()); + doCall(new C54()); + doCall(new C55()); + doCall(new C56()); + doCall(new C57()); + doCall(new C58()); + doCall(new C59()); + doCall(new C60()); + doCall(new C61()); + doCall(new C62()); + doCall(new C63()); + doCall(new C64()); + doCall(new C65()); + doCall(new C66()); + doCall(new C67()); + doCall(new C68()); + doCall(new C69()); + doCall(new C70()); + doCall(new C71()); + doCall(new C72()); + doCall(new C73()); + doCall(new C74()); + doCall(new C75()); + doCall(new C76()); + doCall(new C77()); + doCall(new C78()); + doCall(new C79()); + doCall(new C80()); + doCall(new C81()); + doCall(new C82()); + doCall(new C83()); + doCall(new C84()); + doCall(new C85()); + doCall(new C86()); + doCall(new C87()); + doCall(new C88()); + doCall(new C89()); + doCall(new C90()); + doCall(new C91()); + doCall(new C92()); + doCall(new C93()); + doCall(new C94()); + doCall(new C95()); + doCall(new C96()); + doCall(new C97()); + doCall(new C98()); + doCall(new C99()); + doCall(new C100()); + doCall(new C101()); + doCall(new C102()); + doCall(new C103()); + doCall(new C104()); + doCall(new C105()); + doCall(new C106()); + doCall(new C107()); + doCall(new C108()); + doCall(new C109()); + doCall(new C110()); + doCall(new C111()); + doCall(new C112()); + doCall(new C113()); + doCall(new C114()); + doCall(new C115()); + doCall(new C116()); + doCall(new C117()); + doCall(new C118()); + doCall(new C119()); + doCall(new C120()); + doCall(new C121()); + doCall(new C122()); + doCall(new C123()); + doCall(new C124()); + doCall(new C125()); + doCall(new C126()); + doCall(new C127()); + doCall(new C128()); + doCall(new C129()); + doCall(new C130()); + doCall(new C131()); + doCall(new C132()); + doCall(new C133()); + doCall(new C134()); + doCall(new C135()); + doCall(new C136()); + doCall(new C137()); + doCall(new C138()); + doCall(new C139()); + doCall(new C140()); + doCall(new C141()); + doCall(new C142()); + doCall(new C143()); + doCall(new C144()); + doCall(new C145()); + doCall(new C146()); + doCall(new C147()); + doCall(new C148()); + doCall(new C149()); + doCall(new C150()); + doCall(new C151()); + doCall(new C152()); + doCall(new C153()); + doCall(new C154()); + doCall(new C155()); + doCall(new C156()); + doCall(new C157()); + doCall(new C158()); + doCall(new C159()); + doCall(new C160()); + doCall(new C161()); + doCall(new C162()); + doCall(new C163()); + doCall(new C164()); + doCall(new C165()); + doCall(new C166()); + doCall(new C167()); + doCall(new C168()); + doCall(new C169()); + doCall(new C170()); + doCall(new C171()); + doCall(new C172()); + doCall(new C173()); + doCall(new C174()); + doCall(new C175()); + doCall(new C176()); + doCall(new C177()); + doCall(new C178()); + doCall(new C179()); + doCall(new C180()); + doCall(new C181()); + doCall(new C182()); + doCall(new C183()); + doCall(new C184()); + doCall(new C185()); + doCall(new C186()); + doCall(new C187()); + doCall(new C188()); + doCall(new C189()); + doCall(new C190()); + doCall(new C191()); + doCall(new C192()); + doCall(new C193()); + doCall(new C194()); + doCall(new C195()); + doCall(new C196()); + doCall(new C197()); + doCall(new C198()); + doCall(new C199()); + doCall(new C200()); + doCall(new C201()); + doCall(new C202()); + doCall(new C203()); + doCall(new C204()); + doCall(new C205()); + doCall(new C206()); + doCall(new C207()); + doCall(new C208()); + doCall(new C209()); + doCall(new C210()); + doCall(new C211()); + doCall(new C212()); + doCall(new C213()); + doCall(new C214()); + doCall(new C215()); + doCall(new C216()); + doCall(new C217()); + doCall(new C218()); + doCall(new C219()); + doCall(new C220()); + doCall(new C221()); + doCall(new C222()); + doCall(new C223()); + doCall(new C224()); + doCall(new C225()); + doCall(new C226()); + doCall(new C227()); + doCall(new C228()); + doCall(new C229()); + doCall(new C230()); + doCall(new C231()); + doCall(new C232()); + doCall(new C233()); + doCall(new C234()); + doCall(new C235()); + doCall(new C236()); + doCall(new C237()); + doCall(new C238()); + doCall(new C239()); + doCall(new C240()); + doCall(new C241()); + doCall(new C242()); + doCall(new C243()); + doCall(new C244()); + doCall(new C245()); + doCall(new C246()); + doCall(new C247()); + doCall(new C248()); + doCall(new C249()); + doCall(new C250()); + doCall(new C251()); + doCall(new C252()); + doCall(new C253()); + doCall(new C254()); + doCall(new C255()); + doCall(new C256()); + doCall(new C257()); + doCall(new C258()); + doCall(new C259()); + doCall(new C260()); + doCall(new C261()); + doCall(new C262()); + doCall(new C263()); + doCall(new C264()); + doCall(new C265()); + doCall(new C266()); + doCall(new C267()); + doCall(new C268()); + doCall(new C269()); + doCall(new C270()); + doCall(new C271()); + doCall(new C272()); + doCall(new C273()); + doCall(new C274()); + doCall(new C275()); + doCall(new C276()); + doCall(new C277()); + doCall(new C278()); + doCall(new C279()); + doCall(new C280()); + doCall(new C281()); + doCall(new C282()); + doCall(new C283()); + doCall(new C284()); + doCall(new C285()); + doCall(new C286()); + doCall(new C287()); + doCall(new C288()); + doCall(new C289()); + doCall(new C290()); + doCall(new C291()); + doCall(new C292()); + doCall(new C293()); + doCall(new C294()); + doCall(new C295()); + doCall(new C296()); + doCall(new C297()); + doCall(new C298()); + doCall(new C299()); + doCall(new C300()); + doCall(new C301()); + doCall(new C302()); + doCall(new C303()); + doCall(new C304()); + doCall(new C305()); + doCall(new C306()); + doCall(new C307()); + doCall(new C308()); + doCall(new C309()); + doCall(new C310()); + doCall(new C311()); + doCall(new C312()); + doCall(new C313()); + doCall(new C314()); + doCall(new C315()); + doCall(new C316()); + doCall(new C317()); + doCall(new C318()); + doCall(new C319()); + doCall(new C320()); + doCall(new C321()); + doCall(new C322()); + doCall(new C323()); + doCall(new C324()); + doCall(new C325()); + doCall(new C326()); + doCall(new C327()); + doCall(new C328()); + doCall(new C329()); + doCall(new C330()); + doCall(new C331()); + doCall(new C332()); + doCall(new C333()); + doCall(new C334()); + doCall(new C335()); + doCall(new C336()); + doCall(new C337()); + doCall(new C338()); + doCall(new C339()); + doCall(new C340()); + doCall(new C341()); + doCall(new C342()); + doCall(new C343()); + doCall(new C344()); + doCall(new C345()); + doCall(new C346()); + doCall(new C347()); + doCall(new C348()); + doCall(new C349()); + doCall(new C350()); + doCall(new C351()); + doCall(new C352()); + doCall(new C353()); + doCall(new C354()); + doCall(new C355()); + doCall(new C356()); + doCall(new C357()); + doCall(new C358()); + doCall(new C359()); + doCall(new C360()); + doCall(new C361()); + doCall(new C362()); + doCall(new C363()); + doCall(new C364()); + doCall(new C365()); + doCall(new C366()); + doCall(new C367()); + doCall(new C368()); + doCall(new C369()); + doCall(new C370()); + doCall(new C371()); + doCall(new C372()); + doCall(new C373()); + doCall(new C374()); + doCall(new C375()); + doCall(new C376()); + doCall(new C377()); + doCall(new C378()); + doCall(new C379()); + doCall(new C380()); + doCall(new C381()); + doCall(new C382()); + doCall(new C383()); + doCall(new C384()); + doCall(new C385()); + doCall(new C386()); + doCall(new C387()); + doCall(new C388()); + doCall(new C389()); + doCall(new C390()); + doCall(new C391()); + doCall(new C392()); + doCall(new C393()); + doCall(new C394()); + doCall(new C395()); + doCall(new C396()); + doCall(new C397()); + doCall(new C398()); + doCall(new C399()); + doCall(new C400()); + doCall(new C401()); + doCall(new C402()); + doCall(new C403()); + doCall(new C404()); + doCall(new C405()); + doCall(new C406()); + doCall(new C407()); + doCall(new C408()); + doCall(new C409()); + doCall(new C410()); + doCall(new C411()); + doCall(new C412()); + doCall(new C413()); + doCall(new C414()); + doCall(new C415()); + doCall(new C416()); + doCall(new C417()); + doCall(new C418()); + doCall(new C419()); + doCall(new C420()); + doCall(new C421()); + doCall(new C422()); + doCall(new C423()); + doCall(new C424()); + doCall(new C425()); + doCall(new C426()); + doCall(new C427()); + doCall(new C428()); + doCall(new C429()); + doCall(new C430()); + doCall(new C431()); + doCall(new C432()); + doCall(new C433()); + doCall(new C434()); + doCall(new C435()); + doCall(new C436()); + doCall(new C437()); + doCall(new C438()); + doCall(new C439()); + doCall(new C440()); + doCall(new C441()); + doCall(new C442()); + doCall(new C443()); + doCall(new C444()); + doCall(new C445()); + doCall(new C446()); + doCall(new C447()); + doCall(new C448()); + doCall(new C449()); + doCall(new C450()); + doCall(new C451()); + doCall(new C452()); + doCall(new C453()); + doCall(new C454()); + doCall(new C455()); + doCall(new C456()); + doCall(new C457()); + doCall(new C458()); + doCall(new C459()); + doCall(new C460()); + doCall(new C461()); + doCall(new C462()); + doCall(new C463()); + doCall(new C464()); + doCall(new C465()); + doCall(new C466()); + doCall(new C467()); + doCall(new C468()); + doCall(new C469()); + doCall(new C470()); + doCall(new C471()); + doCall(new C472()); + doCall(new C473()); + doCall(new C474()); + doCall(new C475()); + doCall(new C476()); + doCall(new C477()); + doCall(new C478()); + doCall(new C479()); + doCall(new C480()); + doCall(new C481()); + doCall(new C482()); + doCall(new C483()); + doCall(new C484()); + doCall(new C485()); + doCall(new C486()); + doCall(new C487()); + doCall(new C488()); + doCall(new C489()); + doCall(new C490()); + doCall(new C491()); + doCall(new C492()); + doCall(new C493()); + doCall(new C494()); + doCall(new C495()); + doCall(new C496()); + doCall(new C497()); + doCall(new C498()); + doCall(new C499()); + doCall(new C500()); + doCall(new C501()); + doCall(new C502()); + doCall(new C503()); + doCall(new C504()); + doCall(new C505()); + doCall(new C506()); + doCall(new C507()); + doCall(new C508()); + doCall(new C509()); + doCall(new C510()); + doCall(new C511()); + doCall(new C512()); + doCall(new C513()); + doCall(new C514()); + doCall(new C515()); + doCall(new C516()); + doCall(new C517()); + doCall(new C518()); + doCall(new C519()); + doCall(new C520()); + doCall(new C521()); + doCall(new C522()); + doCall(new C523()); + doCall(new C524()); + doCall(new C525()); + doCall(new C526()); + doCall(new C527()); + doCall(new C528()); + doCall(new C529()); + doCall(new C530()); + doCall(new C531()); + doCall(new C532()); + doCall(new C533()); + doCall(new C534()); + doCall(new C535()); + doCall(new C536()); + doCall(new C537()); + doCall(new C538()); + doCall(new C539()); + doCall(new C540()); + doCall(new C541()); + doCall(new C542()); + doCall(new C543()); + doCall(new C544()); + doCall(new C545()); + doCall(new C546()); + doCall(new C547()); + doCall(new C548()); + doCall(new C549()); + doCall(new C550()); + doCall(new C551()); + doCall(new C552()); + doCall(new C553()); + doCall(new C554()); + doCall(new C555()); + doCall(new C556()); + doCall(new C557()); + doCall(new C558()); + doCall(new C559()); + doCall(new C560()); + doCall(new C561()); + doCall(new C562()); + doCall(new C563()); + doCall(new C564()); + doCall(new C565()); + doCall(new C566()); + doCall(new C567()); + doCall(new C568()); + doCall(new C569()); + doCall(new C570()); + doCall(new C571()); + doCall(new C572()); + doCall(new C573()); + doCall(new C574()); + doCall(new C575()); + doCall(new C576()); + doCall(new C577()); + doCall(new C578()); + doCall(new C579()); + doCall(new C580()); + doCall(new C581()); + doCall(new C582()); + doCall(new C583()); + doCall(new C584()); + doCall(new C585()); + doCall(new C586()); + doCall(new C587()); + doCall(new C588()); + doCall(new C589()); + doCall(new C590()); + doCall(new C591()); + doCall(new C592()); + doCall(new C593()); + doCall(new C594()); + doCall(new C595()); + doCall(new C596()); + doCall(new C597()); + doCall(new C598()); + doCall(new C599()); + doCall(new C600()); + doCall(new C601()); + doCall(new C602()); + doCall(new C603()); + doCall(new C604()); + doCall(new C605()); + doCall(new C606()); + doCall(new C607()); + doCall(new C608()); + doCall(new C609()); + doCall(new C610()); + doCall(new C611()); + doCall(new C612()); + doCall(new C613()); + doCall(new C614()); + doCall(new C615()); + doCall(new C616()); + doCall(new C617()); + doCall(new C618()); + doCall(new C619()); + doCall(new C620()); + doCall(new C621()); + doCall(new C622()); + doCall(new C623()); + doCall(new C624()); + doCall(new C625()); + doCall(new C626()); + doCall(new C627()); + doCall(new C628()); + doCall(new C629()); + doCall(new C630()); + doCall(new C631()); + doCall(new C632()); + doCall(new C633()); + doCall(new C634()); + doCall(new C635()); + doCall(new C636()); + doCall(new C637()); + doCall(new C638()); + doCall(new C639()); + doCall(new C640()); + doCall(new C641()); + doCall(new C642()); + doCall(new C643()); + doCall(new C644()); + doCall(new C645()); + doCall(new C646()); + doCall(new C647()); + doCall(new C648()); + doCall(new C649()); + doCall(new C650()); + doCall(new C651()); + doCall(new C652()); + doCall(new C653()); + doCall(new C654()); + doCall(new C655()); + doCall(new C656()); + doCall(new C657()); + doCall(new C658()); + doCall(new C659()); + doCall(new C660()); + doCall(new C661()); + doCall(new C662()); + doCall(new C663()); + doCall(new C664()); + doCall(new C665()); + doCall(new C666()); + doCall(new C667()); + doCall(new C668()); + doCall(new C669()); + doCall(new C670()); + doCall(new C671()); + doCall(new C672()); + doCall(new C673()); + doCall(new C674()); + doCall(new C675()); + doCall(new C676()); + doCall(new C677()); + doCall(new C678()); + doCall(new C679()); + doCall(new C680()); + doCall(new C681()); + doCall(new C682()); + doCall(new C683()); + doCall(new C684()); + doCall(new C685()); + doCall(new C686()); + doCall(new C687()); + doCall(new C688()); + doCall(new C689()); + doCall(new C690()); + doCall(new C691()); + doCall(new C692()); + doCall(new C693()); + doCall(new C694()); + doCall(new C695()); + doCall(new C696()); + doCall(new C697()); + doCall(new C698()); + doCall(new C699()); + doCall(new C700()); + doCall(new C701()); + doCall(new C702()); + doCall(new C703()); + doCall(new C704()); + doCall(new C705()); + doCall(new C706()); + doCall(new C707()); + doCall(new C708()); + doCall(new C709()); + doCall(new C710()); + doCall(new C711()); + doCall(new C712()); + doCall(new C713()); + doCall(new C714()); + doCall(new C715()); + doCall(new C716()); + doCall(new C717()); + doCall(new C718()); + doCall(new C719()); + doCall(new C720()); + doCall(new C721()); + doCall(new C722()); + doCall(new C723()); + doCall(new C724()); + doCall(new C725()); + doCall(new C726()); + doCall(new C727()); + doCall(new C728()); + doCall(new C729()); + doCall(new C730()); + doCall(new C731()); + doCall(new C732()); + doCall(new C733()); + doCall(new C734()); + doCall(new C735()); + doCall(new C736()); + doCall(new C737()); + doCall(new C738()); + doCall(new C739()); + doCall(new C740()); + doCall(new C741()); + doCall(new C742()); + doCall(new C743()); + doCall(new C744()); + doCall(new C745()); + doCall(new C746()); + doCall(new C747()); + doCall(new C748()); + doCall(new C749()); + doCall(new C750()); + doCall(new C751()); + doCall(new C752()); + doCall(new C753()); + doCall(new C754()); + doCall(new C755()); + doCall(new C756()); + doCall(new C757()); + doCall(new C758()); + doCall(new C759()); + doCall(new C760()); + doCall(new C761()); + doCall(new C762()); + doCall(new C763()); + doCall(new C764()); + doCall(new C765()); + doCall(new C766()); + doCall(new C767()); + doCall(new C768()); + doCall(new C769()); + doCall(new C770()); + doCall(new C771()); + doCall(new C772()); + doCall(new C773()); + doCall(new C774()); + doCall(new C775()); + doCall(new C776()); + doCall(new C777()); + doCall(new C778()); + doCall(new C779()); + doCall(new C780()); + doCall(new C781()); + doCall(new C782()); + doCall(new C783()); + doCall(new C784()); + doCall(new C785()); + doCall(new C786()); + doCall(new C787()); + doCall(new C788()); + doCall(new C789()); + doCall(new C790()); + doCall(new C791()); + doCall(new C792()); + doCall(new C793()); + doCall(new C794()); + doCall(new C795()); + doCall(new C796()); + doCall(new C797()); + doCall(new C798()); + doCall(new C799()); + doCall(new C800()); + doCall(new C801()); + doCall(new C802()); + doCall(new C803()); + doCall(new C804()); + doCall(new C805()); + doCall(new C806()); + doCall(new C807()); + doCall(new C808()); + doCall(new C809()); + doCall(new C810()); + doCall(new C811()); + doCall(new C812()); + doCall(new C813()); + doCall(new C814()); + doCall(new C815()); + doCall(new C816()); + doCall(new C817()); + doCall(new C818()); + doCall(new C819()); + doCall(new C820()); + doCall(new C821()); + doCall(new C822()); + doCall(new C823()); + doCall(new C824()); + doCall(new C825()); + doCall(new C826()); + doCall(new C827()); + doCall(new C828()); + doCall(new C829()); + doCall(new C830()); + doCall(new C831()); + doCall(new C832()); + doCall(new C833()); + doCall(new C834()); + doCall(new C835()); + doCall(new C836()); + doCall(new C837()); + doCall(new C838()); + doCall(new C839()); + doCall(new C840()); + doCall(new C841()); + doCall(new C842()); + doCall(new C843()); + doCall(new C844()); + doCall(new C845()); + doCall(new C846()); + doCall(new C847()); + doCall(new C848()); + doCall(new C849()); + doCall(new C850()); + doCall(new C851()); + doCall(new C852()); + doCall(new C853()); + doCall(new C854()); + doCall(new C855()); + doCall(new C856()); + doCall(new C857()); + doCall(new C858()); + doCall(new C859()); + doCall(new C860()); + doCall(new C861()); + doCall(new C862()); + doCall(new C863()); + doCall(new C864()); + doCall(new C865()); + doCall(new C866()); + doCall(new C867()); + doCall(new C868()); + doCall(new C869()); + doCall(new C870()); + doCall(new C871()); + doCall(new C872()); + doCall(new C873()); + doCall(new C874()); + doCall(new C875()); + doCall(new C876()); + doCall(new C877()); + doCall(new C878()); + doCall(new C879()); + doCall(new C880()); + doCall(new C881()); + doCall(new C882()); + doCall(new C883()); + doCall(new C884()); + doCall(new C885()); + doCall(new C886()); + doCall(new C887()); + doCall(new C888()); + doCall(new C889()); + doCall(new C890()); + doCall(new C891()); + doCall(new C892()); + doCall(new C893()); + doCall(new C894()); + doCall(new C895()); + doCall(new C896()); + doCall(new C897()); + doCall(new C898()); + doCall(new C899()); + doCall(new C900()); + doCall(new C901()); + doCall(new C902()); + doCall(new C903()); + doCall(new C904()); + doCall(new C905()); + doCall(new C906()); + doCall(new C907()); + doCall(new C908()); + doCall(new C909()); + doCall(new C910()); + doCall(new C911()); + doCall(new C912()); + doCall(new C913()); + doCall(new C914()); + doCall(new C915()); + doCall(new C916()); + doCall(new C917()); + doCall(new C918()); + doCall(new C919()); + doCall(new C920()); + doCall(new C921()); + doCall(new C922()); + doCall(new C923()); + doCall(new C924()); + doCall(new C925()); + doCall(new C926()); + doCall(new C927()); + doCall(new C928()); + doCall(new C929()); + doCall(new C930()); + doCall(new C931()); + doCall(new C932()); + doCall(new C933()); + doCall(new C934()); + doCall(new C935()); + doCall(new C936()); + doCall(new C937()); + doCall(new C938()); + doCall(new C939()); + doCall(new C940()); + doCall(new C941()); + doCall(new C942()); + doCall(new C943()); + doCall(new C944()); + doCall(new C945()); + doCall(new C946()); + doCall(new C947()); + doCall(new C948()); + doCall(new C949()); + doCall(new C950()); + doCall(new C951()); + doCall(new C952()); + doCall(new C953()); + doCall(new C954()); + doCall(new C955()); + doCall(new C956()); + doCall(new C957()); + doCall(new C958()); + doCall(new C959()); + doCall(new C960()); + doCall(new C961()); + doCall(new C962()); + doCall(new C963()); + doCall(new C964()); + doCall(new C965()); + doCall(new C966()); + doCall(new C967()); + doCall(new C968()); + doCall(new C969()); + doCall(new C970()); + doCall(new C971()); + doCall(new C972()); + doCall(new C973()); + doCall(new C974()); + doCall(new C975()); + doCall(new C976()); + doCall(new C977()); + doCall(new C978()); + doCall(new C979()); + doCall(new C980()); + doCall(new C981()); + doCall(new C982()); + doCall(new C983()); + doCall(new C984()); + doCall(new C985()); + doCall(new C986()); + doCall(new C987()); + doCall(new C988()); + doCall(new C989()); + doCall(new C990()); + doCall(new C991()); + doCall(new C992()); + doCall(new C993()); + doCall(new C994()); + doCall(new C995()); + doCall(new C996()); + doCall(new C997()); + doCall(new C998()); + doCall(new C999()); +} + +doCallsDown() { + doCall(new C999()); + doCall(new C999()); + doCall(new C998()); + doCall(new C997()); + doCall(new C996()); + doCall(new C995()); + doCall(new C994()); + doCall(new C993()); + doCall(new C992()); + doCall(new C991()); + doCall(new C990()); + doCall(new C989()); + doCall(new C988()); + doCall(new C987()); + doCall(new C986()); + doCall(new C985()); + doCall(new C984()); + doCall(new C983()); + doCall(new C982()); + doCall(new C981()); + doCall(new C980()); + doCall(new C979()); + doCall(new C978()); + doCall(new C977()); + doCall(new C976()); + doCall(new C975()); + doCall(new C974()); + doCall(new C973()); + doCall(new C972()); + doCall(new C971()); + doCall(new C970()); + doCall(new C969()); + doCall(new C968()); + doCall(new C967()); + doCall(new C966()); + doCall(new C965()); + doCall(new C964()); + doCall(new C963()); + doCall(new C962()); + doCall(new C961()); + doCall(new C960()); + doCall(new C959()); + doCall(new C958()); + doCall(new C957()); + doCall(new C956()); + doCall(new C955()); + doCall(new C954()); + doCall(new C953()); + doCall(new C952()); + doCall(new C951()); + doCall(new C950()); + doCall(new C949()); + doCall(new C948()); + doCall(new C947()); + doCall(new C946()); + doCall(new C945()); + doCall(new C944()); + doCall(new C943()); + doCall(new C942()); + doCall(new C941()); + doCall(new C940()); + doCall(new C939()); + doCall(new C938()); + doCall(new C937()); + doCall(new C936()); + doCall(new C935()); + doCall(new C934()); + doCall(new C933()); + doCall(new C932()); + doCall(new C931()); + doCall(new C930()); + doCall(new C929()); + doCall(new C928()); + doCall(new C927()); + doCall(new C926()); + doCall(new C925()); + doCall(new C924()); + doCall(new C923()); + doCall(new C922()); + doCall(new C921()); + doCall(new C920()); + doCall(new C919()); + doCall(new C918()); + doCall(new C917()); + doCall(new C916()); + doCall(new C915()); + doCall(new C914()); + doCall(new C913()); + doCall(new C912()); + doCall(new C911()); + doCall(new C910()); + doCall(new C909()); + doCall(new C908()); + doCall(new C907()); + doCall(new C906()); + doCall(new C905()); + doCall(new C904()); + doCall(new C903()); + doCall(new C902()); + doCall(new C901()); + doCall(new C900()); + doCall(new C899()); + doCall(new C898()); + doCall(new C897()); + doCall(new C896()); + doCall(new C895()); + doCall(new C894()); + doCall(new C893()); + doCall(new C892()); + doCall(new C891()); + doCall(new C890()); + doCall(new C889()); + doCall(new C888()); + doCall(new C887()); + doCall(new C886()); + doCall(new C885()); + doCall(new C884()); + doCall(new C883()); + doCall(new C882()); + doCall(new C881()); + doCall(new C880()); + doCall(new C879()); + doCall(new C878()); + doCall(new C877()); + doCall(new C876()); + doCall(new C875()); + doCall(new C874()); + doCall(new C873()); + doCall(new C872()); + doCall(new C871()); + doCall(new C870()); + doCall(new C869()); + doCall(new C868()); + doCall(new C867()); + doCall(new C866()); + doCall(new C865()); + doCall(new C864()); + doCall(new C863()); + doCall(new C862()); + doCall(new C861()); + doCall(new C860()); + doCall(new C859()); + doCall(new C858()); + doCall(new C857()); + doCall(new C856()); + doCall(new C855()); + doCall(new C854()); + doCall(new C853()); + doCall(new C852()); + doCall(new C851()); + doCall(new C850()); + doCall(new C849()); + doCall(new C848()); + doCall(new C847()); + doCall(new C846()); + doCall(new C845()); + doCall(new C844()); + doCall(new C843()); + doCall(new C842()); + doCall(new C841()); + doCall(new C840()); + doCall(new C839()); + doCall(new C838()); + doCall(new C837()); + doCall(new C836()); + doCall(new C835()); + doCall(new C834()); + doCall(new C833()); + doCall(new C832()); + doCall(new C831()); + doCall(new C830()); + doCall(new C829()); + doCall(new C828()); + doCall(new C827()); + doCall(new C826()); + doCall(new C825()); + doCall(new C824()); + doCall(new C823()); + doCall(new C822()); + doCall(new C821()); + doCall(new C820()); + doCall(new C819()); + doCall(new C818()); + doCall(new C817()); + doCall(new C816()); + doCall(new C815()); + doCall(new C814()); + doCall(new C813()); + doCall(new C812()); + doCall(new C811()); + doCall(new C810()); + doCall(new C809()); + doCall(new C808()); + doCall(new C807()); + doCall(new C806()); + doCall(new C805()); + doCall(new C804()); + doCall(new C803()); + doCall(new C802()); + doCall(new C801()); + doCall(new C800()); + doCall(new C799()); + doCall(new C798()); + doCall(new C797()); + doCall(new C796()); + doCall(new C795()); + doCall(new C794()); + doCall(new C793()); + doCall(new C792()); + doCall(new C791()); + doCall(new C790()); + doCall(new C789()); + doCall(new C788()); + doCall(new C787()); + doCall(new C786()); + doCall(new C785()); + doCall(new C784()); + doCall(new C783()); + doCall(new C782()); + doCall(new C781()); + doCall(new C780()); + doCall(new C779()); + doCall(new C778()); + doCall(new C777()); + doCall(new C776()); + doCall(new C775()); + doCall(new C774()); + doCall(new C773()); + doCall(new C772()); + doCall(new C771()); + doCall(new C770()); + doCall(new C769()); + doCall(new C768()); + doCall(new C767()); + doCall(new C766()); + doCall(new C765()); + doCall(new C764()); + doCall(new C763()); + doCall(new C762()); + doCall(new C761()); + doCall(new C760()); + doCall(new C759()); + doCall(new C758()); + doCall(new C757()); + doCall(new C756()); + doCall(new C755()); + doCall(new C754()); + doCall(new C753()); + doCall(new C752()); + doCall(new C751()); + doCall(new C750()); + doCall(new C749()); + doCall(new C748()); + doCall(new C747()); + doCall(new C746()); + doCall(new C745()); + doCall(new C744()); + doCall(new C743()); + doCall(new C742()); + doCall(new C741()); + doCall(new C740()); + doCall(new C739()); + doCall(new C738()); + doCall(new C737()); + doCall(new C736()); + doCall(new C735()); + doCall(new C734()); + doCall(new C733()); + doCall(new C732()); + doCall(new C731()); + doCall(new C730()); + doCall(new C729()); + doCall(new C728()); + doCall(new C727()); + doCall(new C726()); + doCall(new C725()); + doCall(new C724()); + doCall(new C723()); + doCall(new C722()); + doCall(new C721()); + doCall(new C720()); + doCall(new C719()); + doCall(new C718()); + doCall(new C717()); + doCall(new C716()); + doCall(new C715()); + doCall(new C714()); + doCall(new C713()); + doCall(new C712()); + doCall(new C711()); + doCall(new C710()); + doCall(new C709()); + doCall(new C708()); + doCall(new C707()); + doCall(new C706()); + doCall(new C705()); + doCall(new C704()); + doCall(new C703()); + doCall(new C702()); + doCall(new C701()); + doCall(new C700()); + doCall(new C699()); + doCall(new C698()); + doCall(new C697()); + doCall(new C696()); + doCall(new C695()); + doCall(new C694()); + doCall(new C693()); + doCall(new C692()); + doCall(new C691()); + doCall(new C690()); + doCall(new C689()); + doCall(new C688()); + doCall(new C687()); + doCall(new C686()); + doCall(new C685()); + doCall(new C684()); + doCall(new C683()); + doCall(new C682()); + doCall(new C681()); + doCall(new C680()); + doCall(new C679()); + doCall(new C678()); + doCall(new C677()); + doCall(new C676()); + doCall(new C675()); + doCall(new C674()); + doCall(new C673()); + doCall(new C672()); + doCall(new C671()); + doCall(new C670()); + doCall(new C669()); + doCall(new C668()); + doCall(new C667()); + doCall(new C666()); + doCall(new C665()); + doCall(new C664()); + doCall(new C663()); + doCall(new C662()); + doCall(new C661()); + doCall(new C660()); + doCall(new C659()); + doCall(new C658()); + doCall(new C657()); + doCall(new C656()); + doCall(new C655()); + doCall(new C654()); + doCall(new C653()); + doCall(new C652()); + doCall(new C651()); + doCall(new C650()); + doCall(new C649()); + doCall(new C648()); + doCall(new C647()); + doCall(new C646()); + doCall(new C645()); + doCall(new C644()); + doCall(new C643()); + doCall(new C642()); + doCall(new C641()); + doCall(new C640()); + doCall(new C639()); + doCall(new C638()); + doCall(new C637()); + doCall(new C636()); + doCall(new C635()); + doCall(new C634()); + doCall(new C633()); + doCall(new C632()); + doCall(new C631()); + doCall(new C630()); + doCall(new C629()); + doCall(new C628()); + doCall(new C627()); + doCall(new C626()); + doCall(new C625()); + doCall(new C624()); + doCall(new C623()); + doCall(new C622()); + doCall(new C621()); + doCall(new C620()); + doCall(new C619()); + doCall(new C618()); + doCall(new C617()); + doCall(new C616()); + doCall(new C615()); + doCall(new C614()); + doCall(new C613()); + doCall(new C612()); + doCall(new C611()); + doCall(new C610()); + doCall(new C609()); + doCall(new C608()); + doCall(new C607()); + doCall(new C606()); + doCall(new C605()); + doCall(new C604()); + doCall(new C603()); + doCall(new C602()); + doCall(new C601()); + doCall(new C600()); + doCall(new C599()); + doCall(new C598()); + doCall(new C597()); + doCall(new C596()); + doCall(new C595()); + doCall(new C594()); + doCall(new C593()); + doCall(new C592()); + doCall(new C591()); + doCall(new C590()); + doCall(new C589()); + doCall(new C588()); + doCall(new C587()); + doCall(new C586()); + doCall(new C585()); + doCall(new C584()); + doCall(new C583()); + doCall(new C582()); + doCall(new C581()); + doCall(new C580()); + doCall(new C579()); + doCall(new C578()); + doCall(new C577()); + doCall(new C576()); + doCall(new C575()); + doCall(new C574()); + doCall(new C573()); + doCall(new C572()); + doCall(new C571()); + doCall(new C570()); + doCall(new C569()); + doCall(new C568()); + doCall(new C567()); + doCall(new C566()); + doCall(new C565()); + doCall(new C564()); + doCall(new C563()); + doCall(new C562()); + doCall(new C561()); + doCall(new C560()); + doCall(new C559()); + doCall(new C558()); + doCall(new C557()); + doCall(new C556()); + doCall(new C555()); + doCall(new C554()); + doCall(new C553()); + doCall(new C552()); + doCall(new C551()); + doCall(new C550()); + doCall(new C549()); + doCall(new C548()); + doCall(new C547()); + doCall(new C546()); + doCall(new C545()); + doCall(new C544()); + doCall(new C543()); + doCall(new C542()); + doCall(new C541()); + doCall(new C540()); + doCall(new C539()); + doCall(new C538()); + doCall(new C537()); + doCall(new C536()); + doCall(new C535()); + doCall(new C534()); + doCall(new C533()); + doCall(new C532()); + doCall(new C531()); + doCall(new C530()); + doCall(new C529()); + doCall(new C528()); + doCall(new C527()); + doCall(new C526()); + doCall(new C525()); + doCall(new C524()); + doCall(new C523()); + doCall(new C522()); + doCall(new C521()); + doCall(new C520()); + doCall(new C519()); + doCall(new C518()); + doCall(new C517()); + doCall(new C516()); + doCall(new C515()); + doCall(new C514()); + doCall(new C513()); + doCall(new C512()); + doCall(new C511()); + doCall(new C510()); + doCall(new C509()); + doCall(new C508()); + doCall(new C507()); + doCall(new C506()); + doCall(new C505()); + doCall(new C504()); + doCall(new C503()); + doCall(new C502()); + doCall(new C501()); + doCall(new C500()); + doCall(new C499()); + doCall(new C498()); + doCall(new C497()); + doCall(new C496()); + doCall(new C495()); + doCall(new C494()); + doCall(new C493()); + doCall(new C492()); + doCall(new C491()); + doCall(new C490()); + doCall(new C489()); + doCall(new C488()); + doCall(new C487()); + doCall(new C486()); + doCall(new C485()); + doCall(new C484()); + doCall(new C483()); + doCall(new C482()); + doCall(new C481()); + doCall(new C480()); + doCall(new C479()); + doCall(new C478()); + doCall(new C477()); + doCall(new C476()); + doCall(new C475()); + doCall(new C474()); + doCall(new C473()); + doCall(new C472()); + doCall(new C471()); + doCall(new C470()); + doCall(new C469()); + doCall(new C468()); + doCall(new C467()); + doCall(new C466()); + doCall(new C465()); + doCall(new C464()); + doCall(new C463()); + doCall(new C462()); + doCall(new C461()); + doCall(new C460()); + doCall(new C459()); + doCall(new C458()); + doCall(new C457()); + doCall(new C456()); + doCall(new C455()); + doCall(new C454()); + doCall(new C453()); + doCall(new C452()); + doCall(new C451()); + doCall(new C450()); + doCall(new C449()); + doCall(new C448()); + doCall(new C447()); + doCall(new C446()); + doCall(new C445()); + doCall(new C444()); + doCall(new C443()); + doCall(new C442()); + doCall(new C441()); + doCall(new C440()); + doCall(new C439()); + doCall(new C438()); + doCall(new C437()); + doCall(new C436()); + doCall(new C435()); + doCall(new C434()); + doCall(new C433()); + doCall(new C432()); + doCall(new C431()); + doCall(new C430()); + doCall(new C429()); + doCall(new C428()); + doCall(new C427()); + doCall(new C426()); + doCall(new C425()); + doCall(new C424()); + doCall(new C423()); + doCall(new C422()); + doCall(new C421()); + doCall(new C420()); + doCall(new C419()); + doCall(new C418()); + doCall(new C417()); + doCall(new C416()); + doCall(new C415()); + doCall(new C414()); + doCall(new C413()); + doCall(new C412()); + doCall(new C411()); + doCall(new C410()); + doCall(new C409()); + doCall(new C408()); + doCall(new C407()); + doCall(new C406()); + doCall(new C405()); + doCall(new C404()); + doCall(new C403()); + doCall(new C402()); + doCall(new C401()); + doCall(new C400()); + doCall(new C399()); + doCall(new C398()); + doCall(new C397()); + doCall(new C396()); + doCall(new C395()); + doCall(new C394()); + doCall(new C393()); + doCall(new C392()); + doCall(new C391()); + doCall(new C390()); + doCall(new C389()); + doCall(new C388()); + doCall(new C387()); + doCall(new C386()); + doCall(new C385()); + doCall(new C384()); + doCall(new C383()); + doCall(new C382()); + doCall(new C381()); + doCall(new C380()); + doCall(new C379()); + doCall(new C378()); + doCall(new C377()); + doCall(new C376()); + doCall(new C375()); + doCall(new C374()); + doCall(new C373()); + doCall(new C372()); + doCall(new C371()); + doCall(new C370()); + doCall(new C369()); + doCall(new C368()); + doCall(new C367()); + doCall(new C366()); + doCall(new C365()); + doCall(new C364()); + doCall(new C363()); + doCall(new C362()); + doCall(new C361()); + doCall(new C360()); + doCall(new C359()); + doCall(new C358()); + doCall(new C357()); + doCall(new C356()); + doCall(new C355()); + doCall(new C354()); + doCall(new C353()); + doCall(new C352()); + doCall(new C351()); + doCall(new C350()); + doCall(new C349()); + doCall(new C348()); + doCall(new C347()); + doCall(new C346()); + doCall(new C345()); + doCall(new C344()); + doCall(new C343()); + doCall(new C342()); + doCall(new C341()); + doCall(new C340()); + doCall(new C339()); + doCall(new C338()); + doCall(new C337()); + doCall(new C336()); + doCall(new C335()); + doCall(new C334()); + doCall(new C333()); + doCall(new C332()); + doCall(new C331()); + doCall(new C330()); + doCall(new C329()); + doCall(new C328()); + doCall(new C327()); + doCall(new C326()); + doCall(new C325()); + doCall(new C324()); + doCall(new C323()); + doCall(new C322()); + doCall(new C321()); + doCall(new C320()); + doCall(new C319()); + doCall(new C318()); + doCall(new C317()); + doCall(new C316()); + doCall(new C315()); + doCall(new C314()); + doCall(new C313()); + doCall(new C312()); + doCall(new C311()); + doCall(new C310()); + doCall(new C309()); + doCall(new C308()); + doCall(new C307()); + doCall(new C306()); + doCall(new C305()); + doCall(new C304()); + doCall(new C303()); + doCall(new C302()); + doCall(new C301()); + doCall(new C300()); + doCall(new C299()); + doCall(new C298()); + doCall(new C297()); + doCall(new C296()); + doCall(new C295()); + doCall(new C294()); + doCall(new C293()); + doCall(new C292()); + doCall(new C291()); + doCall(new C290()); + doCall(new C289()); + doCall(new C288()); + doCall(new C287()); + doCall(new C286()); + doCall(new C285()); + doCall(new C284()); + doCall(new C283()); + doCall(new C282()); + doCall(new C281()); + doCall(new C280()); + doCall(new C279()); + doCall(new C278()); + doCall(new C277()); + doCall(new C276()); + doCall(new C275()); + doCall(new C274()); + doCall(new C273()); + doCall(new C272()); + doCall(new C271()); + doCall(new C270()); + doCall(new C269()); + doCall(new C268()); + doCall(new C267()); + doCall(new C266()); + doCall(new C265()); + doCall(new C264()); + doCall(new C263()); + doCall(new C262()); + doCall(new C261()); + doCall(new C260()); + doCall(new C259()); + doCall(new C258()); + doCall(new C257()); + doCall(new C256()); + doCall(new C255()); + doCall(new C254()); + doCall(new C253()); + doCall(new C252()); + doCall(new C251()); + doCall(new C250()); + doCall(new C249()); + doCall(new C248()); + doCall(new C247()); + doCall(new C246()); + doCall(new C245()); + doCall(new C244()); + doCall(new C243()); + doCall(new C242()); + doCall(new C241()); + doCall(new C240()); + doCall(new C239()); + doCall(new C238()); + doCall(new C237()); + doCall(new C236()); + doCall(new C235()); + doCall(new C234()); + doCall(new C233()); + doCall(new C232()); + doCall(new C231()); + doCall(new C230()); + doCall(new C229()); + doCall(new C228()); + doCall(new C227()); + doCall(new C226()); + doCall(new C225()); + doCall(new C224()); + doCall(new C223()); + doCall(new C222()); + doCall(new C221()); + doCall(new C220()); + doCall(new C219()); + doCall(new C218()); + doCall(new C217()); + doCall(new C216()); + doCall(new C215()); + doCall(new C214()); + doCall(new C213()); + doCall(new C212()); + doCall(new C211()); + doCall(new C210()); + doCall(new C209()); + doCall(new C208()); + doCall(new C207()); + doCall(new C206()); + doCall(new C205()); + doCall(new C204()); + doCall(new C203()); + doCall(new C202()); + doCall(new C201()); + doCall(new C200()); + doCall(new C199()); + doCall(new C198()); + doCall(new C197()); + doCall(new C196()); + doCall(new C195()); + doCall(new C194()); + doCall(new C193()); + doCall(new C192()); + doCall(new C191()); + doCall(new C190()); + doCall(new C189()); + doCall(new C188()); + doCall(new C187()); + doCall(new C186()); + doCall(new C185()); + doCall(new C184()); + doCall(new C183()); + doCall(new C182()); + doCall(new C181()); + doCall(new C180()); + doCall(new C179()); + doCall(new C178()); + doCall(new C177()); + doCall(new C176()); + doCall(new C175()); + doCall(new C174()); + doCall(new C173()); + doCall(new C172()); + doCall(new C171()); + doCall(new C170()); + doCall(new C169()); + doCall(new C168()); + doCall(new C167()); + doCall(new C166()); + doCall(new C165()); + doCall(new C164()); + doCall(new C163()); + doCall(new C162()); + doCall(new C161()); + doCall(new C160()); + doCall(new C159()); + doCall(new C158()); + doCall(new C157()); + doCall(new C156()); + doCall(new C155()); + doCall(new C154()); + doCall(new C153()); + doCall(new C152()); + doCall(new C151()); + doCall(new C150()); + doCall(new C149()); + doCall(new C148()); + doCall(new C147()); + doCall(new C146()); + doCall(new C145()); + doCall(new C144()); + doCall(new C143()); + doCall(new C142()); + doCall(new C141()); + doCall(new C140()); + doCall(new C139()); + doCall(new C138()); + doCall(new C137()); + doCall(new C136()); + doCall(new C135()); + doCall(new C134()); + doCall(new C133()); + doCall(new C132()); + doCall(new C131()); + doCall(new C130()); + doCall(new C129()); + doCall(new C128()); + doCall(new C127()); + doCall(new C126()); + doCall(new C125()); + doCall(new C124()); + doCall(new C123()); + doCall(new C122()); + doCall(new C121()); + doCall(new C120()); + doCall(new C119()); + doCall(new C118()); + doCall(new C117()); + doCall(new C116()); + doCall(new C115()); + doCall(new C114()); + doCall(new C113()); + doCall(new C112()); + doCall(new C111()); + doCall(new C110()); + doCall(new C109()); + doCall(new C108()); + doCall(new C107()); + doCall(new C106()); + doCall(new C105()); + doCall(new C104()); + doCall(new C103()); + doCall(new C102()); + doCall(new C101()); + doCall(new C100()); + doCall(new C99()); + doCall(new C98()); + doCall(new C97()); + doCall(new C96()); + doCall(new C95()); + doCall(new C94()); + doCall(new C93()); + doCall(new C92()); + doCall(new C91()); + doCall(new C90()); + doCall(new C89()); + doCall(new C88()); + doCall(new C87()); + doCall(new C86()); + doCall(new C85()); + doCall(new C84()); + doCall(new C83()); + doCall(new C82()); + doCall(new C81()); + doCall(new C80()); + doCall(new C79()); + doCall(new C78()); + doCall(new C77()); + doCall(new C76()); + doCall(new C75()); + doCall(new C74()); + doCall(new C73()); + doCall(new C72()); + doCall(new C71()); + doCall(new C70()); + doCall(new C69()); + doCall(new C68()); + doCall(new C67()); + doCall(new C66()); + doCall(new C65()); + doCall(new C64()); + doCall(new C63()); + doCall(new C62()); + doCall(new C61()); + doCall(new C60()); + doCall(new C59()); + doCall(new C58()); + doCall(new C57()); + doCall(new C56()); + doCall(new C55()); + doCall(new C54()); + doCall(new C53()); + doCall(new C52()); + doCall(new C51()); + doCall(new C50()); + doCall(new C49()); + doCall(new C48()); + doCall(new C47()); + doCall(new C46()); + doCall(new C45()); + doCall(new C44()); + doCall(new C43()); + doCall(new C42()); + doCall(new C41()); + doCall(new C40()); + doCall(new C39()); + doCall(new C38()); + doCall(new C37()); + doCall(new C36()); + doCall(new C35()); + doCall(new C34()); + doCall(new C33()); + doCall(new C32()); + doCall(new C31()); + doCall(new C30()); + doCall(new C29()); + doCall(new C28()); + doCall(new C27()); + doCall(new C26()); + doCall(new C25()); + doCall(new C24()); + doCall(new C23()); + doCall(new C22()); + doCall(new C21()); + doCall(new C20()); + doCall(new C19()); + doCall(new C18()); + doCall(new C17()); + doCall(new C16()); + doCall(new C15()); + doCall(new C14()); + doCall(new C13()); + doCall(new C12()); + doCall(new C11()); + doCall(new C10()); + doCall(new C9()); + doCall(new C8()); + doCall(new C7()); + doCall(new C6()); + doCall(new C5()); + doCall(new C4()); + doCall(new C3()); + doCall(new C2()); + doCall(new C1()); + doCall(new C0()); +}
diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc index bdeced0..bd62db2 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm.cc
@@ -3288,12 +3288,12 @@ void StubCodeCompiler::GenerateMegamorphicCallStub() { __ LoadTaggedClassIdMayBeSmi(R8, R0); // R8: receiver cid as Smi. - __ ldr(R2, - FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); __ ldr(R1, FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); + __ ldr(R2, + FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); + // R1: mask as a smi - load first to support insertion w/o stopping Dart code. // R2: cache buckets array. - // R1: mask as a smi. // Compute the table index. ASSERT(target::MegamorphicCache::kSpreadFactor == 7);
diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc index c49e127..04ef9a5 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm64.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc
@@ -3683,12 +3683,12 @@ Label cid_loaded; __ Bind(&cid_loaded); - __ ldr(R2, - FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); __ ldr(R1, FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); + __ ldr(R2, + FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); + // R1: mask as a smi - load first to support insertion w/o stopping Dart code. // R2: cache buckets array. - // R1: mask as a smi. // Make the cid into a smi. __ SmiTag(R8);
diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc index f577660..6535dc7 100644 --- a/runtime/vm/compiler/stub_code_compiler_ia32.cc +++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc
@@ -3177,8 +3177,8 @@ FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); __ movl(EDI, FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); + // EBX: mask as a smi - load first to support insert w/o stopping Dart code. // EDI: cache buckets array. - // EBX: mask as a smi. // Tag cid as a smi. __ addl(EAX, EAX);
diff --git a/runtime/vm/compiler/stub_code_compiler_riscv.cc b/runtime/vm/compiler/stub_code_compiler_riscv.cc index 49bf140..1be7777 100644 --- a/runtime/vm/compiler/stub_code_compiler_riscv.cc +++ b/runtime/vm/compiler/stub_code_compiler_riscv.cc
@@ -3194,11 +3194,11 @@ Label cid_loaded; __ Bind(&cid_loaded); + __ lx(T1, FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); __ lx(T2, FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); - __ lx(T1, FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); + // T1: mask as a smi - load first to support insertion w/o stopping Dart code. // T2: cache buckets array. - // T1: mask as a smi. // Make the cid into a smi. __ SmiTag(T5);
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc index 0304d26..8f5b071 100644 --- a/runtime/vm/compiler/stub_code_compiler_x64.cc +++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -3587,7 +3587,7 @@ FieldAddress(IC_DATA_REG, target::MegamorphicCache::mask_offset())); __ movq(RDI, FieldAddress(IC_DATA_REG, target::MegamorphicCache::buckets_offset())); - // R9: mask as a smi. + // R9: mask as a smi - load first to support insertion w/o stopping Dart code. // RDI: cache buckets array. // Tag cid as a smi.
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 8580e25..e8ce3be 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc
@@ -19759,24 +19759,9 @@ UNREACHABLE(); } +// Note this may run with Dart execution reading this cache. void MegamorphicCache::InsertLocked(const Smi& class_id, const Object& target) const { - auto isolate_group = IsolateGroup::Current(); - ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread()); - - // As opposed to ICData we are stopping mutator threads from other isolates - // while modifying the megamorphic cache, since updates are not atomic. - // - // NOTE: In the future we might change the megamorphic cache insertions to - // carefully use store-release barriers on the writer as well as - // load-acquire barriers on the reader, ... - isolate_group->RunWithStoppedMutators([&]() { - EnsureCapacityLocked(); - InsertEntryLocked(class_id, target); - }); -} - -void MegamorphicCache::EnsureCapacityLocked() const { auto thread = Thread::Current(); auto zone = thread->zone(); auto isolate_group = thread->isolate_group(); @@ -19787,6 +19772,7 @@ if (static_cast<double>(filled_entry_count() + 1) > load_limit) { const Array& old_buckets = Array::Handle(zone, buckets()); intptr_t new_capacity = old_capacity * 2; + intptr_t new_mask = new_capacity - 1; const Array& new_buckets = Array::Handle(zone, Array::New(kEntryLength * new_capacity)); @@ -19794,9 +19780,6 @@ for (intptr_t i = 0; i < new_capacity; ++i) { SetEntry(new_buckets, i, smi_illegal_cid(), target); } - set_buckets(new_buckets); - set_mask(new_capacity - 1); - set_filled_entry_count(0); // Rehash the valid entries. Smi& class_id = Smi::Handle(zone); @@ -19804,33 +19787,39 @@ class_id ^= GetClassId(old_buckets, i); if (class_id.Value() != kIllegalCid) { target = GetTargetFunction(old_buckets, i); - InsertEntryLocked(class_id, target); + InsertEntryLocked<std::memory_order_relaxed>(new_buckets, new_mask, + class_id, target); } } + + // Publish buckets first. Old mask with new buckets is just a spurious miss. + untag()->set_buckets<std::memory_order_release>(new_buckets.ptr()); + untag()->set_mask<std::memory_order_release>(Smi::New(new_mask)); } + + const Array& new_buckets = Array::Handle(zone, buckets()); + InsertEntryLocked<std::memory_order_release>(new_buckets, mask(), class_id, + target); + set_filled_entry_count(filled_entry_count() + 1); } -void MegamorphicCache::InsertEntryLocked(const Smi& class_id, - const Object& target) const { - auto thread = Thread::Current(); - auto isolate_group = thread->isolate_group(); - ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread()); - - ASSERT(Thread::Current()->IsDartMutatorThread()); - ASSERT(static_cast<double>(filled_entry_count() + 1) <= - (kLoadFactor * static_cast<double>(mask() + 1))); - const Array& backing_array = Array::Handle(buckets()); - intptr_t id_mask = mask(); - intptr_t index = (class_id.Value() * kSpreadFactor) & id_mask; - intptr_t i = index; +template <std::memory_order order> +void MegamorphicCache::InsertEntryLocked(const Array& backing_array, + intptr_t mask, + const Smi& class_id, + const Object& target) { + const intptr_t start = (class_id.Value() * kSpreadFactor) & mask; + intptr_t i = start; do { if (Smi::Value(Smi::RawCast(GetClassId(backing_array, i))) == kIllegalCid) { - SetEntry(backing_array, i, class_id, target); - set_filled_entry_count(filled_entry_count() + 1); + // Publish target first. Old class id with new target is just a spurious + // miss. + SetTargetFunction<order>(backing_array, i, target); + SetClassId<order>(backing_array, i, class_id); return; } - i = (i + 1) & id_mask; - } while (i != index); + i = (i + 1) & mask; + } while (i != start); UNREACHABLE(); }
diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 02d9794..d3d020e 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h
@@ -7838,10 +7838,13 @@ // The caller must hold IsolateGroup::type_feedback_mutex(). void InsertLocked(const Smi& class_id, const Object& target) const; - void EnsureCapacityLocked() const; ObjectPtr LookupLocked(const Smi& class_id) const; - void InsertEntryLocked(const Smi& class_id, const Object& target) const; + template <std::memory_order order> + static void InsertEntryLocked(const Array& array, + intptr_t mask, + const Smi& class_id, + const Object& target); static inline void SetEntry(const Array& array, intptr_t index, @@ -7849,7 +7852,15 @@ const Object& target); static inline ObjectPtr GetClassId(const Array& array, intptr_t index); + template <std::memory_order order> + static inline void SetClassId(const Array& array, + intptr_t index, + const Smi& class_id); static inline ObjectPtr GetTargetFunction(const Array& array, intptr_t index); + template <std::memory_order order> + static inline void SetTargetFunction(const Array& array, + intptr_t index, + const Object& target); FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, CallSiteData); }; @@ -13549,11 +13560,25 @@ return array.At((index * kEntryLength) + kClassIdIndex); } +template <std::memory_order order> +void MegamorphicCache::SetClassId(const Array& array, + intptr_t index, + const Smi& class_id) { + array.SetAt<order>((index * kEntryLength) + kClassIdIndex, class_id); +} + ObjectPtr MegamorphicCache::GetTargetFunction(const Array& array, intptr_t index) { return array.At((index * kEntryLength) + kTargetFunctionIndex); } +template <std::memory_order order> +void MegamorphicCache::SetTargetFunction(const Array& array, + intptr_t index, + const Object& target) { + array.SetAt<order>((index * kEntryLength) + kTargetFunctionIndex, target); +} + inline uword AbstractType::Hash() const { ASSERT(IsFinalized()); intptr_t result = Smi::Value(untag()->hash());
diff --git a/tools/VERSION b/tools/VERSION index b23ce9d..25634b1 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -25,7 +25,7 @@ # CHANNEL dev MAJOR 3 -MINOR 9 +MINOR 10 PATCH 0 -PRERELEASE 338 +PRERELEASE 0 PRERELEASE_PATCH 0
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml index c3ac6fe..1718a7f 100644 --- a/tools/experimental_features.yaml +++ b/tools/experimental_features.yaml
@@ -110,7 +110,7 @@ # default 'language' "category" with code generated for both CFE and Analyzer, # while other categories can be tailored more specifically. -current-version: '3.9.0' +current-version: '3.10.0' features: variance: