Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4fcefaf

Browse files
author
Dart CI
committed
Version 2.19.0-381.0.dev
Merge 52562bb into dev
2 parents 874a662 + 52562bb commit 4fcefaf

11 files changed

+80
-106
lines changed

pkg/compiler/lib/src/js_backend/impact_transformer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import '../common/codegen_interfaces.dart' show CodegenImpact;
99
import '../constants/values.dart';
1010
import '../elements/entities.dart';
1111
import '../elements/types.dart';
12-
import '../js_emitter/interfaces.dart' show NativeEmitter;
12+
import '../js_emitter/native_emitter.dart';
1313
import '../js_model/js_world.dart';
1414
import '../native/enqueue.dart';
1515
import '../native/behavior.dart';

pkg/compiler/lib/src/js_emitter/class_stub_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class ClassStubGenerator {
212212
jsAst.Expression code;
213213
if (field.isElided) {
214214
code = js("function() { return #; }",
215-
_emitter.constantReference(field.constantValue));
215+
_emitter.constantReference(field.constantValue!));
216216
} else {
217217
String template;
218218
if (field.needsInterceptedGetterOnReceiver) {

pkg/compiler/lib/src/js_emitter/code_emitter_task.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ abstract class Emitter implements ModularEmitter, interfaces.Emitter {
247247

248248
@override
249249
int compareConstants(ConstantValue a, ConstantValue b);
250+
@override
250251
bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
251252

252253
/// Returns the size of the code generated for a given output [unit].

pkg/compiler/lib/src/js_emitter/interfaces.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import '../elements/entities.dart';
1212
import '../js/js.dart' as jsAst;
1313

1414
import 'metadata_collector.dart' show MetadataCollector;
15+
import 'native_emitter.dart';
1516
import 'startup_emitter/fragment_merger.dart';
1617

1718
abstract class CodeEmitterTask {
@@ -22,19 +23,6 @@ abstract class CodeEmitterTask {
2223
MetadataCollector get metadataCollector;
2324
}
2425

25-
abstract class NativeEmitter {
26-
Map<ClassEntity, List<ClassEntity>> get subtypes;
27-
Map<ClassEntity, List<ClassEntity>> get directSubtypes;
28-
Set<FunctionEntity> get nativeMethods;
29-
List<jsAst.Statement> generateParameterStubStatements(
30-
FunctionEntity member,
31-
bool isInterceptedMethod,
32-
jsAst.Name invocationName,
33-
List<jsAst.Parameter> stubParameters,
34-
List<jsAst.Expression> argumentsBuffer,
35-
int indexOfLastOptionalArgumentInParameters);
36-
}
37-
3826
abstract class ModularEmitter {
3927
jsAst.Expression constructorAccess(ClassEntity e);
4028
jsAst.Expression constantReference(ConstantValue constant);
@@ -55,4 +43,5 @@ abstract class Emitter extends ModularEmitter {
5543
jsAst.Expression generateEmbeddedGlobalAccess(String global);
5644
int compareConstants(ConstantValue a, ConstantValue b);
5745
jsAst.Expression interceptorClassAccess(ClassEntity e);
46+
bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
5847
}

pkg/compiler/lib/src/js_emitter/metadata_collector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class MetadataCollector implements jsAst.TokenFinalizer {
139139
}
140140
}
141141

142-
jsAst.Expression? reifyType(DartType type, OutputUnit outputUnit) {
142+
jsAst.Expression reifyType(DartType type, OutputUnit outputUnit) {
143143
return _addTypeInOutputUnit(type, outputUnit);
144144
}
145145

pkg/compiler/lib/src/js_emitter/model.dart

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Program {
2121

2222
// If this field is not `null` then its value must be emitted in the embedded
2323
// global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes.
24-
final js.Expression typeToInterceptorMap;
24+
final js.Expression? typeToInterceptorMap;
2525

2626
// TODO(floitsch): we should store the metadata directly instead of storing
2727
// the collector. However, the old emitter still updates the data.
@@ -173,7 +173,8 @@ class StaticField {
173173
final FieldEntity element;
174174

175175
final js.Name name;
176-
final js.Name getterName;
176+
// Null for static non-final fields.
177+
final js.Name? getterName;
177178
// TODO(floitsch): the holder for static fields is the isolate object. We
178179
// could remove this field and use the isolate object directly.
179180
final js.Expression code;
@@ -252,7 +253,7 @@ class Class {
252253

253254
// If the class implements a function type, and the type is encoded in the
254255
// metatada table, then this field contains the index into that field.
255-
final js.Expression functionTypeIndex;
256+
final js.Expression? functionTypeIndex;
256257

257258
/// Whether the class must be evaluated eagerly.
258259
bool isEager = false;
@@ -305,11 +306,11 @@ class MixinApplication extends Class {
305306
List<StubMethod> checkedSetters,
306307
List<StubMethod> gettersSetters,
307308
List<StubMethod> isChecks,
308-
js.Expression functionTypeIndex,
309-
{required bool hasRtiField,
310-
required bool onlyForRti,
311-
required bool onlyForConstructor,
312-
required bool isDirectlyInstantiated})
309+
js.Expression? functionTypeIndex,
310+
{required super.hasRtiField,
311+
required super.onlyForRti,
312+
required super.onlyForConstructor,
313+
required super.isDirectlyInstantiated})
313314
: super(
314315
element,
315316
typeData,
@@ -322,10 +323,6 @@ class MixinApplication extends Class {
322323
gettersSetters,
323324
isChecks,
324325
functionTypeIndex,
325-
hasRtiField: hasRtiField,
326-
onlyForRti: onlyForRti,
327-
onlyForConstructor: onlyForConstructor,
328-
isDirectlyInstantiated: isDirectlyInstantiated,
329326
isNative: false,
330327
isClosureBaseClass: false,
331328
isMixinApplicationWithMembers: false);
@@ -363,9 +360,9 @@ class Field {
363360

364361
final bool needsCheckedSetter;
365362

366-
final ConstantValue initializerInAllocator;
363+
final ConstantValue? initializerInAllocator;
367364

368-
final ConstantValue constantValue;
365+
final ConstantValue? constantValue;
369366

370367
final bool isElided;
371368

@@ -407,7 +404,7 @@ abstract class Method {
407404
/// The name of the method. If the method is a [ParameterStubMethod] for a
408405
/// static function, then the name can be `null`. In that case, only the
409406
/// [ParameterStubMethod.callName] should be used.
410-
final js.Name name;
407+
final js.Name? name;
411408
final js.Expression code;
412409

413410
Method(this.element, this.name, this.code);
@@ -488,7 +485,7 @@ class InstanceMethod extends DartMethod {
488485
super.name,
489486
super.code,
490487
super.parameterStubs,
491-
js.Name super.callName, {
488+
super.callName, {
492489
required super.needsTearOff,
493490
super.tearOffName,
494491
this.aliasName,
@@ -508,7 +505,7 @@ class InstanceMethod extends DartMethod {
508505

509506
@override
510507
String toString() {
511-
return 'InstanceMethod(name=${name.key},element=${element}'
508+
return 'InstanceMethod(name=${name!.key},element=${element}'
512509
',code=${js.nodeToString(code)})';
513510
}
514511
}
@@ -517,12 +514,12 @@ class InstanceMethod extends DartMethod {
517514
/// to a method in the original Dart program. Examples are getter and setter
518515
/// stubs and stubs to dispatch calls to methods with optional parameters.
519516
class StubMethod extends Method {
520-
StubMethod(js.Name name, js.Expression code, {MemberEntity? element})
517+
StubMethod(js.Name? name, js.Expression code, {MemberEntity? element})
521518
: super(element, name, code);
522519

523520
@override
524521
String toString() {
525-
return 'StubMethod(name=${name.key},element=${element}'
522+
return 'StubMethod(name=${name!.key},element=${element}'
526523
',code=${js.nodeToString(code)})';
527524
}
528525
}
@@ -544,13 +541,12 @@ class ParameterStubMethod extends StubMethod {
544541
/// If a stub's member can not be torn off, the [callName] is `null`.
545542
js.Name? callName;
546543

547-
ParameterStubMethod(js.Name name, this.callName, js.Expression code,
548-
{required MemberEntity element})
549-
: super(name, code, element: element);
544+
ParameterStubMethod(super.name, this.callName, super.code,
545+
{required super.element});
550546

551547
@override
552548
String toString() {
553-
return 'ParameterStubMethod(name=${name.key}, callName=${callName?.key}'
549+
return 'ParameterStubMethod(name=${name!.key}, callName=${callName?.key}'
554550
', element=${element}'
555551
', code=${js.nodeToString(code)})';
556552
}
@@ -560,7 +556,7 @@ abstract class StaticMethod implements Method {}
560556

561557
class StaticDartMethod extends DartMethod implements StaticMethod {
562558
StaticDartMethod(super.element, super.name, super.code, super.parameterStubs,
563-
js.Name super.callName,
559+
super.callName,
564560
{required super.needsTearOff,
565561
super.tearOffName,
566562
required super.canBeApplied,
@@ -574,7 +570,7 @@ class StaticDartMethod extends DartMethod implements StaticMethod {
574570

575571
@override
576572
String toString() {
577-
return 'StaticDartMethod(name=${name.key},element=${element}'
573+
return 'StaticDartMethod(name=${name!.key},element=${element}'
578574
',code=${js.nodeToString(code)})';
579575
}
580576
}
@@ -586,7 +582,7 @@ class StaticStubMethod extends StubMethod implements StaticMethod {
586582

587583
@override
588584
String toString() {
589-
return 'StaticStubMethod(name=${name.key},element=${element}}'
585+
return 'StaticStubMethod(name=${name!.key},element=${element}}'
590586
',code=${js.nodeToString(code)})';
591587
}
592588
}

pkg/compiler/lib/src/js_emitter/native_emitter.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ import '../native/enqueue.dart' show NativeCodegenEnqueuer;
1717

1818
import 'interfaces.dart' show CodeEmitterTask;
1919
import 'model.dart';
20-
import 'interfaces.dart' as interfaces;
2120

22-
class NativeEmitter implements interfaces.NativeEmitter {
21+
class NativeEmitter {
2322
final CodeEmitterTask _emitterTask;
2423
final JClosedWorld _closedWorld;
2524
final NativeCodegenEnqueuer _nativeCodegenEnqueuer;
@@ -28,15 +27,12 @@ class NativeEmitter implements interfaces.NativeEmitter {
2827
bool hasNativeClasses = false;
2928

3029
// Caches the native subtypes of a native class.
31-
@override
3230
Map<ClassEntity, List<ClassEntity>> subtypes = {};
3331

34-
@override
3532
// Caches the direct native subtypes of a native class.
3633
Map<ClassEntity, List<ClassEntity>> directSubtypes = {};
3734

3835
// Caches the methods that have a native body.
39-
@override
4036
Set<FunctionEntity> nativeMethods = {};
4137

4238
// Type metadata redirections, where the key is the class type data being
@@ -314,7 +310,6 @@ class NativeEmitter implements interfaces.NativeEmitter {
314310
});
315311
}
316312

317-
@override
318313
List<jsAst.Statement> generateParameterStubStatements(
319314
FunctionEntity member,
320315
bool isInterceptedMethod,

0 commit comments

Comments
 (0)