Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: pkg/front_end/test/incremental_kernel_generator_test.dart

Issue 2931603003: Set main procedure for Program. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/incremental_kernel_generator_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/incremental_kernel_generator_test.dart
diff --git a/pkg/front_end/test/incremental_kernel_generator_test.dart b/pkg/front_end/test/incremental_kernel_generator_test.dart
index 603d0641ba4237f9eab587b6648cec6ee27478aa..044a52e99f6ca7832649642ab4a231dd9bd58d76 100644
--- a/pkg/front_end/test/incremental_kernel_generator_test.dart
+++ b/pkg/front_end/test/incremental_kernel_generator_test.dart
@@ -72,6 +72,7 @@ import 'a.dart';
import 'b.dart';
var c1 = a;
var c2 = b;
+void main() {}
''');
{
@@ -90,7 +91,11 @@ import "./b.dart" as b;
static field core::int c1 = a::a;
static field core::int c2 = b::b;
+static method main() → void {}
''');
+ // The main method is set.
+ expect(program.mainMethod, isNotNull);
+ expect(program.mainMethod.enclosingLibrary.fileUri, cUri.toString());
}
// Update b.dart and recompile c.dart
@@ -118,7 +123,11 @@ import "./b.dart" as b;
static field core::int c1 = a::a;
static field core::double c2 = b::b;
+static method main() → void {}
''');
+ // The main method is set even though not the entry point is updated.
+ expect(program.mainMethod, isNotNull);
+ expect(program.mainMethod.enclosingLibrary.fileUri, cUri.toString());
}
}
@@ -421,6 +430,7 @@ main() {
// Remove b.dart from the program.
// So, the program is now ready for re-adding the library.
+ program.mainMethod = null;
program.libraries.remove(initialLibrary);
program.root.removeChild(initialLibrary.importUri.toString());
}
@@ -438,6 +448,8 @@ main() {
// Add the library into the program.
program.libraries.add(loadedLibrary);
loadedLibrary.parent = program;
+ program.mainMethod = loadedLibrary.procedures
+ .firstWhere((procedure) => procedure.name.name == 'main');
expect(_getLibraryText(loadedLibrary), initialKernelText);
verifyProgram(program);
« no previous file with comments | « pkg/front_end/lib/src/incremental_kernel_generator_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698