Index: utils/kernel-service/kernel-service.dart |
diff --git a/utils/kernel-service/kernel-service.dart b/utils/kernel-service/kernel-service.dart |
index 5b7ca5031c378a729bd9740d5777ef6e21fe4d27..f339296645bc2d43c5506c38b997b7c1737235a1 100644 |
--- a/utils/kernel-service/kernel-service.dart |
+++ b/utils/kernel-service/kernel-service.dart |
@@ -48,9 +48,13 @@ Future _processLoadRequest(request) async { |
final String inputFileUri = request[2]; |
final Uri script = Uri.base.resolve(inputFileUri); |
- FileSystem fileSystem = request.length > 3 |
- ? _buildFileSystem(request[3]) |
- : PhysicalFileSystem.instance; |
+ FileSystem fileSystem = PhysicalFileSystem.instance; |
+ bool requireMain = true; |
+ |
+ if (request.length > 3) { |
+ fileSystem = _buildFileSystem(request[3]); |
+ requireMain = false; |
+ } |
Uri packagesUri = (Platform.packageConfig != null) |
? Uri.parse(Platform.packageConfig) |
@@ -82,7 +86,10 @@ Future _processLoadRequest(request) async { |
CompilationResult result; |
try { |
- Program program = await kernelForProgram(script, options); |
+ Program program = requireMain |
+ ? await kernelForProgram(script, options) |
+ : await kernelForBuildUnit([script], options..chaseDependencies = true); |
+ |
if (errors.isNotEmpty) { |
result = new CompilationResult.errors(errors); |
} else { |