mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:17:07 +00:00
[dart2js] Move pkg/compiler/test/kernel/goldens_test testcases to
pkg/front_end/testcases/dart2js. Change-Id: Iede8f9b03119dab4ee2a3ed6498d6a7e4e19a6a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212260 Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Mayank Patke <fishythefish@google.com>
This commit is contained in:
parent
4dccb1ff35
commit
9cf14f417d
31 changed files with 421 additions and 284 deletions
|
@ -39,7 +39,6 @@ dev_dependencies:
|
|||
package_config: any
|
||||
path: any
|
||||
source_maps: any
|
||||
test: any
|
||||
cli_util: any
|
||||
# Unpublished packages that can be used via path dependency
|
||||
async_helper:
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:front_end/src/api_unstable/dart2js.dart'
|
||||
show
|
||||
CompilerOptions,
|
||||
DiagnosticMessage,
|
||||
computePlatformBinariesLocation,
|
||||
kernelForProgram,
|
||||
parseExperimentalArguments,
|
||||
parseExperimentalFlags;
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/text/ast_to_text.dart' show Printer;
|
||||
import 'package:kernel/target/targets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:compiler/src/kernel/dart2js_target.dart' show Dart2jsTarget;
|
||||
|
||||
/// Environment define to update expectation files on failures.
|
||||
const kUpdateExpectations = 'updateExpectations';
|
||||
|
||||
/// Environment define to dump actual results alongside expectations.
|
||||
const kDumpActualResult = 'dump.actual.result';
|
||||
|
||||
class TestingDart2jsTarget extends Dart2jsTarget {
|
||||
TestingDart2jsTarget(TargetFlags flags) : super('dart2js', flags);
|
||||
}
|
||||
|
||||
Future<Component> compileTestCaseToKernelProgram(Uri sourceUri,
|
||||
{Target target,
|
||||
bool enableSuperMixins = false,
|
||||
List<String> experimentalFlags,
|
||||
Map<String, String> environmentDefines}) async {
|
||||
final platformKernel =
|
||||
computePlatformBinariesLocation().resolve('dart2js_platform.dill');
|
||||
target ??= TestingDart2jsTarget(TargetFlags());
|
||||
environmentDefines ??= <String, String>{};
|
||||
final options = CompilerOptions()
|
||||
..target = target
|
||||
..additionalDills = <Uri>[platformKernel]
|
||||
..environmentDefines = environmentDefines
|
||||
..explicitExperimentalFlags =
|
||||
parseExperimentalFlags(parseExperimentalArguments(experimentalFlags),
|
||||
onError: (String message) {
|
||||
throw message;
|
||||
})
|
||||
..onDiagnostic = (DiagnosticMessage message) {
|
||||
fail("Compilation error: ${message.plainTextFormatted.join('\n')}");
|
||||
};
|
||||
|
||||
final Component component =
|
||||
(await kernelForProgram(sourceUri, options)).component;
|
||||
|
||||
// Make sure the library name is the same and does not depend on the order
|
||||
// of test cases.
|
||||
component.mainMethod.enclosingLibrary.name = '#lib';
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
String kernelLibraryToString(Library library) {
|
||||
final buffer = StringBuffer();
|
||||
Printer(buffer, showMetadata: true).writeLibraryFile(library);
|
||||
return buffer
|
||||
.toString()
|
||||
.replaceAll(library.importUri.toString(), library.name);
|
||||
}
|
||||
|
||||
String kernelComponentToString(Component component) {
|
||||
final buffer = StringBuffer();
|
||||
Printer(buffer, showMetadata: true).writeComponentFile(component);
|
||||
final mainLibrary = component.mainMethod.enclosingLibrary;
|
||||
return buffer
|
||||
.toString()
|
||||
.replaceAll(mainLibrary.importUri.toString(), mainLibrary.name);
|
||||
}
|
||||
|
||||
class Difference {
|
||||
final int line;
|
||||
final String actual;
|
||||
final String expected;
|
||||
|
||||
Difference(this.line, this.actual, this.expected);
|
||||
}
|
||||
|
||||
Difference findFirstDifference(String actual, String expected) {
|
||||
final actualLines = actual.split('\n');
|
||||
final expectedLines = expected.split('\n');
|
||||
int i = 0;
|
||||
for (; i < actualLines.length && i < expectedLines.length; ++i) {
|
||||
if (actualLines[i] != expectedLines[i]) {
|
||||
return Difference(i + 1, actualLines[i], expectedLines[i]);
|
||||
}
|
||||
}
|
||||
return Difference(i + 1, i < actualLines.length ? actualLines[i] : '<END>',
|
||||
i < expectedLines.length ? expectedLines[i] : '<END>');
|
||||
}
|
||||
|
||||
void compareResultWithExpectationsFile(Uri source, String actual) {
|
||||
final expectFile = File(source.toFilePath() + '.expect');
|
||||
final expected = expectFile.existsSync() ? expectFile.readAsStringSync() : '';
|
||||
|
||||
if (actual != expected) {
|
||||
if (bool.fromEnvironment(kUpdateExpectations)) {
|
||||
expectFile.writeAsStringSync(actual);
|
||||
print(" Updated $expectFile");
|
||||
} else {
|
||||
if (bool.fromEnvironment(kDumpActualResult)) {
|
||||
File(source.toFilePath() + '.actual').writeAsStringSync(actual);
|
||||
}
|
||||
Difference diff = findFirstDifference(actual, expected);
|
||||
fail("""
|
||||
|
||||
Result is different for the test case $source
|
||||
|
||||
The first difference is at line ${diff.line}.
|
||||
Actual: ${diff.actual}
|
||||
Expected: ${diff.expected}
|
||||
|
||||
This failure can be caused by changes in the front-end if it starts generating
|
||||
different kernel AST for the same Dart programs.
|
||||
|
||||
In order to re-generate expectations run tests with -D$kUpdateExpectations=true VM option:
|
||||
|
||||
sdk/bin/dart -D$kUpdateExpectations=true pkg/compiler/test/kernel/goldens_test.dart
|
||||
|
||||
In order to dump actual results into .actual files run tests with -D$kDumpActualResult=true VM option.
|
||||
""");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
library #lib;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int*>* list1 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list2 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list3 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateFixed<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list4 = core::List::generate<core::int*>(10, (core::int* i) → core::int* => i, growable: self::someGrowable);
|
||||
static field core::bool* someGrowable = true;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int*>*>[self::list1, self::list2, self::list3, self::list4]);
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
library #lib;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::print( block {
|
||||
final _in::JSArray<core::List<core::int*>*> _list = _in::JSArray::allocateGrowable<core::List<core::int*>*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, block {
|
||||
final core::int _length = i;
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(_length);
|
||||
for (core::int i = 0; i.{core::num::<}(_length){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i.{core::num::+}(1){(core::num*) →* core::int*}){(core::int, core::int*) → void};
|
||||
}
|
||||
} =>_list){(core::int, core::List<core::int*>*) → void};
|
||||
}
|
||||
} =>_list);
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
library #lib;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int*>* list1 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list2 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list3 = block {
|
||||
final _in::JSArray<core::int*> _list = _in::JSArray::allocateFixed<core::int*>(10);
|
||||
for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int) →* core::int}) {
|
||||
core::int* i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int*) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int*>* list4 = core::List::generate<core::int*>(10, (core::int* i) → core::int* {
|
||||
return i;
|
||||
}, growable: self::someGrowable);
|
||||
static field core::List<core::int*>* list5 = core::List::generate<core::int*>(10, (core::int* i) → core::int* {
|
||||
if(i.{core::int::isEven}{core::bool*})
|
||||
return i.{core::num::+}(1){(core::num*) →* core::int*};
|
||||
return i.{core::num::-}(1){(core::num*) →* core::int*};
|
||||
});
|
||||
static field core::List<core::int*>* list6 = core::List::generate<core::int*>(10, #C1);
|
||||
static field core::List<core::int*>* list7 = core::List::generate<core::int*>(10, self::bar);
|
||||
static field core::bool* someGrowable = true;
|
||||
static method foo(core::int* i) → core::int*
|
||||
return i;
|
||||
static get bar() → (core::int*) →* core::int*
|
||||
return #C1;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int*>*>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:kernel/target/targets.dart';
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/kernel.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'common_test_utils.dart';
|
||||
|
||||
final String testRootDir = Platform.script.resolve('.').toFilePath();
|
||||
|
||||
runTestCase(
|
||||
Uri source, List<String> experimentalFlags, bool soundNullSafety) async {
|
||||
final target =
|
||||
TestingDart2jsTarget(TargetFlags(enableNullSafety: soundNullSafety));
|
||||
Component component = await compileTestCaseToKernelProgram(source,
|
||||
target: target, experimentalFlags: experimentalFlags);
|
||||
|
||||
String actual = kernelLibraryToString(component.mainMethod.enclosingLibrary);
|
||||
|
||||
compareResultWithExpectationsFile(source, actual);
|
||||
}
|
||||
|
||||
main() {
|
||||
group('goldens', () {
|
||||
final testCasesDir = new Directory(testRootDir + '/data');
|
||||
|
||||
for (var entry
|
||||
in testCasesDir.listSync(recursive: true, followLinks: false)) {
|
||||
final path = entry.path;
|
||||
if (path.endsWith('.dart')) {
|
||||
final bool unsoundNullSafety = path.endsWith('_unsound.dart');
|
||||
test(
|
||||
path,
|
||||
() => runTestCase(
|
||||
entry.uri, const ['non-nullable'], !unsoundNullSafety));
|
||||
}
|
||||
}
|
||||
}, timeout: Timeout.none);
|
||||
}
|
|
@ -1539,6 +1539,7 @@ innermost
|
|||
inout
|
||||
input
|
||||
inputs
|
||||
inscrutable
|
||||
insert
|
||||
inserted
|
||||
inserting
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1 = core::List::generate<core::int>(10, (core::int i) → core::int => i);
|
||||
static field core::List<core::int> list2 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: true);
|
||||
static field core::List<core::int> list3 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: false);
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: self::someGrowable);
|
||||
static field core::bool someGrowable = true;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4]);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int> list1 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list2 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list3 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateFixed<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: self::someGrowable);
|
||||
static field core::bool someGrowable = true;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4]);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
var list1 = List<int>.generate(10, (i) => i);
|
||||
var list2 = List<int>.generate(10, (i) => i, growable: true);
|
||||
var list3 = List<int>.generate(10, (i) => i, growable: false);
|
||||
var list4 = List<int>.generate(10, (i) => i, growable: someGrowable);
|
||||
bool someGrowable = true;
|
||||
void main() {}
|
|
@ -0,0 +1,6 @@
|
|||
bool someGrowable = true;
|
||||
var list1 = List<int>.generate(10, (i) => i);
|
||||
var list2 = List<int>.generate(10, (i) => i, growable: true);
|
||||
var list3 = List<int>.generate(10, (i) => i, growable: false);
|
||||
var list4 = List<int>.generate(10, (i) => i, growable: someGrowable);
|
||||
void main() {}
|
|
@ -0,0 +1,13 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1 = core::List::generate<core::int>(10, (core::int i) → core::int => i);
|
||||
static field core::List<core::int> list2 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: true);
|
||||
static field core::List<core::int> list3 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: false);
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: self::someGrowable);
|
||||
static field core::bool someGrowable = true;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4]);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1;
|
||||
static field core::List<core::int> list2;
|
||||
static field core::List<core::int> list3;
|
||||
static field core::List<core::int> list4;
|
||||
static field core::bool someGrowable;
|
||||
static method main() → void
|
||||
;
|
|
@ -0,0 +1,32 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int> list1 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list2 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list3 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateFixed<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int => i, growable: self::someGrowable);
|
||||
static field core::bool someGrowable = true;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4]);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::print(core::List::generate<core::List<core::int>>(10, (core::int i) → core::List<core::int> => core::List::generate<core::int>(i, (core::int i) → core::int => i.{core::num::+}(1){(core::num) → core::int})));
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::print( block {
|
||||
final _in::JSArray<core::List<core::int>> _list = _in::JSArray::allocateGrowable<core::List<core::int>>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, block {
|
||||
final core::int* _length = i;
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(_length);
|
||||
for (core::int* i = 0; i.{core::num::<}(_length){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i.{core::num::+}(1){(core::num) → core::int}){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list){(core::int, core::List<core::int>) → void};
|
||||
}
|
||||
} =>_list);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
void main() {}
|
|
@ -0,0 +1 @@
|
|||
void main() {}
|
|
@ -0,0 +1,7 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::print(core::List::generate<core::List<core::int>>(10, (core::int i) → core::List<core::int> => core::List::generate<core::int>(i, (core::int i) → core::int => i.{core::num::+}(1){(core::num) → core::int})));
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
static method main() → void
|
||||
;
|
|
@ -0,0 +1,21 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::print( block {
|
||||
final _in::JSArray<core::List<core::int>> _list = _in::JSArray::allocateGrowable<core::List<core::int>>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, block {
|
||||
final core::int* _length = i;
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(_length);
|
||||
for (core::int* i = 0; i.{core::num::<}(_length){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i.{core::num::+}(1){(core::num) → core::int}){(core::int, core::int) → void};
|
||||
}
|
||||
} =>_list){(core::int, core::List<core::int>) → void};
|
||||
}
|
||||
} =>_list);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
});
|
||||
static field core::List<core::int> list2 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: true);
|
||||
static field core::List<core::int> list3 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: false);
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: self::someGrowable);
|
||||
static field core::List<core::int> list5 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
if(i.{core::int::isEven}{core::bool})
|
||||
return i.{core::num::+}(1){(core::num) → core::int};
|
||||
return i.{core::num::-}(1){(core::num) → core::int};
|
||||
});
|
||||
static field core::List<core::int> list6 = core::List::generate<core::int>(10, #C1);
|
||||
static field core::List<core::int> list7 = core::List::generate<core::int>(10, self::bar);
|
||||
static field core::bool someGrowable = true;
|
||||
static method foo(core::int i) → core::int
|
||||
return i;
|
||||
static get bar() → (core::int) → core::int
|
||||
return #C1;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::foo
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int> list1 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list2 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list3 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateFixed<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: self::someGrowable);
|
||||
static field core::List<core::int> list5 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
if(i.{core::int::isEven}{core::bool})
|
||||
return i.{core::num::+}(1){(core::num) → core::int};
|
||||
return i.{core::num::-}(1){(core::num) → core::int};
|
||||
});
|
||||
static field core::List<core::int> list6 = core::List::generate<core::int>(10, #C1);
|
||||
static field core::List<core::int> list7 = core::List::generate<core::int>(10, self::bar);
|
||||
static field core::bool someGrowable = true;
|
||||
static method foo(core::int i) → core::int
|
||||
return i;
|
||||
static get bar() → (core::int) → core::int
|
||||
return #C1;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::foo
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
var list1 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
});
|
||||
var list2 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: true);
|
||||
var list3 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: false);
|
||||
var list4 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: someGrowable);
|
||||
var list5 = List<int>.generate(10, (i) {
|
||||
if (i.isEven) return i + 1;
|
||||
return i - 1;
|
||||
});
|
||||
var list6 = List<int>.generate(10, foo);
|
||||
int foo(int i) => i;
|
||||
var list7 = List<int>.generate(10, bar);
|
||||
int Function(int) get bar => foo;
|
||||
bool someGrowable = true;
|
||||
void main() {}
|
|
@ -0,0 +1,22 @@
|
|||
bool someGrowable = true;
|
||||
int Function(int) get bar => foo;
|
||||
int foo(int i) => i;
|
||||
var list1 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
});
|
||||
var list2 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: true);
|
||||
var list3 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: false);
|
||||
var list4 = List<int>.generate(10, (i) {
|
||||
return i;
|
||||
}, growable: someGrowable);
|
||||
var list5 = List<int>.generate(10, (i) {
|
||||
if (i.isEven) return i + 1;
|
||||
return i - 1;
|
||||
});
|
||||
var list6 = List<int>.generate(10, foo);
|
||||
var list7 = List<int>.generate(10, bar);
|
||||
void main() {}
|
|
@ -0,0 +1,36 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
});
|
||||
static field core::List<core::int> list2 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: true);
|
||||
static field core::List<core::int> list3 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: false);
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: self::someGrowable);
|
||||
static field core::List<core::int> list5 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
if(i.{core::int::isEven}{core::bool})
|
||||
return i.{core::num::+}(1){(core::num) → core::int};
|
||||
return i.{core::num::-}(1){(core::num) → core::int};
|
||||
});
|
||||
static field core::List<core::int> list6 = core::List::generate<core::int>(10, #C1);
|
||||
static field core::List<core::int> list7 = core::List::generate<core::int>(10, self::bar);
|
||||
static field core::bool someGrowable = true;
|
||||
static method foo(core::int i) → core::int
|
||||
return i;
|
||||
static get bar() → (core::int) → core::int
|
||||
return #C1;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::foo
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static field core::List<core::int> list1;
|
||||
static field core::List<core::int> list2;
|
||||
static field core::List<core::int> list3;
|
||||
static field core::List<core::int> list4;
|
||||
static field core::List<core::int> list5;
|
||||
static field core::List<core::int> list6;
|
||||
static field core::List<core::int> list7;
|
||||
static field core::bool someGrowable;
|
||||
static method foo(core::int i) → core::int
|
||||
;
|
||||
static get bar() → (core::int) → core::int
|
||||
;
|
||||
static method main() → void
|
||||
;
|
|
@ -0,0 +1,55 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_interceptors" as _in;
|
||||
|
||||
static field core::List<core::int> list1 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list2 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateGrowable<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list3 = block {
|
||||
final _in::JSArray<core::int> _list = _in::JSArray::allocateFixed<core::int>(10);
|
||||
for (core::int* i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::int*) → core::int*}) {
|
||||
core::int i = i;
|
||||
{
|
||||
_list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i){(core::int, core::int) → void};
|
||||
}
|
||||
}
|
||||
} =>_list;
|
||||
static field core::List<core::int> list4 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
return i;
|
||||
}, growable: self::someGrowable);
|
||||
static field core::List<core::int> list5 = core::List::generate<core::int>(10, (core::int i) → core::int {
|
||||
if(i.{core::int::isEven}{core::bool})
|
||||
return i.{core::num::+}(1){(core::num) → core::int};
|
||||
return i.{core::num::-}(1){(core::num) → core::int};
|
||||
});
|
||||
static field core::List<core::int> list6 = core::List::generate<core::int>(10, #C1);
|
||||
static field core::List<core::int> list7 = core::List::generate<core::int>(10, self::bar);
|
||||
static field core::bool someGrowable = true;
|
||||
static method foo(core::int i) → core::int
|
||||
return i;
|
||||
static get bar() → (core::int) → core::int
|
||||
return #C1;
|
||||
static method main() → void {
|
||||
self::someGrowable = !self::someGrowable;
|
||||
core::print(<core::List<core::int>>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::foo
|
||||
}
|
Loading…
Reference in a new issue