Skip to content

Commit

Permalink
Fix breakages from analyzer 0.39.16
Browse files Browse the repository at this point in the history
  • Loading branch information
joebingham-wk committed Aug 5, 2020
1 parent 378a58d commit 7d288eb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:over_react_analyzer_plugin/src/diagnostic_contributor.dart';
import 'package:over_react_analyzer_plugin/src/fluent_interface_util.dart';
import 'package:over_react_analyzer_plugin/src/util/ast_util.dart';

const _desc = "Props can't be cascaded after unparenthesized arrow functions.";
// <editor-fold desc="Documentation Details">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,6 @@ extension on SourceSpan {
SourceRange asRangeOrEmpty() => this == null ? SourceRange.EMPTY : asRange();
}

extension<E> on Iterable<E> {
void forEachIndexed(void Function(E, int) callback) {
var i = 0;
forEach((e) {
callback(e, i);
i++;
});
}
}

// TODO use the version from over_react instead after initial release
Iterable<PartDirective> getNonGeneratedParts(CompilationUnit libraryUnit) {
return libraryUnit.directives
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ignore: deprecated_member_use
import 'package:analyzer/analyzer.dart'
show CompileTimeErrorCode, NodeLocator, StaticTypeWarningCode, StaticWarningCode;
show CompileTimeErrorCode, NodeLocator;
import 'package:analyzer/dart/ast/ast.dart';
import 'package:over_react_analyzer_plugin/src/util/react_types.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
Expand Down Expand Up @@ -63,16 +63,16 @@ class MissingCascadeParensDiagnostic extends DiagnosticContributor {
computeErrors(result, collector) async {
for (final error in result.errors) {
final isBadFunction = const {
StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION,
CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
}.contains(error.errorCode);
final isBadArity = const {
CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS,
CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED,
CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS,
}.contains(error.errorCode);
final isVoidUsage = const {
StaticWarningCode.USE_OF_VOID_RESULT,
CompileTimeErrorCode.USE_OF_VOID_RESULT,
}.contains(error.errorCode);

if (isBadFunction || isBadArity || isVoidUsage) {
Expand Down
2 changes: 1 addition & 1 deletion web/component2/src/demos/ref.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ mixin RefDemoProps on UiProps {}

final RefDemoContainer = uiFunction<RefDemoProps>(
(props) {
// `uiForwardRef` Refs
// `uiForwardRef` Refs
final buttonNodeRefForSimpleFunctionComponent = createRef<Element>();
final buttonNodeRefForComplexFunctionComponent = createRef<Element>();
final buttonNodeRefForSimpleComponent = createRef<Element>();
Expand Down

0 comments on commit 7d288eb

Please sign in to comment.