Files
sdk/pkg/dart2bytecode/testcases/bootstrapping.dart
T
Lasse R.H. Nielsen 711e50389f Remove var and final from parameters in pkg/.
Doesn't change anything in `front_end/*testcases/primary_constructors/`.
(Would have skipped any other file with `test` in its path and
an explicit language version marker, but there weren't any outside
of those `front_end` directories).

Almost no files used as test input were affected, and none testing the actual syntax changed.
The `.../nnbd/required_2.dart` test case was split into a legacy version retaining the `var`/`final` with a language marker, and a new version without the `var`/`final` cases.

The `pkg/analyzer/` tests, and any other tests that have source code
in strings, are not migrated by this CL.

Tested: No change to behavior. One test split into legacy and new.
Change-Id: I7f5aa4cc98001a9adecacd106c0b3be14f96be1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480542
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2026-04-10 09:09:39 -07:00

123 lines
3.3 KiB
Dart

// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// 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.
// Selection of methods used during bootstrapping.
// ignore_for_file: unused_element, unused_field
// -----------------------------------------------------------------
external void _printString(String s);
void _print(arg) {
_printString(arg.toString());
}
_getPrintClosure() => _print;
// -----------------------------------------------------------------
typedef _ScheduleImmediateClosure = void Function(void Function() callback);
class _ScheduleImmediate {
static _ScheduleImmediateClosure? _closure;
}
void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
_ScheduleImmediate._closure = closure;
}
// -----------------------------------------------------------------
base class _NamespaceImpl implements _Namespace {
_NamespaceImpl._();
external static _NamespaceImpl _create(_NamespaceImpl namespace, n);
external static int _getPointer(_NamespaceImpl namespace);
external static int _getDefault();
static _NamespaceImpl? _cachedNamespace = null;
static void _setupNamespace(namespace) {
_cachedNamespace = _create(new _NamespaceImpl._(), namespace);
}
static _NamespaceImpl get _namespace {
if (_cachedNamespace == null) {
_cachedNamespace = _create(new _NamespaceImpl._(), _getDefault());
}
return _cachedNamespace!;
}
static int get _namespacePointer => _getPointer(_namespace);
}
class _Namespace {
static void _setupNamespace(namespace) {
_NamespaceImpl._setupNamespace(namespace);
}
static _Namespace get _namespace => _NamespaceImpl._namespace;
static int get _namespacePointer => _NamespaceImpl._namespacePointer;
}
// -----------------------------------------------------------------
class Stdin {}
final Stdin _stdin = _StdIOUtils._getStdioInputStream(_stdinFD);
int _stdinFD = 0;
int _stdoutFD = 1;
int _stderrFD = 2;
void _setStdioFDs(int stdin, int stdout, int stderr) {
_stdinFD = stdin;
_stdoutFD = stdout;
_stderrFD = stderr;
}
class _StdIOUtils {
external static Stdin _getStdioInputStream(int fd);
}
// -----------------------------------------------------------------
class Timer {}
class SendPort {}
class VMLibraryHooks {
// Example: "dart:isolate _Timer._factory"
static Timer Function(int, void Function(Timer), bool)? timerFactory;
// Example: "dart:io _EventHandler._sendData"
static late void Function(Object?, SendPort, int) eventHandlerSendData;
// A nullary closure that answers the current clock value in milliseconds.
// Example: "dart:io _EventHandler._timerMillisecondClock"
static late int Function() timerMillisecondClock;
// Implementation of package root/map provision.
static String? packageRootString;
static String? packageConfigString;
static Uri? Function()? packageConfigUriSync;
static Uri? Function(Uri)? resolvePackageUriSync;
static Uri Function()? _computeScriptUri;
static Uri? _cachedScript;
static set platformScript(Object? f) {
_computeScriptUri = f as Uri Function()?;
_cachedScript = null;
}
static Uri? get platformScript {
return _cachedScript ??= _computeScriptUri?.call();
}
}
// -----------------------------------------------------------------
main() {}