OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// This is an interface to the Dart Kernel parser and Kernel binary generator. | 5 /// This is an interface to the Dart Kernel parser and Kernel binary generator. |
6 /// | 6 /// |
7 /// It is used by the kernel-isolate to load Dart source code and generate | 7 /// It is used by the kernel-isolate to load Dart source code and generate |
8 /// Kernel binary format. | 8 /// Kernel binary format. |
9 /// | 9 /// |
10 /// This is either invoked as the root script of the Kernel isolate when used | 10 /// This is either invoked as the root script of the Kernel isolate when used |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 throw "Input file '${fileName.path}' does not exist."; | 106 throw "Input file '${fileName.path}' does not exist."; |
107 } | 107 } |
108 | 108 |
109 if (!FileSystemEntity.isDirectorySync(sdkPath)) { | 109 if (!FileSystemEntity.isDirectorySync(sdkPath)) { |
110 throw "Patched sdk directory not found at $sdkPath"; | 110 throw "Patched sdk directory not found at $sdkPath"; |
111 } | 111 } |
112 | 112 |
113 Target target = getTarget("vm", new TargetFlags(strongMode: false)); | 113 Target target = getTarget("vm", new TargetFlags(strongMode: false)); |
114 | 114 |
115 Program program; | 115 Program program; |
116 final uriTranslator = await TranslateUri.parse(new Uri.file(packageConfig)); | 116 final uriTranslator = |
| 117 await TranslateUri.parse(null, new Uri.file(packageConfig)); |
117 final Ticker ticker = new Ticker(isVerbose: verbose); | 118 final Ticker ticker = new Ticker(isVerbose: verbose); |
118 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 119 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
119 dillTarget.read(new Uri.directory(sdkPath).resolve('platform.dill')); | 120 dillTarget.read(new Uri.directory(sdkPath).resolve('platform.dill')); |
120 final KernelTarget kernelTarget = | 121 final KernelTarget kernelTarget = |
121 new KernelTarget(dillTarget, uriTranslator); | 122 new KernelTarget(dillTarget, uriTranslator); |
122 try { | 123 try { |
123 kernelTarget.read(fileName); | 124 kernelTarget.read(fileName); |
124 await dillTarget.writeOutline(null); | 125 await dillTarget.writeOutline(null); |
125 program = await kernelTarget.writeOutline(null); | 126 program = await kernelTarget.writeOutline(null); |
126 program = await kernelTarget.writeProgram(null, AstKind.Kernel); | 127 program = await kernelTarget.writeProgram(null, AstKind.Kernel); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (await new File.fromUri(packagesFile).exists()) { | 271 if (await new File.fromUri(packagesFile).exists()) { |
271 return packagesFile; | 272 return packagesFile; |
272 } | 273 } |
273 if (dir.parent.path == dir.path) { | 274 if (dir.parent.path == dir.path) { |
274 break; | 275 break; |
275 } | 276 } |
276 dir = dir.parent; | 277 dir = dir.parent; |
277 } | 278 } |
278 return null; | 279 return null; |
279 } | 280 } |
OLD | NEW |