mirror of https://github.com/AMT-Cheif/drift.git
Support latest analyzer
This commit is contained in:
parent
8f40216528
commit
270bdc8bca
|
@ -6,116 +6,110 @@ part of 'options.dart';
|
|||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
MoorOptions _$MoorOptionsFromJson(Map json) {
|
||||
return $checkedNew('MoorOptions', json, () {
|
||||
$checkKeys(json, allowedKeys: const [
|
||||
'write_from_json_string_constructor',
|
||||
'override_hash_and_equals_in_result_sets',
|
||||
'compact_query_methods',
|
||||
'skip_verification_code',
|
||||
'use_data_class_name_for_companions',
|
||||
'use_column_name_as_json_key_when_defined_in_moor_file',
|
||||
'generate_connect_constructor',
|
||||
'sqlite_modules',
|
||||
'sqlite',
|
||||
'eagerly_load_dart_ast',
|
||||
'data_class_to_companions',
|
||||
'mutable_classes',
|
||||
'raw_result_set_data',
|
||||
'apply_converters_on_variables',
|
||||
'generate_values_in_copy_with',
|
||||
'named_parameters',
|
||||
'named_parameters_always_required',
|
||||
'new_sql_code_generation',
|
||||
'scoped_dart_components'
|
||||
]);
|
||||
final val = MoorOptions(
|
||||
generateFromJsonStringConstructor: $checkedConvert(
|
||||
json, 'write_from_json_string_constructor', (v) => v as bool?) ??
|
||||
false,
|
||||
overrideHashAndEqualsInResultSets: $checkedConvert(json,
|
||||
'override_hash_and_equals_in_result_sets', (v) => v as bool?) ??
|
||||
false,
|
||||
compactQueryMethods:
|
||||
$checkedConvert(json, 'compact_query_methods', (v) => v as bool?) ??
|
||||
true,
|
||||
skipVerificationCode:
|
||||
$checkedConvert(json, 'skip_verification_code', (v) => v as bool?) ??
|
||||
false,
|
||||
useDataClassNameForCompanions: $checkedConvert(
|
||||
json, 'use_data_class_name_for_companions', (v) => v as bool?) ??
|
||||
false,
|
||||
useColumnNameAsJsonKeyWhenDefinedInMoorFile: $checkedConvert(
|
||||
json,
|
||||
MoorOptions _$MoorOptionsFromJson(Map json) => $checkedCreate(
|
||||
'MoorOptions',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
$checkKeys(
|
||||
json,
|
||||
allowedKeys: const [
|
||||
'write_from_json_string_constructor',
|
||||
'override_hash_and_equals_in_result_sets',
|
||||
'compact_query_methods',
|
||||
'skip_verification_code',
|
||||
'use_data_class_name_for_companions',
|
||||
'use_column_name_as_json_key_when_defined_in_moor_file',
|
||||
'generate_connect_constructor',
|
||||
'sqlite_modules',
|
||||
'sqlite',
|
||||
'eagerly_load_dart_ast',
|
||||
'data_class_to_companions',
|
||||
'mutable_classes',
|
||||
'raw_result_set_data',
|
||||
'apply_converters_on_variables',
|
||||
'generate_values_in_copy_with',
|
||||
'named_parameters',
|
||||
'named_parameters_always_required',
|
||||
'new_sql_code_generation',
|
||||
'scoped_dart_components'
|
||||
],
|
||||
);
|
||||
final val = MoorOptions(
|
||||
generateFromJsonStringConstructor: $checkedConvert(
|
||||
'write_from_json_string_constructor', (v) => v as bool? ?? false),
|
||||
overrideHashAndEqualsInResultSets: $checkedConvert(
|
||||
'override_hash_and_equals_in_result_sets',
|
||||
(v) => v as bool? ?? false),
|
||||
compactQueryMethods: $checkedConvert(
|
||||
'compact_query_methods', (v) => v as bool? ?? true),
|
||||
skipVerificationCode: $checkedConvert(
|
||||
'skip_verification_code', (v) => v as bool? ?? false),
|
||||
useDataClassNameForCompanions: $checkedConvert(
|
||||
'use_data_class_name_for_companions', (v) => v as bool? ?? false),
|
||||
useColumnNameAsJsonKeyWhenDefinedInMoorFile: $checkedConvert(
|
||||
'use_column_name_as_json_key_when_defined_in_moor_file',
|
||||
(v) => v as bool?) ??
|
||||
true,
|
||||
generateConnectConstructor: $checkedConvert(
|
||||
json, 'generate_connect_constructor', (v) => v as bool?) ??
|
||||
false,
|
||||
eagerlyLoadDartAst:
|
||||
$checkedConvert(json, 'eagerly_load_dart_ast', (v) => v as bool?) ??
|
||||
false,
|
||||
dataClassToCompanions: $checkedConvert(
|
||||
json, 'data_class_to_companions', (v) => v as bool?) ??
|
||||
true,
|
||||
generateMutableClasses:
|
||||
$checkedConvert(json, 'mutable_classes', (v) => v as bool?) ?? false,
|
||||
rawResultSetData:
|
||||
$checkedConvert(json, 'raw_result_set_data', (v) => v as bool?) ??
|
||||
false,
|
||||
applyConvertersOnVariables: $checkedConvert(
|
||||
json, 'apply_converters_on_variables', (v) => v as bool?) ??
|
||||
false,
|
||||
generateValuesInCopyWith: $checkedConvert(
|
||||
json, 'generate_values_in_copy_with', (v) => v as bool?) ??
|
||||
false,
|
||||
generateNamedParameters:
|
||||
$checkedConvert(json, 'named_parameters', (v) => v as bool?) ?? false,
|
||||
namedParametersAlwaysRequired: $checkedConvert(
|
||||
json, 'named_parameters_always_required', (v) => v as bool?) ??
|
||||
false,
|
||||
newSqlCodeGeneration:
|
||||
$checkedConvert(json, 'new_sql_code_generation', (v) => v as bool?) ??
|
||||
false,
|
||||
scopedDartComponents:
|
||||
$checkedConvert(json, 'scoped_dart_components', (v) => v as bool?) ??
|
||||
false,
|
||||
modules: $checkedConvert(
|
||||
json,
|
||||
(v) => v as bool? ?? true),
|
||||
generateConnectConstructor: $checkedConvert(
|
||||
'generate_connect_constructor', (v) => v as bool? ?? false),
|
||||
eagerlyLoadDartAst: $checkedConvert(
|
||||
'eagerly_load_dart_ast', (v) => v as bool? ?? false),
|
||||
dataClassToCompanions: $checkedConvert(
|
||||
'data_class_to_companions', (v) => v as bool? ?? true),
|
||||
generateMutableClasses:
|
||||
$checkedConvert('mutable_classes', (v) => v as bool? ?? false),
|
||||
rawResultSetData: $checkedConvert(
|
||||
'raw_result_set_data', (v) => v as bool? ?? false),
|
||||
applyConvertersOnVariables: $checkedConvert(
|
||||
'apply_converters_on_variables', (v) => v as bool? ?? false),
|
||||
generateValuesInCopyWith: $checkedConvert(
|
||||
'generate_values_in_copy_with', (v) => v as bool? ?? false),
|
||||
generateNamedParameters:
|
||||
$checkedConvert('named_parameters', (v) => v as bool? ?? false),
|
||||
namedParametersAlwaysRequired: $checkedConvert(
|
||||
'named_parameters_always_required', (v) => v as bool? ?? false),
|
||||
newSqlCodeGeneration: $checkedConvert(
|
||||
'new_sql_code_generation', (v) => v as bool? ?? false),
|
||||
scopedDartComponents: $checkedConvert(
|
||||
'scoped_dart_components', (v) => v as bool? ?? false),
|
||||
modules: $checkedConvert(
|
||||
'sqlite_modules',
|
||||
(v) => (v as List<dynamic>?)
|
||||
?.map((e) => _$enumDecode(_$SqlModuleEnumMap, e))
|
||||
.toList()) ??
|
||||
[],
|
||||
sqliteAnalysisOptions: $checkedConvert(json, 'sqlite',
|
||||
(v) => v == null ? null : SqliteAnalysisOptions.fromJson(v as Map)),
|
||||
(v) =>
|
||||
(v as List<dynamic>?)
|
||||
?.map((e) => _$enumDecode(_$SqlModuleEnumMap, e))
|
||||
.toList() ??
|
||||
[]),
|
||||
sqliteAnalysisOptions: $checkedConvert(
|
||||
'sqlite',
|
||||
(v) =>
|
||||
v == null ? null : SqliteAnalysisOptions.fromJson(v as Map)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {
|
||||
'generateFromJsonStringConstructor':
|
||||
'write_from_json_string_constructor',
|
||||
'overrideHashAndEqualsInResultSets':
|
||||
'override_hash_and_equals_in_result_sets',
|
||||
'compactQueryMethods': 'compact_query_methods',
|
||||
'skipVerificationCode': 'skip_verification_code',
|
||||
'useDataClassNameForCompanions': 'use_data_class_name_for_companions',
|
||||
'useColumnNameAsJsonKeyWhenDefinedInMoorFile':
|
||||
'use_column_name_as_json_key_when_defined_in_moor_file',
|
||||
'generateConnectConstructor': 'generate_connect_constructor',
|
||||
'eagerlyLoadDartAst': 'eagerly_load_dart_ast',
|
||||
'dataClassToCompanions': 'data_class_to_companions',
|
||||
'generateMutableClasses': 'mutable_classes',
|
||||
'rawResultSetData': 'raw_result_set_data',
|
||||
'applyConvertersOnVariables': 'apply_converters_on_variables',
|
||||
'generateValuesInCopyWith': 'generate_values_in_copy_with',
|
||||
'generateNamedParameters': 'named_parameters',
|
||||
'namedParametersAlwaysRequired': 'named_parameters_always_required',
|
||||
'newSqlCodeGeneration': 'new_sql_code_generation',
|
||||
'scopedDartComponents': 'scoped_dart_components',
|
||||
'modules': 'sqlite_modules',
|
||||
'sqliteAnalysisOptions': 'sqlite'
|
||||
},
|
||||
);
|
||||
return val;
|
||||
}, fieldKeyMap: const {
|
||||
'generateFromJsonStringConstructor': 'write_from_json_string_constructor',
|
||||
'overrideHashAndEqualsInResultSets':
|
||||
'override_hash_and_equals_in_result_sets',
|
||||
'compactQueryMethods': 'compact_query_methods',
|
||||
'skipVerificationCode': 'skip_verification_code',
|
||||
'useDataClassNameForCompanions': 'use_data_class_name_for_companions',
|
||||
'useColumnNameAsJsonKeyWhenDefinedInMoorFile':
|
||||
'use_column_name_as_json_key_when_defined_in_moor_file',
|
||||
'generateConnectConstructor': 'generate_connect_constructor',
|
||||
'eagerlyLoadDartAst': 'eagerly_load_dart_ast',
|
||||
'dataClassToCompanions': 'data_class_to_companions',
|
||||
'generateMutableClasses': 'mutable_classes',
|
||||
'rawResultSetData': 'raw_result_set_data',
|
||||
'applyConvertersOnVariables': 'apply_converters_on_variables',
|
||||
'generateValuesInCopyWith': 'generate_values_in_copy_with',
|
||||
'generateNamedParameters': 'named_parameters',
|
||||
'namedParametersAlwaysRequired': 'named_parameters_always_required',
|
||||
'newSqlCodeGeneration': 'new_sql_code_generation',
|
||||
'scopedDartComponents': 'scoped_dart_components',
|
||||
'modules': 'sqlite_modules',
|
||||
'sqliteAnalysisOptions': 'sqlite'
|
||||
});
|
||||
}
|
||||
|
||||
K _$enumDecode<K, V>(
|
||||
Map<K, V> enumValues,
|
||||
|
@ -150,20 +144,26 @@ const _$SqlModuleEnumMap = {
|
|||
SqlModule.math: 'math',
|
||||
};
|
||||
|
||||
SqliteAnalysisOptions _$SqliteAnalysisOptionsFromJson(Map json) {
|
||||
return $checkedNew('SqliteAnalysisOptions', json, () {
|
||||
$checkKeys(json, allowedKeys: const ['modules', 'version']);
|
||||
final val = SqliteAnalysisOptions(
|
||||
modules: $checkedConvert(
|
||||
json,
|
||||
SqliteAnalysisOptions _$SqliteAnalysisOptionsFromJson(Map json) =>
|
||||
$checkedCreate(
|
||||
'SqliteAnalysisOptions',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
$checkKeys(
|
||||
json,
|
||||
allowedKeys: const ['modules', 'version'],
|
||||
);
|
||||
final val = SqliteAnalysisOptions(
|
||||
modules: $checkedConvert(
|
||||
'modules',
|
||||
(v) => (v as List<dynamic>?)
|
||||
?.map((e) => _$enumDecode(_$SqlModuleEnumMap, e))
|
||||
.toList()) ??
|
||||
[],
|
||||
version: $checkedConvert(
|
||||
json, 'version', (v) => _parseSqliteVersion(v as String?)),
|
||||
(v) =>
|
||||
(v as List<dynamic>?)
|
||||
?.map((e) => _$enumDecode(_$SqlModuleEnumMap, e))
|
||||
.toList() ??
|
||||
[]),
|
||||
version: $checkedConvert(
|
||||
'version', (v) => _parseSqliteVersion(v as String?)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
return val;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -45,10 +45,11 @@ class ErrorService {
|
|||
final span = error.span;
|
||||
final start = span.start;
|
||||
final end = span.end;
|
||||
return Location(path, start.offset, span.length, start.line + 1,
|
||||
start.column + 1, end.line + 1, end.column + 1);
|
||||
return Location(
|
||||
path, start.offset, span.length, start.line + 1, start.column + 1,
|
||||
endLine: end.line + 1, endColumn: end.column + 1);
|
||||
}
|
||||
|
||||
return Location(path, 0, 0, 0, 0, 0, 0);
|
||||
return Location(path, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ class _NavigationVisitor extends RecursiveVisitor<void, void> {
|
|||
|
||||
if (resolved != null) {
|
||||
final span = e.importString.span;
|
||||
_reportForSpan(span, ElementKind.FILE,
|
||||
Location(resolved.uri.path, 0, 0, 1, 1, 1, 1));
|
||||
_reportForSpan(
|
||||
span, ElementKind.FILE, Location(resolved.uri.path, 0, 0, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Location _locationForSpan(SourceSpan span, FoundFile file) {
|
|||
last.offset - first.offset,
|
||||
first.line + 1,
|
||||
first.column + 1,
|
||||
last.line + 1,
|
||||
last.column + 1,
|
||||
endLine: last.line + 1,
|
||||
endColumn: last.column + 1,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ dependencies:
|
|||
sqlparser: ^0.17.0
|
||||
|
||||
# Dart analysis
|
||||
analyzer: "^1.7.1"
|
||||
analyzer_plugin: ^0.6.0
|
||||
analyzer: "^2.0.0"
|
||||
analyzer_plugin: ^0.7.0
|
||||
source_span: ^1.5.5
|
||||
package_config: ^2.0.0
|
||||
pub_semver: ^2.0.0
|
||||
|
@ -46,7 +46,7 @@ dev_dependencies:
|
|||
test: ^1.16.0
|
||||
build_runner: ^2.0.0
|
||||
build_test: ^2.0.0
|
||||
json_serializable: ^4.0.0
|
||||
json_serializable: ^5.0.0
|
||||
|
||||
executables:
|
||||
moor_generator:
|
||||
|
|
Loading…
Reference in New Issue