| 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 library dev_compiler.src.server; | 6 library dev_compiler.src.server; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 var inputFile = options.inputs[0]; | 50 var inputFile = options.inputs[0]; |
| 51 var inputUri = inputFile.startsWith('dart:') || | 51 var inputUri = inputFile.startsWith('dart:') || |
| 52 inputFile.startsWith('package:') | 52 inputFile.startsWith('package:') |
| 53 ? Uri.parse(inputFile) | 53 ? Uri.parse(inputFile) |
| 54 : new Uri.file(path.absolute(srcOpts.useImplicitHtml | 54 : new Uri.file(path.absolute(srcOpts.useImplicitHtml |
| 55 ? SourceResolverOptions.implicitHtmlFile | 55 ? SourceResolverOptions.implicitHtmlFile |
| 56 : inputFile)); | 56 : inputFile)); |
| 57 var graph = new SourceGraph(context, reporter, options); | 57 var graph = new SourceGraph(context, reporter, options); |
| 58 var entryNode = graph.nodeFromUri(inputUri); | 58 var entryNode = graph.nodeFromUri(inputUri); |
| 59 | 59 |
| 60 return new ServerCompiler._(options, context, reporter, entryNode); | 60 return new ServerCompiler._(context, options, reporter, entryNode); |
| 61 } | 61 } |
| 62 | 62 |
| 63 ServerCompiler._(context, options, reporter, this._entryNode) | 63 ServerCompiler._(AnalysisContext context, CompilerOptions options, |
| 64 : super(options, context, reporter) { | 64 AnalysisErrorListener reporter, this._entryNode) |
| 65 : super(context, options, reporter) { |
| 65 if (outputDir != null) { | 66 if (outputDir != null) { |
| 66 _generators.add(new JSGenerator(this)); | 67 _generators.add(new JSGenerator(this)); |
| 67 } | 68 } |
| 68 // TODO(sigmund): refactor to support hashing of the dart output? | 69 // TODO(sigmund): refactor to support hashing of the dart output? |
| 69 _hashing = options.enableHashing && _generators.length == 1; | 70 _hashing = options.enableHashing && _generators.length == 1; |
| 70 } | 71 } |
| 71 | 72 |
| 72 Uri get entryPointUri => _entryNode.uri; | 73 Uri get entryPointUri => _entryNode.uri; |
| 73 | 74 |
| 74 CheckerResults run() { | 75 CheckerResults run() { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 301 |
| 301 Source resolveAbsolute(Uri uri) { | 302 Source resolveAbsolute(Uri uri) { |
| 302 var src = resolver.resolveAbsolute(uri); | 303 var src = resolver.resolveAbsolute(uri); |
| 303 return src.exists() ? src : null; | 304 return src.exists() ? src : null; |
| 304 } | 305 } |
| 305 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 306 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
| 306 } | 307 } |
| 307 | 308 |
| 308 final _log = new Logger('dev_compiler.src.server'); | 309 final _log = new Logger('dev_compiler.src.server'); |
| 309 final _earlyErrorResult = new CheckerResults(const [], null, true); | 310 final _earlyErrorResult = new CheckerResults(const [], null, true); |
| OLD | NEW |