From 23c8502c346d2985f15cc770c020a4acbca975da Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Tue, 9 Aug 2022 16:19:23 -0700 Subject: [PATCH] Require analyzer 4.5.0, stop using deprecated APIs. --- .../lib/src/analyzer/dart/column_parser.dart | 30 +++++++++---------- drift_dev/lib/src/analyzer/dart/parser.dart | 2 +- drift_dev/pubspec.yaml | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drift_dev/lib/src/analyzer/dart/column_parser.dart b/drift_dev/lib/src/analyzer/dart/column_parser.dart index 1db392fb..0e0ba351 100644 --- a/drift_dev/lib/src/analyzer/dart/column_parser.dart +++ b/drift_dev/lib/src/analyzer/dart/column_parser.dart @@ -67,7 +67,7 @@ class ColumnParser { if (expr is! FunctionExpressionInvocation) { base.step.reportError(ErrorInDartCode( - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: _errorMessage, severity: Severity.criticalError, )); @@ -106,7 +106,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.warning, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: "You're setting more than one name here, the first will " 'be used', @@ -119,7 +119,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.error, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: 'This table name is cannot be resolved! Please only use ' 'a constant string as parameter for .named().', @@ -134,7 +134,7 @@ class ColumnParser { if (first is! Identifier) { base.step.reportError(ErrorInDartCode( message: 'This parameter should be a simple class name', - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, affectedNode: first, )); break; @@ -144,7 +144,7 @@ class ColumnParser { if (staticElement is! ClassElement) { base.step.reportError(ErrorInDartCode( message: '${first.name} is not a class!', - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, affectedNode: first, )); break; @@ -154,7 +154,7 @@ class ColumnParser { if (columnNameNode is! SymbolLiteral) { base.step.reportError(ErrorInDartCode( message: 'This should be a symbol literal (`#columnName`)', - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, affectedNode: columnNameNode, )); break; @@ -170,7 +170,7 @@ class ColumnParser { base.step.reportError(ErrorInDartCode( message: 'Should be a direct enum reference (`KeyAction.cascade`)', - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, affectedNode: expr, )); return null; @@ -209,7 +209,7 @@ class ColumnParser { columnName, onUpdate, onDelete, - getter.declaredElement, + getter.declaredElement2, first, columnNameNode, )); @@ -242,7 +242,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.warning, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, affectedNode: remainingExpr.methodName, message: "You've already set custom constraints on this column, " @@ -256,7 +256,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.warning, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: 'This constraint is cannot be resolved! Please only use ' 'a constant string as parameter for .customConstraint().', @@ -366,7 +366,7 @@ class ColumnParser { base.step.reportError(ErrorInDartCode( message: 'Using $startEnum will apply a custom converter by default, ' "so you can't add an additional converter", - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, severity: Severity.warning, )); } @@ -378,7 +378,7 @@ class ColumnParser { } on InvalidTypeForEnumConverterException catch (e) { base.step.errors.report(ErrorInDartCode( message: e.errorDescription, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, severity: Severity.error, )); } @@ -388,7 +388,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.warning, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: 'clientDefault() and withDefault() are mutually exclusive, ' "they can't both be used. Use clientDefault() for values that " 'are different for each row and withDefault() otherwise.', @@ -401,7 +401,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.error, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: 'Primary key column cannot have UNIQUE constraint', ), ); @@ -411,7 +411,7 @@ class ColumnParser { base.step.reportError( ErrorInDartCode( severity: Severity.warning, - affectedElement: getter.declaredElement, + affectedElement: getter.declaredElement2, message: 'This column definition is using both drift-defined ' 'constraints (like references, autoIncrement, ...) and a ' 'customConstraint(). Only the custom constraint will be added ' diff --git a/drift_dev/lib/src/analyzer/dart/parser.dart b/drift_dev/lib/src/analyzer/dart/parser.dart index c813710b..48d55e45 100644 --- a/drift_dev/lib/src/analyzer/dart/parser.dart +++ b/drift_dev/lib/src/analyzer/dart/parser.dart @@ -63,7 +63,7 @@ class DriftDartParser { if (body is! ExpressionFunctionBody) { if (reportErrorOnFailure) { step.reportError(ErrorInDartCode( - affectedElement: method.declaredElement, + affectedElement: method.declaredElement2, severity: Severity.criticalError, message: 'This method must have an expression body ' '(use => instead of {return ...})', diff --git a/drift_dev/pubspec.yaml b/drift_dev/pubspec.yaml index b985c16f..35d3eb94 100644 --- a/drift_dev/pubspec.yaml +++ b/drift_dev/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: sqlparser: ^0.22.0 # Dart analysis - analyzer: "^4.4.0" + analyzer: "^4.5.0" analyzer_plugin: ^0.11.0 source_span: ^1.5.5 package_config: ^2.0.0