OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Development server that compiles Dart to JS on the fly. | 5 /// Development server that compiles Dart to JS on the fly. |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 {AnalysisErrorListener reporter}) { | 46 {AnalysisErrorListener reporter}) { |
47 var srcOpts = options.sourceOptions; | 47 var srcOpts = options.sourceOptions; |
48 var inputFiles = options.inputs; | 48 var inputFiles = options.inputs; |
49 var inputUris = inputFiles.map((String inputFile) => | 49 var inputUris = inputFiles.map((String inputFile) => |
50 inputFile.startsWith('dart:') || inputFile.startsWith('package:') | 50 inputFile.startsWith('dart:') || inputFile.startsWith('package:') |
51 ? Uri.parse(inputFile) | 51 ? Uri.parse(inputFile) |
52 : new Uri.file(path.absolute(srcOpts.useImplicitHtml | 52 : new Uri.file(path.absolute(srcOpts.useImplicitHtml |
53 ? SourceResolverOptions.implicitHtmlFile | 53 ? SourceResolverOptions.implicitHtmlFile |
54 : inputFile))); | 54 : inputFile))); |
55 var graph = new SourceGraph(context, reporter, options); | 55 var graph = new SourceGraph(context, reporter, options); |
56 var entryNodes = inputUris.map((inputUri) => graph.nodeFromUri(inputUri)); | 56 var entryNodes = |
| 57 inputUris.map((inputUri) => graph.nodeFromUri(inputUri)).toList(); |
57 | 58 |
58 return new ServerCompiler._(context, options, reporter, graph, entryNodes); | 59 return new ServerCompiler._(context, options, reporter, graph, entryNodes); |
59 } | 60 } |
60 | 61 |
61 ServerCompiler._( | 62 ServerCompiler._( |
62 AnalysisContext context, | 63 AnalysisContext context, |
63 CompilerOptions options, | 64 CompilerOptions options, |
64 AnalysisErrorListener reporter, | 65 AnalysisErrorListener reporter, |
65 SourceGraph graph, | 66 SourceGraph graph, |
66 List<SourceNode> entryNodes) | 67 List<SourceNode> entryNodes) |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 332 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
332 var src = resolver.resolveAbsolute(uri, actualUri); | 333 var src = resolver.resolveAbsolute(uri, actualUri); |
333 return src.exists() ? src : null; | 334 return src.exists() ? src : null; |
334 } | 335 } |
335 | 336 |
336 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 337 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
337 } | 338 } |
338 | 339 |
339 final _log = new Logger('dev_compiler.src.server'); | 340 final _log = new Logger('dev_compiler.src.server'); |
340 final _earlyErrorResult = new CheckerResults(const [], true); | 341 final _earlyErrorResult = new CheckerResults(const [], true); |
OLD | NEW |