[cfe] Migrate first part of wave 7
Change-Id: Ie68bae61379bd489177e587282b833c49f8cf3b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196665
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/lib/src/fasta/builder/builder.dart b/pkg/front_end/lib/src/fasta/builder/builder.dart
index eba0f9d..fdd91f3 100644
--- a/pkg/front_end/lib/src/fasta/builder/builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/builder.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
library fasta.declaration;
import '../problems.dart' show unsupported;
@@ -12,7 +10,7 @@
/// Used when multiple things with the same name are declared within the same
/// parent. Only used for top-level and class-member declarations, not for
/// block scopes.
- Builder next;
+ Builder? next;
Builder get parent;
@@ -211,7 +209,7 @@
abstract class BuilderImpl implements Builder {
@override
- Builder next;
+ Builder? next;
BuilderImpl();
diff --git a/pkg/front_end/lib/src/fasta/hybrid_file_system.dart b/pkg/front_end/lib/src/fasta/hybrid_file_system.dart
index 10b1a47..56b1627 100644
--- a/pkg/front_end/lib/src/fasta/hybrid_file_system.dart
+++ b/pkg/front_end/lib/src/fasta/hybrid_file_system.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
/// A memory + physical file system used to mock input for tests but provide
/// sdk sources from disk.
library front_end.src.hybrid_file_system;
@@ -18,7 +16,7 @@
final MemoryFileSystem memory;
final FileSystem physical;
- HybridFileSystem(this.memory, [FileSystem _physical])
+ HybridFileSystem(this.memory, [FileSystem? _physical])
: physical = _physical ?? StandardFileSystem.instance;
@override
@@ -30,19 +28,19 @@
/// entity.
class HybridFileSystemEntity implements FileSystemEntity {
final Uri uri;
- FileSystemEntity _delegate;
+ FileSystemEntity? _delegate;
final HybridFileSystem _fs;
HybridFileSystemEntity(this.uri, this._fs);
Future<FileSystemEntity> get delegate async {
- if (_delegate != null) return _delegate;
+ if (_delegate != null) return _delegate!;
FileSystemEntity entity = _fs.memory.entityForUri(uri);
if (((uri.scheme != 'file' && uri.scheme != 'data') &&
_fs.physical is StandardFileSystem) ||
await entity.exists()) {
_delegate = entity;
- return _delegate;
+ return _delegate!;
}
return _delegate = _fs.physical.entityForUri(uri);
}
diff --git a/pkg/front_end/lib/src/fasta/identifiers.dart b/pkg/front_end/lib/src/fasta/identifiers.dart
index f7dcd4f..422569a 100644
--- a/pkg/front_end/lib/src/fasta/identifiers.dart
+++ b/pkg/front_end/lib/src/fasta/identifiers.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
library fasta.qualified_name;
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show Token;
@@ -21,7 +19,7 @@
int get charOffset => token.charOffset;
- Expression get initializer => null;
+ Expression? get initializer => null;
int get endCharOffset => charOffset + name.length;
diff --git a/pkg/front_end/lib/src/fasta/ignored_parser_errors.dart b/pkg/front_end/lib/src/fasta/ignored_parser_errors.dart
index 04b0e4a..fbd01f9 100644
--- a/pkg/front_end/lib/src/fasta/ignored_parser_errors.dart
+++ b/pkg/front_end/lib/src/fasta/ignored_parser_errors.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
library fasta.ignored_parser_errors;
import 'package:_fe_analyzer_shared/src/parser/parser.dart' show optional;
diff --git a/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart b/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart
index 3f27451..5582ac5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
-// @dart = 2.9
-
library fasta.implicit_type_argument;
import 'package:kernel/ast.dart'
@@ -35,11 +33,11 @@
@override
R accept1<R, A>(DartTypeVisitor1<R, A> v, A arg) {
- throw unhandled("$runtimeType", "${v.runtimeType}", -1, null);
+ return unhandled("$runtimeType", "${v.runtimeType}", -1, null);
}
@override
- visitChildren(Visitor<Object> v) {
+ visitChildren(Visitor v) {
unhandled("$runtimeType", "${v.runtimeType}", -1, null);
}
@@ -54,7 +52,7 @@
}
@override
- bool equals(Object other, Assumptions assumptions) => this == other;
+ bool equals(Object other, Assumptions? assumptions) => this == other;
@override
void toTextInternal(AstPrinter printer) {
diff --git a/pkg/front_end/lib/src/fasta/modifier.dart b/pkg/front_end/lib/src/fasta/modifier.dart
index 32a6aa2..0a41ca0 100644
--- a/pkg/front_end/lib/src/fasta/modifier.dart
+++ b/pkg/front_end/lib/src/fasta/modifier.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
library fasta.modifier;
import 'problems.dart' show unhandled;
@@ -92,7 +90,7 @@
toString() => "modifier(${'$kind'.substring('ModifierEnum.'.length)})";
- static int toMask(List<Modifier> modifiers) {
+ static int toMask(List<Modifier>? modifiers) {
int result = 0;
if (modifiers == null) return result;
for (Modifier modifier in modifiers) {
@@ -101,7 +99,7 @@
return result;
}
- static int validateVarFinalOrConst(String lexeme) {
+ static int validateVarFinalOrConst(String? lexeme) {
if (lexeme == null) return 0;
if (identical('const', lexeme)) return Const.mask;
if (identical('final', lexeme)) return Final.mask;
diff --git a/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart b/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
index 572feea..b6f3f9a 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.9
-
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart' show CoreTypes;
@@ -18,19 +16,19 @@
set transformSetLiterals(bool value);
Expression buildProblem(Message message, int charOffset, int length,
- {List<LocatedMessage> context, bool suppressMessage});
+ {List<LocatedMessage>? context, bool suppressMessage = false});
LocatedMessage checkArgumentsForType(
FunctionType function, Arguments arguments, int offset,
{bool isExtensionMemberInvocation = false});
void addProblem(Message message, int charOffset, int length,
- {List<LocatedMessage> context, bool wasHandled});
+ {List<LocatedMessage>? context, bool wasHandled = false});
Expression wrapInProblem(
Expression expression, Message message, int fileOffset, int length,
- {List<LocatedMessage> context});
+ {List<LocatedMessage>? context});
String constructorNameForDiagnostics(String name,
- {String className, bool isSuper});
+ {String? className, bool isSuper = false});
}