Skip to content

Commit

Permalink
Version 3.3.0-149.0.dev
Browse files Browse the repository at this point in the history
Merge 2ee771a into dev
  • Loading branch information
Dart CI committed Nov 18, 2023
2 parents 3d4886a + 2ee771a commit 564cfb2
Show file tree
Hide file tree
Showing 5,928 changed files with 503 additions and 690,549 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 0 additions & 16 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,11 @@ tests/web/eof_line_ending_test.dart -text
tests/web/string_interpolation_test.dart -text
tests/web/string_interpolation_dynamic_test.dart -text
tests/web/literal_string_juxtaposition_test.dart -text
tests/web_2/eof_line_ending_test.dart -text
tests/web_2/string_interpolation_test.dart -text
tests/web_2/string_interpolation_dynamic_test.dart -text
tests/web_2/literal_string_juxtaposition_test.dart -text
tests/language/string/raw_string_test.dart -text
tests/language/string/multiline_strings_test.dart -text
tests/language/string/multiline_newline_cr.dart -text
tests/language/string/multiline_newline_crlf.dart -text
tests/language/string/multiline_newline_lf.dart -text
tests/language_2/string/raw_string_test.dart -text
tests/language_2/string/multiline_strings_test.dart -text
tests/language_2/string/multiline_newline_cr.dart -text
tests/language_2/string/multiline_newline_crlf.dart -text
tests/language_2/string/multiline_newline_lf.dart -text
tests/lib_2/convert/json_pretty_test.dart -text
tests/lib_2/mirrors/method_mirror_source_line_ending_cr.dart -text
tests/lib_2/mirrors/method_mirror_source_line_ending_crlf.dart -text
tests/lib_2/mirrors/method_mirror_source_line_ending_lf.dart -text
tests/lib_2/mirrors/method_mirror_source_line_ending_test.dart -text
tests/lib_2/mirrors/method_mirror_source_other.dart -text
tests/lib_2/mirrors/method_mirror_source_test.dart -text
tests/lib/mirrors/method_mirror_source_line_ending_cr.dart -text
tests/lib/mirrors/method_mirror_source_line_ending_crlf.dart -text
tests/lib/mirrors/method_mirror_source_line_ending_lf.dart -text
Expand Down
4 changes: 0 additions & 4 deletions pkg/_js_interop_checks/lib/js_interop_checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ class JsInteropChecks extends RecursiveVisitor {
RegExp(r'(?<!generated_)tests/web/native'),
RegExp(r'(?<!generated_)tests/web/internal'),
'generated_tests/web/native/native_test',
RegExp(r'(?<!generated_)tests/web_2/native'),
RegExp(r'(?<!generated_)tests/web_2/internal'),
'generated_tests/web_2/native/native_test',
];

static final List<Pattern> _allowedTrustTypesTestPatterns = [
RegExp(r'(?<!generated_)tests/lib/js'),
RegExp(r'(?<!generated_)tests/lib_2/js'),
];

/// Libraries that cannot be used when [_enforceStrictMode] is true.
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ conclusions on language samples in the testing directory.
From the root of the SDK:

```
tools/test.py --build --use-sdk -c dart2analyzer co19_2 language_2
tools/test.py --build --use-sdk -c dart2analyzer co19 language
```

This will build the Dart VM and compile dartanalyzer into a snapshot, then use
Expand Down
2 changes: 1 addition & 1 deletion pkg/bisect_dart/lib/src/bisection_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BisectionConfig {
start: '23f41452',
end: '2c97bd78',
testCommands: [
'python3 tools/test.py --build -n dartk-linux-debug-x64 lib_2/isolate/package_resolve_test',
'python3 tools/test.py --build -n dartk-linux-debug-x64 lib/isolate/package_resolve_test',
],
sdkPath: Directory.current.uri,
failureString: "Error: The argument type 'String' can't "
Expand Down
64 changes: 36 additions & 28 deletions pkg/compiler/lib/src/js/rewrite_async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
rewrittenBody = js.LabeledStatement(outerLabelName, rewrittenBody);
}
rewrittenBody = js.js
.statement('while (true) {#}', rewrittenBody)
.statement('while (true) #', rewrittenBody)
.withSourceInformation(bodySourceInformation);
List<js.VariableInitialization> variables = [];

