Skip to content

Commit d427700

Browse files
natebiggsCommit Bot
authored and
Commit Bot
committed
[dart2js] Migrate some easy files to nnbd.
Change-Id: Ib61264fa3febd9067909292d5a4468a9044118a2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247286 Reviewed-by: Stephen Adams <[email protected]> Commit-Queue: Nate Biggs <[email protected]>
1 parent 3c58404 commit d427700

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

pkg/compiler/lib/src/ir/cached_static_type.dart

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.10
6-
75
import 'package:kernel/ast.dart' as ir;
86
import 'package:kernel/type_environment.dart' as ir;
97
import 'static_type_base.dart';
@@ -25,24 +23,13 @@ class CachedStaticType extends StaticTypeBase implements StaticTypeProvider {
2523
: super(staticTypeContext.typeEnvironment);
2624

2725
@override
28-
ir.DartType getStaticType(ir.Expression node) {
29-
ir.DartType type = node.accept(this);
30-
assert(type != null, "No static type found for ${node.runtimeType}.");
31-
return type;
32-
}
26+
ir.DartType getStaticType(ir.Expression node) => node.accept(this)!;
3327

3428
@override
35-
ir.DartType getForInIteratorType(ir.ForInStatement node) {
36-
ir.DartType type = _cache.getForInIteratorType(node);
37-
assert(type != null, "No for-in iterator type found for ${node}.");
38-
return type;
39-
}
29+
ir.DartType getForInIteratorType(ir.ForInStatement node) =>
30+
_cache.getForInIteratorType(node)!;
4031

41-
ir.DartType _getStaticType(ir.Expression node) {
42-
ir.DartType type = _cache[node];
43-
assert(type != null, "No static type cached for ${node.runtimeType}.");
44-
return type;
45-
}
32+
ir.DartType _getStaticType(ir.Expression node) => _cache[node]!;
4633

4734
@override
4835
ir.DartType visitVariableGet(ir.VariableGet node) => _getStaticType(node);

pkg/compiler/lib/src/universe/feature.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.10
6-
75
// TODO(sigmund): rename universe => world
86
/// Describes individual features that may be seen in a program. Most features
97
/// can be described only by name using the [Feature] enum, some features are
@@ -249,7 +247,7 @@ class GenericInstantiation {
249247

250248
factory GenericInstantiation.readFromDataSource(DataSourceReader source) {
251249
source.begin(tag);
252-
DartType functionType = source.readDartType();
250+
final functionType = source.readDartType() as FunctionType;
253251
List<DartType> typeArguments = source.readDartTypes();
254252
source.end(tag);
255253
return GenericInstantiation(functionType, typeArguments);

0 commit comments

Comments
 (0)