Skip to content

Commit

Permalink
update to latest analyzer APIs (dart-lang#1880)
Browse files Browse the repository at this point in the history
* update to latest analyzer APIs

* + ignore

* fmt
  • Loading branch information
pq authored Dec 9, 2019
1 parent 7d793a9 commit 92c2d4d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/src/analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ import 'package:analyzer/src/services/lint.dart' as lint_service;
import 'analyzer.dart';
import 'version.dart';

export 'package:analyzer/dart/element/type_system.dart';
export 'package:analyzer/src/dart/ast/token.dart';
export 'package:analyzer/src/dart/constant/evaluation.dart'
show ConstantEvaluationEngine, ConstantVisitor;
export 'package:analyzer/src/dart/constant/value.dart' show DartObjectImpl;
export 'package:analyzer/src/dart/element/inheritance_manager3.dart'
show InheritanceManager3, Name;
export 'package:analyzer/src/dart/element/type_provider.dart'
show TypeProviderImpl;
export 'package:analyzer/src/dart/error/lint_codes.dart';
export 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisErrorInfo;
export 'package:analyzer/src/generated/resolver.dart'
show ExitDetector, TypeProvider, TypeSystem;
show ExitDetector, TypeProvider;
export 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
export 'package:analyzer/src/lint/linter.dart'
show
Expand Down
1 change: 1 addition & 0 deletions lib/src/rules/no_duplicate_case_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class _Visitor extends SimpleAstVisitor<void> {
return equals.isBool && equals.toBoolValue();
});

// todo (pq): replace w/ calls to API provided by LinterContext
final constantVisitor = ConstantVisitor(
ConstantEvaluationEngine(typeProvider, declaredVariables,
typeSystem: typeSystem),
Expand Down
9 changes: 7 additions & 2 deletions lib/src/rules/unnecessary_this.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ class UnnecessaryThis extends LintRule implements NodeLintRule {
}
}

// todo (pq): refactor to not use scoped visitor
class _UnnecessaryThisVisitor extends ScopedVisitor {
final LintRule rule;

_UnnecessaryThisVisitor(
this.rule, LinterContext context, CompilationUnit node)
: super(node.declaredElement.library, rule.reporter.source,
context.typeProvider, AnalysisErrorListener.NULL_LISTENER);
: super(
node.declaredElement.library,
rule.reporter.source,
context.typeProvider as TypeProviderImpl,
AnalysisErrorListener.NULL_LISTENER,
);

@override
void visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/dart_type_utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DartTypeUtilities {
// bug in the analyzer causes FieldElements to not evaluate as
// equivalent to equivalent FieldMembers. See
// https://github.com/dart-lang/sdk/issues/35343.
return variable.baseElement;
return variable.declaration;
} else {
return variable;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ environment:
sdk: '>=2.2.2 <3.0.0'

dependencies:
analyzer: ^0.39.1
analyzer: ^0.39.2
args: '>=1.4.0 <2.0.0'
charcode: ^1.0.0
glob: ^1.0.3
Expand Down

0 comments on commit 92c2d4d

Please sign in to comment.