Skip to content

Commit

Permalink
[dart2js] Update pubspec to Dart 3.7 and reformat.
Browse files Browse the repository at this point in the history
All non-pubspec changes generated by `dart format pkg/compiler`.

Change-Id: Iadaa70974816d96ccb47813fe72d5a2bb83d6bda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400181
Reviewed-by: Nate Biggs <[email protected]>
Commit-Queue: Mayank Patke <[email protected]>
  • Loading branch information
fishythefish authored and Commit Queue committed Dec 13, 2024
1 parent a001a5e commit c878108
Show file tree
Hide file tree
Showing 723 changed files with 49,204 additions and 28,130 deletions.
49 changes: 33 additions & 16 deletions pkg/compiler/lib/compiler_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ enum Diagnostic {
/// For example, consider a duplicated definition. The compiler first emits a
/// message about the duplicated definition, then emits an info message about
/// the location of the existing definition.
context('context'),
;
context('context');

/// An [int] representation of this kind. The ordinals are designed
/// to be used as bitsets.
Expand Down Expand Up @@ -109,8 +108,10 @@ abstract class CompilerInput {
/// zero-terminated list of encoded bytes. If the input kind is
/// `InputKind.binary` the resulting list is the raw bytes from the input
/// source.
Future<Input<Uint8List>> readFromUri(Uri uri,
{InputKind inputKind = InputKind.utf8});
Future<Input<Uint8List>> readFromUri(
Uri uri, {
InputKind inputKind = InputKind.utf8,
});

/// Register that [uri] should be an `InputKind.UTF8` input with the
/// given [source] of contents.
Expand Down Expand Up @@ -211,8 +212,14 @@ abstract class CompilerDiagnostics {
/// Experimental: [code] gives access to an id for the messages. Currently it
/// is the [Message] used to create the diagnostic, if available, from which
/// the [MessageKind] is accessible.
void report(Message? code, Uri? uri, int? begin, int? end, String text,
Diagnostic kind);
void report(
Message? code,
Uri? uri,
int? begin,
int? end,
String text,
Diagnostic kind,
);
}

/// Information resulting from the compilation.
Expand All @@ -232,8 +239,11 @@ class CompilationResult {
/// This is used to speed up batch mode.
final fe.InitializedCompilerState? kernelInitializedCompilerState;

CompilationResult(this.compiler,
{this.isSuccess = true, this.kernelInitializedCompilerState});
CompilationResult(
this.compiler, {
this.isSuccess = true,
this.kernelInitializedCompilerState,
});
}

// Unless explicitly allowed, passing [:null:] for any argument to the
Expand All @@ -249,15 +259,22 @@ class CompilationResult {
/// is invoked at least once with `kind == Diagnostic.ERROR` or
/// `kind == Diagnostic.CRASH`.
Future<CompilationResult> compile(
CompilerOptions compilerOptions,
CompilerInput compilerInput,
CompilerDiagnostics compilerDiagnostics,
CompilerOutput compilerOutput) {
CompilerOptions compilerOptions,
CompilerInput compilerInput,
CompilerDiagnostics compilerDiagnostics,
CompilerOutput compilerOutput,
) {
var compiler = Compiler(
compilerInput, compilerOutput, compilerDiagnostics, compilerOptions);
compilerInput,
compilerOutput,
compilerDiagnostics,
compilerOptions,
);
return compiler.run().then((bool success) {
return CompilationResult(compiler,
isSuccess: success,
kernelInitializedCompilerState: compiler.initializedCompilerState);
return CompilationResult(
compiler,
isSuccess: success,
kernelInitializedCompilerState: compiler.initializedCompilerState,
);
});
}
29 changes: 19 additions & 10 deletions pkg/compiler/lib/src/closure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import 'serialization/serialization.dart';
abstract class ClosureData {
/// Deserializes a [ClosureData] object from [source].
factory ClosureData.readFromDataSource(
JsToElementMap elementMap, DataSourceReader source) =
ClosureDataImpl.readFromDataSource;
JsToElementMap elementMap,
DataSourceReader source,
) = ClosureDataImpl.readFromDataSource;

/// Serializes this [ClosureData] to [sink].
void writeToDataSink(DataSinkWriter sink);
Expand Down Expand Up @@ -113,8 +114,10 @@ class ScopeInfo {
/// In the case of loops, this is the set of iteration variables (or any
/// variables declared in the for loop expression (`for (...here...)`) that
/// need to be boxed to snapshot their value.
void forEachBoxedVariable(KernelToLocalsMap localsMap,
void Function(Local local, FieldEntity field) f) {}
void forEachBoxedVariable(
KernelToLocalsMap localsMap,
void Function(Local local, FieldEntity field) f,
) {}

/// True if [variable] has been mutated and is also used in another scope.
bool isBoxedVariable(KernelToLocalsMap localsMap, Local variable) => false;
Expand Down Expand Up @@ -240,14 +243,16 @@ class ClosureRepresentationInfo extends ScopeInfo {

/// Deserializes a [ClosureRepresentationInfo] object from [source].
factory ClosureRepresentationInfo.readFromDataSource(
DataSourceReader source) {
DataSourceReader source,
) {
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
switch (kind) {
case ScopeInfoKind.scopeInfo:
case ScopeInfoKind.capturedScope:
case ScopeInfoKind.capturedLoopScope:
throw UnsupportedError(
'Unexpected ClosureRepresentationInfo kind $kind');
'Unexpected ClosureRepresentationInfo kind $kind',
);
case ScopeInfoKind.closureRepresentationInfo:
return JsClosureClassInfo.readFromDataSource(source);
}
Expand Down Expand Up @@ -292,14 +297,18 @@ class ClosureRepresentationInfo extends ScopeInfo {
/// strictly variables defined in this closure, unlike the behavior in
/// the superclass ScopeInfo.
@override
void forEachBoxedVariable(KernelToLocalsMap localsMap,
void Function(Local local, FieldEntity field) f) {}
void forEachBoxedVariable(
KernelToLocalsMap localsMap,
void Function(Local local, FieldEntity field) f,
) {}

/// Loop through each free variable in this closure. Free variables are the
/// variables that have been captured *just* in this closure, not in nested
/// scopes.
void forEachFreeVariable(KernelToLocalsMap localsMap,
void Function(Local variable, FieldEntity field) f) {}
void forEachFreeVariable(
KernelToLocalsMap localsMap,
void Function(Local variable, FieldEntity field) f,
) {}

// TODO(efortuna): Remove this method. The old system was using
// ClosureClassMaps for situations other than closure class maps, and that's
Expand Down
Loading

0 comments on commit c878108

Please sign in to comment.