Fixed jael_web analysis warnings

This commit is contained in:
thomashii@dukefirehawk.com 2022-08-27 15:37:20 +08:00
parent 2c52e4a5d5
commit 6a34b51f04
3 changed files with 31 additions and 21 deletions

View file

@ -11,8 +11,8 @@ import 'package:path/src/context.dart';
/// Converts a [DartType] to a [TypeReference].
TypeReference convertTypeReference(DartType? t) {
return new TypeReference((b) {
b..symbol = t?.getDisplayString(withNullability: false);
return TypeReference((b) {
b.symbol = t?.getDisplayString(withNullability: false);
if (t is InterfaceType) {
b.types.addAll(t.typeArguments.map(convertTypeReference));
@ -49,6 +49,7 @@ class BuildFileSystem extends FileSystem {
BuildFileSystem(this.reader, this.package);
@override
Context get path => _path;
@override
@ -56,6 +57,7 @@ class BuildFileSystem extends FileSystem {
return BuildSystemDirectory(this, reader, package, _path.current);
}
@override
set currentDirectory(value) {
if (value is Directory) {
_path = Context(current: value.path);
@ -69,28 +71,30 @@ class BuildFileSystem extends FileSystem {
@override
Directory directory(path) {
late String p;
if (path is String)
if (path is String) {
p = path;
else if (path is Uri)
p = path.toString(); //p.toString();
else if (path is FileSystemEntity)
} else if (path is Uri) {
p = path.toString();
} else if (path is FileSystemEntity) {
p = path.path;
else
} else {
throw ArgumentError();
}
return BuildSystemDirectory(this, reader, package, p);
}
@override
File file(path) {
late String p;
if (path is String)
if (path is String) {
p = path;
else if (path is Uri)
p = path.toString(); // p.toString();
else if (path is FileSystemEntity)
} else if (path is Uri) {
p = path.toString();
} else if (path is FileSystemEntity) {
p = path.path;
else
} else {
throw ArgumentError();
}
return BuildSystemFile(this, reader, package, p);
}
@ -125,13 +129,16 @@ class BuildFileSystem extends FileSystem {
}
class BuildSystemFile extends File {
@override
final BuildFileSystem fileSystem;
final AssetReader reader;
final String package;
@override
final String path;
BuildSystemFile(this.fileSystem, this.reader, this.package, this.path);
@override
Uri get uri => fileSystem.path.toUri(path);
@override
@ -147,7 +154,8 @@ class BuildSystemFile extends File {
File copySync(String newPath) => throw _unsupported();
@override
Future<File> create({bool recursive = false}) => throw _unsupported();
Future<File> create({bool exclusive = false, bool recursive = false}) =>
throw _unsupported();
@override
void createSync({bool recursive = false}) => throw _unsupported();
@ -312,9 +320,11 @@ class BuildSystemFile extends File {
}
class BuildSystemDirectory extends Directory {
@override
final BuildFileSystem fileSystem;
final AssetReader reader;
final String package;
@override
final String path;
BuildSystemDirectory(this.fileSystem, this.reader, this.package, this.path);

View file

@ -1,5 +1,5 @@
name: jael3_web
version: 6.0.0
version: 7.0.0
description: Experimental virtual DOM/SPA engine built on Jael3. Supports SSR.
publish_to: none
environment:
@ -8,15 +8,15 @@ dependencies:
build: ^2.0.2
build_config: ^1.0.0
code_builder: ^4.0.0
jael3: ^6.0.0
jael3_preprocessor: ^6.0.0
jael3: ^7.0.0
jael3_preprocessor: ^7.0.0
source_gen: ^1.0.2
dev_dependencies:
build_runner: ^2.0.4
build_web_compilers: ^3.0.0
lints: ^2.0.0
# dependency_overrides:
# jael3:
# path: ../jael
# jael3_preprocessor:
# path: ../jael_preprocessor
dependency_overrides:
jael3:
path: ../jael
jael3_preprocessor:
path: ../jael_preprocessor