Skip to content

Commit 2bb32ec

Browse files
fishythefishCommit Queue
authored andcommitted
[dart2js] Update pubspec to 3.8 and reformat.
Change-Id: Ib1afd38a7d3694c2e5ed591132f41b147f76d75a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427560 Reviewed-by: Stephen Adams <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent ec6a35c commit 2bb32ec

File tree

205 files changed

+2258
-2341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+2258
-2341
lines changed

pkg/compiler/lib/src/common/codegen.dart

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -102,47 +102,38 @@ class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact {
102102
factory _CodegenImpact.readFromDataSource(DataSourceReader source) {
103103
source.begin(tag);
104104
MemberEntity member = source.readMember();
105-
final dynamicUses =
106-
source
107-
.readListOrNull(() => DynamicUse.readFromDataSource(source))
108-
?.toSet();
109-
final staticUses =
110-
source
111-
.readListOrNull(() => StaticUse.readFromDataSource(source))
112-
?.toSet();
113-
final typeUses =
114-
source
115-
.readListOrNull(() => TypeUse.readFromDataSource(source))
116-
?.toSet();
117-
final constantUses =
118-
source
119-
.readListOrNull(() => ConstantUse.readFromDataSource(source))
120-
?.toSet();
121-
final typeVariableBoundsSubtypeChecks =
122-
source.readListOrNull(() {
123-
return (source.readDartType(), source.readDartType());
124-
})?.toSet();
105+
final dynamicUses = source
106+
.readListOrNull(() => DynamicUse.readFromDataSource(source))
107+
?.toSet();
108+
final staticUses = source
109+
.readListOrNull(() => StaticUse.readFromDataSource(source))
110+
?.toSet();
111+
final typeUses = source
112+
.readListOrNull(() => TypeUse.readFromDataSource(source))
113+
?.toSet();
114+
final constantUses = source
115+
.readListOrNull(() => ConstantUse.readFromDataSource(source))
116+
?.toSet();
117+
final typeVariableBoundsSubtypeChecks = source.readListOrNull(() {
118+
return (source.readDartType(), source.readDartType());
119+
})?.toSet();
125120
final constSymbols = source.readStringsOrNull()?.toSet();
126121
final specializedGetInterceptors = source.readListOrNull(() {
127122
return source.readClasses().toSet();
128123
});
129124
bool usesInterceptor = source.readBool();
130125
final asyncMarkersValue = source.readInt();
131126
final asyncMarkers = EnumSet<AsyncMarker>.fromRawBits(asyncMarkersValue);
132-
final genericInstantiations =
133-
source
134-
.readListOrNull(
135-
() => GenericInstantiation.readFromDataSource(source),
136-
)
137-
?.toSet();
127+
final genericInstantiations = source
128+
.readListOrNull(() => GenericInstantiation.readFromDataSource(source))
129+
?.toSet();
138130
final nativeBehaviors = source.readListOrNull(
139131
() => NativeBehavior.readFromDataSource(source),
140132
);
141133
final nativeMethods = source.readMembersOrNull<FunctionEntity>()?.toSet();
142-
final oneShotInterceptors =
143-
source
144-
.readListOrNull(() => Selector.readFromDataSource(source))
145-
?.toSet();
134+
final oneShotInterceptors = source
135+
.readListOrNull(() => Selector.readFromDataSource(source))
136+
?.toSet();
146137
source.end(tag);
147138
return _CodegenImpact.internal(
148139
member,
@@ -455,8 +446,8 @@ class CodegenResult {
455446
source.begin(tag);
456447
js.Fun? code = source.readJsNodeOrNull() as js.Fun?;
457448
CodegenImpact impact = CodegenImpact.readFromDataSource(source);
458-
final deferredExpressionData = js
459-
.DeferredExpressionRegistry.readDataFromDataSource(source);
449+
final deferredExpressionData =
450+
js.DeferredExpressionRegistry.readDataFromDataSource(source);
460451
source.end(tag);
461452
if (code != null) {
462453
code = code.withAnnotation(deferredExpressionData) as js.Fun;

pkg/compiler/lib/src/common/elements.dart

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ abstract class CommonElements {
100100
late final ClassEntity streamClass = _findClass(asyncLibrary, 'Stream');
101101

102102
/// The dart:core library.
103-
late final LibraryEntity coreLibrary =
104-
_env.lookupLibrary(Uris.dartCore, required: true)!;
103+
late final LibraryEntity coreLibrary = _env.lookupLibrary(
104+
Uris.dartCore,
105+
required: true,
106+
)!;
105107

106108
/// The dart:async library.
107109
late final LibraryEntity? asyncLibrary = _env.lookupLibrary(Uris.dartAsync);
@@ -118,12 +120,16 @@ abstract class CommonElements {
118120
);
119121

120122
/// The dart:typed_data library.
121-
late final LibraryEntity typedDataLibrary =
122-
_env.lookupLibrary(Uris.dartNativeTypedData, required: true)!;
123+
late final LibraryEntity typedDataLibrary = _env.lookupLibrary(
124+
Uris.dartNativeTypedData,
125+
required: true,
126+
)!;
123127

124128
/// The dart:_js_shared_embedded_names library.
125-
late final LibraryEntity sharedEmbeddedNamesLibrary =
126-
_env.lookupLibrary(Uris.dartJSSharedEmbeddedNames, required: true)!;
129+
late final LibraryEntity sharedEmbeddedNamesLibrary = _env.lookupLibrary(
130+
Uris.dartJSSharedEmbeddedNames,
131+
required: true,
132+
)!;
127133

128134
/// The dart:_js_helper library.
129135
late final LibraryEntity? jsHelperLibrary = _env.lookupLibrary(
@@ -146,12 +152,16 @@ abstract class CommonElements {
146152
);
147153

148154
/// The dart:_rti library.
149-
late final LibraryEntity rtiLibrary =
150-
_env.lookupLibrary(Uris.dartRti, required: true)!;
155+
late final LibraryEntity rtiLibrary = _env.lookupLibrary(
156+
Uris.dartRti,
157+
required: true,
158+
)!;
151159

152160
/// The dart:_internal library.
153-
late final LibraryEntity internalLibrary =
154-
_env.lookupLibrary(Uris.dartInternal, required: true)!;
161+
late final LibraryEntity internalLibrary = _env.lookupLibrary(
162+
Uris.dartInternal,
163+
required: true,
164+
)!;
155165

156166
/// The dart:js_util library.
157167
late final LibraryEntity? dartJsUtilLibrary = _env.lookupLibrary(
@@ -185,8 +195,10 @@ abstract class CommonElements {
185195
// TODO(johnniwinther): Kernel does not include redirecting factories
186196
// so this cannot be found in kernel. Find a consistent way to handle
187197
// this and similar cases.
188-
return _symbolConstructorTarget ??=
189-
_env.lookupConstructor(symbolImplementationClass, '')!;
198+
return _symbolConstructorTarget ??= _env.lookupConstructor(
199+
symbolImplementationClass,
200+
'',
201+
)!;
190202
}
191203

192204
void _ensureSymbolConstructorDependencies() {
@@ -227,8 +239,10 @@ abstract class CommonElements {
227239
}
228240

229241
/// The function `identical` in dart:core.
230-
late final FunctionEntity identicalFunction =
231-
_findLibraryMember(coreLibrary, 'identical')!;
242+
late final FunctionEntity identicalFunction = _findLibraryMember(
243+
coreLibrary,
244+
'identical',
245+
)!;
232246

233247
/// Whether [element] is the `Function.apply` method.
234248
///
@@ -420,8 +434,9 @@ abstract class CommonElements {
420434
bool onlyStringKeys = false,
421435
}) {
422436
// TODO(51534): Use CONST_CANONICAL_TYPE(T_i) for arguments.
423-
ClassEntity classElement =
424-
onlyStringKeys ? constantStringMapClass : generalConstantMapClass;
437+
ClassEntity classElement = onlyStringKeys
438+
? constantStringMapClass
439+
: generalConstantMapClass;
425440
return _env.createInterfaceType(classElement, sourceType.typeArguments);
426441
}
427442

@@ -430,25 +445,25 @@ abstract class CommonElements {
430445
bool onlyStringKeys = false,
431446
}) {
432447
// TODO(51534): Use CONST_CANONICAL_TYPE(T_i) for arguments.
433-
ClassEntity classElement =
434-
onlyStringKeys ? constantStringSetClass : generalConstantSetClass;
448+
ClassEntity classElement = onlyStringKeys
449+
? constantStringSetClass
450+
: generalConstantSetClass;
435451
return _env.createInterfaceType(classElement, sourceType.typeArguments);
436452
}
437453

438454
/// Returns the field that holds the internal name in the implementation class
439455
/// for `Symbol`.
440456
441-
FieldEntity get symbolField =>
442-
_symbolImplementationField ??=
443-
_env.lookupLocalClassMember(
444-
symbolImplementationClass,
445-
PrivateName(
446-
'_name',
447-
symbolImplementationClass.library.canonicalUri,
448-
),
449-
required: true,
450-
)
451-
as FieldEntity;
457+
FieldEntity get symbolField => _symbolImplementationField ??=
458+
_env.lookupLocalClassMember(
459+
symbolImplementationClass,
460+
PrivateName(
461+
'_name',
462+
symbolImplementationClass.library.canonicalUri,
463+
),
464+
required: true,
465+
)
466+
as FieldEntity;
452467

453468
InterfaceType get symbolImplementationType =>
454469
_env.getRawType(symbolImplementationClass);
@@ -462,10 +477,12 @@ abstract class CommonElements {
462477
return _mapLiteralClass!;
463478
}
464479

465-
late final ConstructorEntity mapLiteralConstructor =
466-
_env.lookupConstructor(mapLiteralClass, '_literal')!;
467-
late final ConstructorEntity mapLiteralConstructorEmpty =
468-
_env.lookupConstructor(mapLiteralClass, '_empty')!;
480+
late final ConstructorEntity mapLiteralConstructor = _env.lookupConstructor(
481+
mapLiteralClass,
482+
'_literal',
483+
)!;
484+
late final ConstructorEntity mapLiteralConstructorEmpty = _env
485+
.lookupConstructor(mapLiteralClass, '_empty')!;
469486
late final FunctionEntity mapLiteralUntypedMaker =
470487
_env.lookupLocalClassMember(
471488
mapLiteralClass,
@@ -484,10 +501,12 @@ abstract class CommonElements {
484501
'LinkedHashSet',
485502
);
486503

487-
late final ConstructorEntity setLiteralConstructor =
488-
_env.lookupConstructor(setLiteralClass, '_literal')!;
489-
late final ConstructorEntity setLiteralConstructorEmpty =
490-
_env.lookupConstructor(setLiteralClass, '_empty')!;
504+
late final ConstructorEntity setLiteralConstructor = _env.lookupConstructor(
505+
setLiteralClass,
506+
'_literal',
507+
)!;
508+
late final ConstructorEntity setLiteralConstructorEmpty = _env
509+
.lookupConstructor(setLiteralClass, '_empty')!;
491510
late final FunctionEntity setLiteralUntypedMaker =
492511
_env.lookupLocalClassMember(
493512
setLiteralClass,
@@ -716,8 +735,10 @@ abstract class CommonElements {
716735
late final FunctionEntity getNativeInterceptorMethod =
717736
_findInterceptorsFunction('getNativeInterceptor');
718737

719-
late final ConstructorEntity jsArrayTypedConstructor =
720-
_env.lookupConstructor(jsArrayClass, 'typed')!;
738+
late final ConstructorEntity jsArrayTypedConstructor = _env.lookupConstructor(
739+
jsArrayClass,
740+
'typed',
741+
)!;
721742

722743
// From dart:_js_helper
723744
// TODO(johnniwinther): Avoid the need for this (from [CheckedModeHelper]).

pkg/compiler/lib/src/common/tasks.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,11 @@ abstract class CompilerTask {
109109
return runZoned(
110110
action,
111111
zoneValues: _zoneValues ??= {_measurer: this},
112-
zoneSpecification:
113-
_zoneSpecification ??= ZoneSpecification(
114-
run: _run,
115-
runUnary: _runUnary,
116-
runBinary: _runBinary,
117-
),
112+
zoneSpecification: _zoneSpecification ??= ZoneSpecification(
113+
run: _run,
114+
runUnary: _runUnary,
115+
runBinary: _runBinary,
116+
),
118117
);
119118
}
120119

pkg/compiler/lib/src/compiler.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,9 @@ class Compiler {
159159
options.validate();
160160
environment = Environment(options.environment);
161161

162-
abstractValueStrategy =
163-
options.useTrivialAbstractValueDomain
164-
? const TrivialAbstractValueStrategy()
165-
: const TypeMaskStrategy();
162+
abstractValueStrategy = options.useTrivialAbstractValueDomain
163+
? const TrivialAbstractValueStrategy()
164+
: const TypeMaskStrategy();
166165
if (options.debugGlobalInference) {
167166
abstractValueStrategy = ComputableAbstractValueStrategy(
168167
abstractValueStrategy,
@@ -267,8 +266,10 @@ class Compiler {
267266
return '${library.importUri}(${library.fileUri})';
268267
}
269268

270-
var unusedLibraries =
271-
component.libraries.where(isUnused).map(libraryString).toList();
269+
var unusedLibraries = component.libraries
270+
.where(isUnused)
271+
.map(libraryString)
272+
.toList();
272273
unusedLibraries.sort();
273274
var jsonLibraries = jsonEncode(unusedLibraries);
274275
outputProvider.createOutputSink(
@@ -318,10 +319,9 @@ class Compiler {
318319
if (options.readProgramSplit != null) {
319320
var constraintUri = options.readProgramSplit;
320321
var constraintParser = psc.Parser();
321-
var programSplitJson =
322-
await CompilerFileSystem(
323-
provider,
324-
).entityForUri(constraintUri!).readAsString();
322+
var programSplitJson = await CompilerFileSystem(
323+
provider,
324+
).entityForUri(constraintUri!).readAsString();
325325
programSplitConstraintsData = constraintParser.read(programSplitJson);
326326
}
327327

@@ -353,9 +353,9 @@ class Compiler {
353353
List<Uri> libraries,
354354
) {
355355
frontendStrategy.registerLoadedLibraries(component, libraries);
356-
ResolutionEnqueuer resolutionEnqueuer = frontendStrategy
357-
.createResolutionEnqueuer(enqueueTask, this)
358-
..onEmptyForTesting = onResolutionQueueEmptyForTesting;
356+
ResolutionEnqueuer resolutionEnqueuer =
357+
frontendStrategy.createResolutionEnqueuer(enqueueTask, this)
358+
..onEmptyForTesting = onResolutionQueueEmptyForTesting;
359359
if (retainDataForTesting) {
360360
resolutionEnqueuerForTesting = resolutionEnqueuer;
361361
resolutionWorldBuilderForTesting = resolutionEnqueuer.worldBuilder;
@@ -455,8 +455,8 @@ class Compiler {
455455
}
456456
return output.withNewComponent(component);
457457
} else {
458-
ir.Component component =
459-
await serializationTask.deserializeComponentAndUpdateOptions();
458+
ir.Component component = await serializationTask
459+
.deserializeComponentAndUpdateOptions();
460460
if (retainDataForTesting) {
461461
componentForTesting = component;
462462
}
@@ -952,8 +952,8 @@ class Compiler {
952952
// so that tests can determine the cause of the message.
953953
final messageText =
954954
diagnosticMessage is DiagnosticCfeMessage && options.testMode
955-
? diagnosticMessage.messageCode
956-
: '$message';
955+
? diagnosticMessage.messageCode
956+
: '$message';
957957
if (span.isUnknown) {
958958
callUserHandler(message, null, null, null, messageText, kind);
959959
} else {

pkg/compiler/lib/src/constants/constant_system.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,9 @@ class ShiftRightOperation extends BinaryBitOperation {
425425
ConstantValue adjustedLeft = left;
426426
if (left is IntConstantValue) {
427427
BigInt value = left.intValue;
428-
BigInt truncated =
429-
value.isNegative ? value.toSigned(32) : value.toUnsigned(32);
428+
BigInt truncated = value.isNegative
429+
? value.toSigned(32)
430+
: value.toUnsigned(32);
430431
if (value != truncated) {
431432
adjustedLeft = createInt(truncated);
432433
}

0 commit comments

Comments
 (0)