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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (_hashing) node.cachingHash = computeHashFromFile(filepath); | 142 if (_hashing) node.cachingHash = computeHashFromFile(filepath); |
143 } | 143 } |
144 | 144 |
145 void _buildDartLibrary(DartSourceNode node) { | 145 void _buildDartLibrary(DartSourceNode node) { |
146 print('Compiling ${node.uri}'); | 146 print('Compiling ${node.uri}'); |
147 var source = node.source; | 147 var source = node.source; |
148 // TODO(sigmund): find out from analyzer team if there is a better way | 148 // TODO(sigmund): find out from analyzer team if there is a better way |
149 context.applyChanges(new ChangeSet()..changedSource(source)); | 149 context.applyChanges(new ChangeSet()..changedSource(source)); |
150 var entryUnit = context.resolveCompilationUnit2(source, source); | 150 var entryUnit = context.resolveCompilationUnit2(source, source); |
151 var lib = entryUnit.element.enclosingElement; | 151 var lib = entryUnit.element.enclosingElement; |
152 if (!options.checkSdk && lib.source.uri.scheme == 'dart') return; | 152 if (!options.checkSdk && lib.source.isInSystemLibrary) return; |
153 var current = node.info; | 153 var current = node.info; |
154 if (current != null) { | 154 if (current != null) { |
155 assert(current.library == lib); | 155 assert(current.library == lib); |
156 } else { | 156 } else { |
157 node.info = current = new LibraryInfo(lib); | 157 node.info = current = new LibraryInfo(lib); |
158 } | 158 } |
159 _libraries.add(current); | 159 _libraries.add(current); |
160 | 160 |
161 var resolvedParts = node.parts | 161 var resolvedParts = node.parts |
162 .map((p) => context.resolveCompilationUnit2(p.source, source)) | 162 .map((p) => context.resolveCompilationUnit2(p.source, source)) |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 331 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
332 var src = resolver.resolveAbsolute(uri, actualUri); | 332 var src = resolver.resolveAbsolute(uri, actualUri); |
333 return src.exists() ? src : null; | 333 return src.exists() ? src : null; |
334 } | 334 } |
335 | 335 |
336 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 336 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
337 } | 337 } |
338 | 338 |
339 final _log = new Logger('dev_compiler.src.server'); | 339 final _log = new Logger('dev_compiler.src.server'); |
340 final _earlyErrorResult = new CheckerResults(const [], true); | 340 final _earlyErrorResult = new CheckerResults(const [], true); |
OLD | NEW |