Expand Down Expand Up @@ -883,14 +883,14 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
? js.Block.empty()
: js.js.statement('# = #;', [result, left]);
if (node.op == "&&") {
addStatement(js.js.statement('if (#) {#} else #', [
addStatement(js.js.statement('if (#) #; else #', [
left,
gotoAndBreak(thenLabel, node.sourceInformation),
assignLeft
]));
} else {
assert(node.op == "||");
addStatement(js.js.statement('if (#) {#} else #', [
addStatement(js.js.statement('if (#) #; else #', [
left,
assignLeft,
gotoAndBreak(thenLabel, node.sourceInformation)
Expand Down Expand Up @@ -1913,31 +1913,39 @@ class AsyncRewriter extends AsyncRewriterBase {
js.VariableDeclarationList variableDeclarations,
js.JavaScriptNodeSourceInformation? functionSourceInformation,
js.JavaScriptNodeSourceInformation? bodySourceInformation) {
js.Expression asyncRethrowCall =
js.js("#asyncRethrow(#result, #completer)", {
"result": resultName,
"asyncRethrow": asyncRethrow,
"completer": completer,
}).withSourceInformation(bodySourceInformation);
js.Statement returnAsyncRethrow = js.Return(asyncRethrowCall)
.withSourceInformation(bodySourceInformation);
js.Statement errorCheck = js.js.statement("""
if (#errorCode === #ERROR) {
if (#hasHandlerLabels) {
#currentError = #result;
#goto = #handler;
} else
#returnAsyncRethrow;
}""", {
"errorCode": errorCodeName,
"ERROR": js.number(status_codes.ERROR),
"hasHandlerLabels": hasHandlerLabels,
"currentError": currentError,
"result": resultName,
"goto": goto,
"handler": handler,
"returnAsyncRethrow": returnAsyncRethrow,
}).withSourceInformation(bodySourceInformation);
js.Statement errorCheck;
if (hasHandlerLabels) {
errorCheck = js.js.statement("""
if (#errorCode === #ERROR) {
#currentError = #result;
#goto = #handler;
}""", {
"errorCode": errorCodeName,
"ERROR": js.number(status_codes.ERROR),
"currentError": currentError,
"result": resultName,
"goto": goto,
"handler": handler,
}).withSourceInformation(bodySourceInformation);
} else {
js.Expression asyncRethrowCall =
js.js("#asyncRethrow(#result, #completer)", {
"result": resultName,
"asyncRethrow": asyncRethrow,
"completer": completer,
}).withSourceInformation(bodySourceInformation);
js.Statement returnAsyncRethrow = js.Return(asyncRethrowCall)
.withSourceInformation(bodySourceInformation);
errorCheck = js.js.statement("""
if (#errorCode === #ERROR)
#returnAsyncRethrow;
""", {
"errorCode": errorCodeName,
"ERROR": js.number(status_codes.ERROR),
"returnAsyncRethrow": returnAsyncRethrow,
}).withSourceInformation(bodySourceInformation);
}

js.Expression innerFunction = js.js("""
function (#errorCode, #result) {
#errorCheck;
Expand Down
43 changes: 7 additions & 36 deletions pkg/compiler/lib/src/js/size_estimator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,6 @@ class SizeEstimator implements NodeVisitor {
}
}

Statement unwrapBlockIfSingleStatement(Statement body) {
Statement result = body;
while (result is Block) {
Block block = result;
if (block.statements.length != 1) break;
result = block.statements.single;
}
return result;
}

bool blockBody(Statement body, {required bool needsSeparation}) {
if (body is Block) {
blockOut(body);
Expand Down Expand Up @@ -196,7 +186,7 @@ class SizeEstimator implements NodeVisitor {
}

void ifOut(If node) {
Statement then = unwrapBlockIfSingleStatement(node.then);
Statement then = node.then;
Statement elsePart = node.otherwise;
bool hasElse = node.hasElse;

Expand All @@ -211,8 +201,7 @@ class SizeEstimator implements NodeVisitor {
pendingSpace = true;
ifOut(elsePart);
} else {
blockBody(unwrapBlockIfSingleStatement(elsePart),
needsSeparation: true);
blockBody(elsePart, needsSeparation: true);
}
}
}
Expand Down Expand Up @@ -240,7 +229,7 @@ class SizeEstimator implements NodeVisitor {
newInForInit: false, newAtStatementBegin: false);
}
out(')'); // ')'
blockBody(unwrapBlockIfSingleStatement(loop.body), needsSeparation: false);
blockBody(loop.body, needsSeparation: false);
}

@override
Expand All @@ -253,7 +242,7 @@ class SizeEstimator implements NodeVisitor {
visitNestedExpression(loop.object, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
out(')'); // ')'
blockBody(unwrapBlockIfSingleStatement(loop.body), needsSeparation: false);
blockBody(loop.body, needsSeparation: false);
}

@override
Expand All @@ -262,14 +251,13 @@ class SizeEstimator implements NodeVisitor {
visitNestedExpression(loop.condition, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
out(')'); // ')'
blockBody(unwrapBlockIfSingleStatement(loop.body), needsSeparation: false);
blockBody(loop.body, needsSeparation: false);
}

@override
void visitDo(Do loop) {
out('do'); // 'do'
if (blockBody(unwrapBlockIfSingleStatement(loop.body),
needsSeparation: true)) {}
if (blockBody(loop.body, needsSeparation: true)) {}
out('while('); // 'while('
visitNestedExpression(loop.condition, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
Expand Down Expand Up @@ -384,18 +372,8 @@ class SizeEstimator implements NodeVisitor {

@override
void visitLabeledStatement(LabeledStatement node) {
Statement body = unwrapBlockIfSingleStatement(node.body);
// `label: break label;`
// Does not work on IE. The statement is a nop, so replace it by an empty
// statement.
// See:
// https://connect.microsoft.com/IE/feedback/details/891889/parser-bugs
if (body is Break && body.targetLabel == node.label) {
visit(EmptyStatement());
return;
}
out('${node.label}:');
blockBody(body, needsSeparation: false);
blockBody(node.body, needsSeparation: false);
}

int functionOut(Fun fun, Expression? name, VarCollector vars) {
Expand Down Expand Up @@ -849,13 +827,6 @@ class SizeEstimator implements NodeVisitor {
out("=>");
int closingPosition;
Node body = fun.body;
// Simplify arrow functions that return a single expression.
if (fun.implicitReturnAllowed && body is Block) {
final statement = unwrapBlockIfSingleStatement(body);
if (statement is Return) {
body = statement.value!;
}
}
if (body is Block) {
closingPosition = blockOut(body);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1659,10 +1659,24 @@ class FragmentEmitter {
: locals.find('_lazyOld', 'hunkHelpers.lazyOld');
js.Expression staticFieldCode = field.code;
if (staticFieldCode is js.Fun) {
// An arrow function `() => { ...; return e }` is smaller that
// `function(){ ...; return e }`, and has compatible semantics for the
// initializer expression thunk.
js.Fun fun = staticFieldCode;
staticFieldCode = js.ArrowFunction(fun.params, fun.body,
asyncModifier: fun.asyncModifier)
.withInformationFrom(fun);
js.Node body = fun.body;
// Convert `() => { return e; }` into `() => e`.
if (body is js.Block) {
final statements = body.statements;
if (statements.length == 1) {
final first = statements.single;
if (first is js.Return && first.value != null) {
body = first.value!;
}
}
}
staticFieldCode =
js.ArrowFunction(fun.params, body, asyncModifier: fun.asyncModifier)
.withInformationFrom(fun);
}
js.Statement statement = js.js.statement("#(#, #, #, #);", [
helper,
Expand Down
4 changes: 0 additions & 4 deletions pkg/compiler/lib/src/kernel/dart2js_target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ List<Pattern> _allowedNativeTestPatterns = [
RegExp(r'(?<!generated_)tests/web/internal'),
'generated_tests/web/native/native_test',
'generated_tests/web/internal/deferred_url_test',
RegExp(r'(?<!generated_)tests/web_2/native'),
RegExp(r'(?<!generated_)tests/web_2/internal'),
'generated_tests/web_2/native/native_test',
'generated_tests/web_2/internal/deferred_url_test',
'pkg/front_end/testcases/dart2js/native',
];

Expand Down
2 changes: 1 addition & 1 deletion pkg/compiler/lib/src/ssa/validate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class HValidator extends HInstructionVisitor {
// than this are OK in order to avoid the O(N^2) validation getting out of
// hand.
//
// Poster child: corelib_2/regexp/pcre_test.dart, which has a 7KLOC main().
// Poster child: corelib/regexp/pcre_test.dart, which has a 7KLOC main().
static const int kMaxValidatedInstructionListLength = 1000;

/// Verifies [instruction] is contained in [instructions] [count] times.
Expand Down
2 changes: 1 addition & 1 deletion pkg/compiler/test/end_to_end/all_native_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main() {

test(List<String> options) async {
DiagnosticCollector collector = DiagnosticCollector();
String fileName = 'sdk/tests/web_2/native/main.dart';
String fileName = 'sdk/tests/web/native/main.dart';
Uri entryPoint = Uri.parse('memory:$fileName');
await runCompiler(
entryPoint: entryPoint,
Expand Down
4 changes: 2 additions & 2 deletions pkg/compiler/test/js/js_constant_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const String TEST_1 = r"""
main() {
runTest() async {
check(String test) async {
// Pretend this is a web_2/native test to allow use of 'native' keyword
// Pretend this is a web/native test to allow use of 'native' keyword
// and import of private libraries.
String main = 'sdk/tests/web_2/native/main.dart';
String main = 'sdk/tests/web/native/main.dart';
Uri entryPoint = Uri.parse('memory:$main');
var result = await runCompiler(
entryPoint: entryPoint, memorySourceFiles: {main: test});
Expand Down
Loading

0 comments on commit 564cfb2

Please sign in to comment.