mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
[dartdevc] Enforce more pedantic v1.9.0 lints and cleanup violations
- prefer_generic_function_type_aliases - use_function_type_syntax_for_parameters Change-Id: I138d4104c5de41acf44b7962d6e2ce58d78b8a75 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134380 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
This commit is contained in:
parent
21535e540f
commit
c438a48bc4
|
@ -27,9 +27,11 @@ linter:
|
|||
- prefer_conditional_assignment
|
||||
- prefer_final_fields
|
||||
- prefer_for_elements_to_map_fromIterable
|
||||
- prefer_generic_function_type_aliases
|
||||
- prefer_if_null_operators
|
||||
- prefer_single_quotes
|
||||
- prefer_spread_collections
|
||||
- use_function_type_syntax_for_parameters
|
||||
# Not enforced by pedantic at any version.
|
||||
- directives_ordering
|
||||
- prefer_null_aware_operators
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
|
||||
// ignore_for_file: slash_for_doc_comments, unnecessary_const
|
||||
// ignore_for_file: always_declare_return_types, prefer_single_quotes
|
||||
// ignore_for_file: prefer_collection_literals, prefer_final_fields
|
||||
// ignore_for_file: omit_local_variable_types
|
||||
// ignore_for_file: prefer_collection_literals, omit_local_variable_types
|
||||
// ignore_for_file: prefer_generic_function_type_aliases, prefer_final_fields
|
||||
// ignore_for_file: use_function_type_syntax_for_parameters
|
||||
|
||||
part of js_ast;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// ignore_for_file: slash_for_doc_comments, prefer_single_quotes
|
||||
// ignore_for_file: slash_for_doc_comments, omit_local_variable_types
|
||||
// ignore_for_file: always_declare_return_types, prefer_collection_literals
|
||||
// ignore_for_file: omit_local_variable_types
|
||||
// ignore_for_file: prefer_single_quotes, prefer_generic_function_type_aliases
|
||||
|
||||
part of js_ast;
|
||||
|
||||
|
|
|
@ -2142,7 +2142,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
})));
|
||||
}
|
||||
|
||||
List<js_ast.Statement> _withLetScope(List<js_ast.Statement> visitBody()) {
|
||||
List<js_ast.Statement> _withLetScope(
|
||||
List<js_ast.Statement> Function() visitBody) {
|
||||
var savedLetVariables = _letVariables;
|
||||
_letVariables = [];
|
||||
|
||||
|
@ -2154,7 +2155,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
return body;
|
||||
}
|
||||
|
||||
js_ast.ArrowFun _arrowFunctionWithLetScope(js_ast.Expression visitBody()) {
|
||||
js_ast.ArrowFun _arrowFunctionWithLetScope(
|
||||
js_ast.Expression Function() visitBody) {
|
||||
var savedLetVariables = _letVariables;
|
||||
_letVariables = [];
|
||||
|
||||
|
@ -2986,7 +2988,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
js_ast.Expression _emitGeneratorFunctionExpression(
|
||||
FunctionNode function, String name) {
|
||||
js_ast.Expression emitGeneratorFn(
|
||||
List<js_ast.Parameter> getParameters(js_ast.Block jsBody)) {
|
||||
List<js_ast.Parameter> Function(js_ast.Block jsBody) getParameters) {
|
||||
var savedController = _asyncStarController;
|
||||
_asyncStarController = function.asyncMarker == AsyncMarker.AsyncStar
|
||||
? _emitTemporaryId('stream')
|
||||
|
@ -3148,7 +3150,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
}
|
||||
|
||||
List<js_ast.Statement> _withCurrentFunction(
|
||||
FunctionNode fn, List<js_ast.Statement> action()) {
|
||||
FunctionNode fn, List<js_ast.Statement> Function() action) {
|
||||
var savedFunction = _currentFunction;
|
||||
_currentFunction = fn;
|
||||
_nullableInference.enterFunction(fn);
|
||||
|
@ -3160,7 +3162,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
return result;
|
||||
}
|
||||
|
||||
T _superDisallowed<T>(T action()) {
|
||||
T _superDisallowed<T>(T Function() action) {
|
||||
var savedSuperAllowed = _superAllowed;
|
||||
_superAllowed = false;
|
||||
var result = action();
|
||||
|
@ -3578,7 +3580,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
return body;
|
||||
}
|
||||
|
||||
T _translateLoop<T extends js_ast.Statement>(Statement node, T action()) {
|
||||
T _translateLoop<T extends js_ast.Statement>(
|
||||
Statement node, T Function() action) {
|
||||
List<LabeledStatement> savedBreakTargets;
|
||||
if (_currentBreakTargets.isNotEmpty &&
|
||||
_effectiveTargets[_currentBreakTargets.first] != node) {
|
||||
|
@ -5501,7 +5504,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
/// string, this returns the string value.
|
||||
///
|
||||
/// Calls [findAnnotation] followed by [getNameFromAnnotation].
|
||||
String _annotationName(NamedNode node, bool test(Expression value)) {
|
||||
String _annotationName(NamedNode node, bool Function(Expression) test) {
|
||||
return _constants.getFieldValueFromAnnotation(
|
||||
findAnnotation(node, test), 'name') as String;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ String getTopLevelName(NamedNode n) {
|
|||
///
|
||||
/// (v) => v.type.name == 'Deprecated' && v.type.element.library.isDartCore
|
||||
///
|
||||
Expression findAnnotation(TreeNode node, bool test(Expression value)) {
|
||||
Expression findAnnotation(TreeNode node, bool Function(Expression) test) {
|
||||
List<Expression> annotations;
|
||||
if (node is Class) {
|
||||
annotations = node.annotations;
|
||||
|
|
|
@ -135,7 +135,7 @@ class DevCompilerTarget extends Target {
|
|||
Map<String, String> environmentDefines,
|
||||
DiagnosticReporter diagnosticReporter,
|
||||
ReferenceFromIndex referenceFromIndex,
|
||||
{void logger(String msg),
|
||||
{void Function(String msg) logger,
|
||||
ChangedStructureNotifier changedStructureNotifier}) {
|
||||
for (var library in libraries) {
|
||||
_CovarianceTransformer(library).transform();
|
||||
|
@ -151,7 +151,7 @@ class DevCompilerTarget extends Target {
|
|||
CoreTypes coreTypes,
|
||||
List<Library> libraries,
|
||||
DiagnosticReporter diagnosticReporter,
|
||||
{void logger(String msg),
|
||||
{void Function(String msg) logger,
|
||||
ChangedStructureNotifier changedStructureNotifier}) {
|
||||
if (flags.trackWidgetCreation) {
|
||||
_widgetTracker ??= WidgetCreatorTracker();
|
||||
|
|
|
@ -30,7 +30,7 @@ import 'package:stack_trace/stack_trace.dart';
|
|||
|
||||
import 'source_map_stack_trace.dart';
|
||||
|
||||
typedef void ReadyCallback();
|
||||
typedef ReadyCallback = void Function();
|
||||
|
||||
/// Global object DDC uses to see if a stack trace utility has been registered.
|
||||
@JS(r'$dartStackTraceUtility')
|
||||
|
@ -39,9 +39,9 @@ external set dartStackTraceUtility(DartStackTraceUtility value);
|
|||
@JS(r'$dartLoader.rootDirectories')
|
||||
external List get rootDirectories;
|
||||
|
||||
typedef String StackTraceMapper(String stackTrace);
|
||||
typedef dynamic SourceMapProvider(String modulePath);
|
||||
typedef void SetSourceMapProvider(SourceMapProvider provider);
|
||||
typedef StackTraceMapper = String Function(String stackTrace);
|
||||
typedef SourceMapProvider = dynamic Function(String modulePath);
|
||||
typedef SetSourceMapProvider = void Function(SourceMapProvider);
|
||||
|
||||
@JS()
|
||||
@anonymous
|
||||
|
|
Loading…
Reference in a new issue