Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

remove super_goes_last #4017

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions lib/src/rules/super_goes_last.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +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/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';

import '../analyzer.dart';

const _desc =
Expand Down Expand Up @@ -42,13 +39,6 @@ View(Style style, List children)
: _children = children,
super(style) {
```

**DEPRECATED:** In Dart 2, it is a compile-time error if a superinitializer
appears in an initializer list at any other position than at the end so this
rule is made redundant by the Dart analyzer's basic checks and is no longer
necessary.

The rule will be removed in a future Linter release.
''';

class SuperGoesLast extends LintRule {
Expand All @@ -63,34 +53,9 @@ class SuperGoesLast extends LintRule {
name: 'super_goes_last',
description: _desc,
details: _details,
state: State.deprecated(),
state: State.removed(since: dart3),
group: Group.style);

@override
LintCode get lintCode => code;

@override
void registerNodeProcessors(
NodeLintRegistry registry, LinterContext context) {
var visitor = _Visitor(this);
registry.addConstructorDeclaration(this, visitor);
}
}

class _Visitor extends SimpleAstVisitor<void> {
final LintRule rule;

_Visitor(this.rule);

@override
void visitConstructorDeclaration(ConstructorDeclaration node) {
var last = node.initializers.length - 1;

for (var i = 0; i <= last; ++i) {
var init = node.initializers[i];
if (init is SuperConstructorInvocation && i != last) {
rule.reportLint(init);
}
}
}
}
2 changes: 0 additions & 2 deletions test/rules/all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ import 'recursive_getters_test.dart' as recursive_getters;
import 'sort_constructors_first_test.dart' as sort_constructors_first;
import 'sort_unnamed_constructors_first_test.dart'
as sort_unnamed_constructors_first;
import 'super_goes_last_test.dart' as super_goes_last;
import 'tighten_type_of_initializing_formals_test.dart'
as tighten_type_of_initializing_formals;
import 'type_init_formals_test.dart' as type_init_formals;
Expand Down Expand Up @@ -157,7 +156,6 @@ void main() {
recursive_getters.main();
sort_constructors_first.main();
sort_unnamed_constructors_first.main();
super_goes_last.main();
tighten_type_of_initializing_formals.main();
type_init_formals.main();
unawaited_futures.main();
Expand Down
39 changes: 0 additions & 39 deletions test/rules/super_goes_last_test.dart

This file was deleted.

17 changes: 0 additions & 17 deletions test_data/rules/super_goes_last.dart

This file was deleted.