mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Don't crash when the delta is empty
Change-Id: I322261faad1431b7b597094048a9f904d70c33ff Reviewed-on: https://dart-review.googlesource.com/34740 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
4d99c9fdf3
commit
e6683f0638
|
@ -95,7 +95,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
|||
return new Program(
|
||||
libraries: new List<Library>.from(userCode.loader.libraries),
|
||||
uriToSource: new Map<Uri, Source>.from(userCode.uriToSource))
|
||||
..mainMethod = programWithDill.mainMethod;
|
||||
..mainMethod = programWithDill?.mainMethod;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ test({bool sdkFromSource}) async {
|
|||
// Expect that the new program contains exactly hello.dart
|
||||
Expect.isTrue(
|
||||
program.libraries.length == 1, "${program.libraries.length} != 1");
|
||||
|
||||
program = await compiler.computeDelta(entryPoint: helloDart);
|
||||
Expect.isTrue(program.libraries.isEmpty);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -10,6 +10,8 @@ import "dart:convert" show JsonEncoder;
|
|||
|
||||
import "dart:io" show File;
|
||||
|
||||
import "package:kernel/ast.dart" show Program;
|
||||
|
||||
import "package:testing/testing.dart"
|
||||
show Chain, ChainContext, Result, Step, TestDescription, runMe;
|
||||
|
||||
|
@ -144,10 +146,17 @@ class RunCompilations extends Step<TestCase, TestCase, Context> {
|
|||
return edits == 0 ? fail(test, "No sources found") : pass(test);
|
||||
}
|
||||
var compiler = context.compiler;
|
||||
await compiler.computeDelta(entryPoint: entryPoint);
|
||||
Program program = await compiler.computeDelta(entryPoint: entryPoint);
|
||||
List<CompilationMessage> errors = context.takeErrors();
|
||||
if (errors.isNotEmpty && !test.expectations[edits].hasCompileTimeError) {
|
||||
return fail(test, errors.join("\n"));
|
||||
if (test.expectations[edits].hasCompileTimeError) {
|
||||
if (errors.isEmpty) {
|
||||
return fail(test, "Compile-time error expected, but none reported");
|
||||
}
|
||||
} else if (errors.isNotEmpty) {
|
||||
return fail(
|
||||
test, "Unexpected compile-time errors:\n ${errors.join('\n ')}");
|
||||
} else if (program.libraries.length < 1) {
|
||||
return fail(test, "The compiler detected no changes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,11 @@
|
|||
|
||||
# Status file for the test suite ../test/fasta/incremental_test.dart.
|
||||
|
||||
dartino/change_in_part.incremental: Crash # Parts aren't handled correctly
|
||||
dartino/change_in_part.incremental: Fail # Issue 31908 (parts aren't handled correctly)
|
||||
dartino/compile_time_error_004.incremental: Fail # Issue 31909
|
||||
dartino/compile_time_error_field_becomes_removed_function.incremental: Fail # Issue 31909
|
||||
dartino/fix_compile_time_error_in_field.incremental: Fail # Issue 31909
|
||||
dartino/override_field_with_method_conflict.incremental: Fail # Issue 31909
|
||||
dartino/override_getter_with_method_conflict.incremental: Fail # Issue 31909
|
||||
dartino/override_method_with_field_conflict.incremental: Fail # Issue 31909
|
||||
dartino/override_method_with_getter_conflict.incremental: Fail # Issue 31909
|
||||
|
|
Loading…
Reference in a new issue