OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js_incremental.library_updater; | 5 library dart2js_incremental.library_updater; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // The entry compilation unit hasn't been updated. So the tags aren't | 323 // The entry compilation unit hasn't been updated. So the tags aren't |
324 // changed. | 324 // changed. |
325 return new Future<bool>.value(false); | 325 return new Future<bool>.value(false); |
326 } | 326 } |
327 | 327 |
328 return _updatedScript(before, library).then((Script script) { | 328 return _updatedScript(before, library).then((Script script) { |
329 _entrySourceFiles[library] = script.file; | 329 _entrySourceFiles[library] = script.file; |
330 Token token = new Scanner(_entrySourceFiles[library]).tokenize(); | 330 Token token = new Scanner(_entrySourceFiles[library]).tokenize(); |
331 _entryUnitTokens[library] = token; | 331 _entryUnitTokens[library] = token; |
332 // Using two parsers to only create the nodes we want ([LibraryTag]). | 332 // Using two parsers to only create the nodes we want ([LibraryTag]). |
333 Parser parser = new Parser(new Listener()); | 333 Parser parser = new Parser(new Listener(), compiler.options); |
334 NodeListener listener = new NodeListener( | 334 NodeListener listener = new NodeListener( |
335 compiler, library.entryCompilationUnit); | 335 compiler, library.entryCompilationUnit); |
336 Parser nodeParser = new Parser(listener); | 336 Parser nodeParser = new Parser(listener, compiler.options); |
337 Iterator<LibraryTag> tags = library.tags.iterator; | 337 Iterator<LibraryTag> tags = library.tags.iterator; |
338 while (token.kind != EOF_TOKEN) { | 338 while (token.kind != EOF_TOKEN) { |
339 token = parser.parseMetadataStar(token); | 339 token = parser.parseMetadataStar(token); |
340 if (parser.optional('library', token) || | 340 if (parser.optional('library', token) || |
341 parser.optional('import', token) || | 341 parser.optional('import', token) || |
342 parser.optional('export', token) || | 342 parser.optional('export', token) || |
343 parser.optional('part', token)) { | 343 parser.optional('part', token)) { |
344 if (!tags.moveNext()) return true; | 344 if (!tags.moveNext()) return true; |
345 token = nodeParser.parseTopLevelDeclaration(token); | 345 token = nodeParser.parseTopLevelDeclaration(token); |
346 LibraryTag tag = listener.popNode(); | 346 LibraryTag tag = listener.popNode(); |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 .buildFieldsHackForIncrementalCompilation(classElement); | 1512 .buildFieldsHackForIncrementalCompilation(classElement); |
1513 // TODO(ahe): Rewrite for new emitter. | 1513 // TODO(ahe): Rewrite for new emitter. |
1514 ClassBuilder builder = new ClassBuilder(classElement, namer); | 1514 ClassBuilder builder = new ClassBuilder(classElement, namer); |
1515 classEmitter.emitFields(cls, builder); | 1515 classEmitter.emitFields(cls, builder); |
1516 return builder.fields; | 1516 return builder.fields; |
1517 } | 1517 } |
1518 } | 1518 } |
1519 | 1519 |
1520 // TODO(ahe): Remove this method. | 1520 // TODO(ahe): Remove this method. |
1521 NO_WARN(x) => x; | 1521 NO_WARN(x) => x; |
OLD | NEW |