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 library dart2js.serialization.resolved_ast; | 5 library dart2js.serialization.resolved_ast; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 DeserializerPlugin nativeDataDeserializer) { | 372 DeserializerPlugin nativeDataDeserializer) { |
373 CompilationUnitElement compilationUnit = element.compilationUnit; | 373 CompilationUnitElement compilationUnit = element.compilationUnit; |
374 DiagnosticReporter reporter = parsing.reporter; | 374 DiagnosticReporter reporter = parsing.reporter; |
375 Uri uri = objectDecoder.getUri(Key.URI); | 375 Uri uri = objectDecoder.getUri(Key.URI); |
376 | 376 |
377 /// Returns the first [Token] for parsing the [Node] for [element]. | 377 /// Returns the first [Token] for parsing the [Node] for [element]. |
378 Token readBeginToken() { | 378 Token readBeginToken() { |
379 int charOffset = objectDecoder.getInt(Key.OFFSET); | 379 int charOffset = objectDecoder.getInt(Key.OFFSET); |
380 Token beginToken = getBeginToken(uri, charOffset); | 380 Token beginToken = getBeginToken(uri, charOffset); |
381 if (beginToken == null) { | 381 if (beginToken == null) { |
| 382 // TODO(johnniwinther): Handle unfound tokens by adding an erronous |
| 383 // resolved ast kind. |
382 reporter.internalError( | 384 reporter.internalError( |
383 element, "No token found for $element in $uri @ $charOffset"); | 385 element, "No token found for $element in $uri @ $charOffset"); |
384 } | 386 } |
385 return beginToken; | 387 return beginToken; |
386 } | 388 } |
387 | 389 |
388 /// Create the [Node] for the element by parsing the source code. | 390 /// Create the [Node] for the element by parsing the source code. |
389 Node doParse(parse(Parser parser)) { | 391 Node doParse(parse(Parser parser)) { |
390 return parsing.measure(() { | 392 return parsing.measure(() { |
391 return reporter.withCurrentElement(element, () { | 393 return reporter.withCurrentElement(element, () { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 683 } |
682 } | 684 } |
683 } | 685 } |
684 element.resolvedAst = | 686 element.resolvedAst = |
685 new ParsedResolvedAst(element, root, body, elements, uri); | 687 new ParsedResolvedAst(element, root, body, elements, uri); |
686 } | 688 } |
687 } | 689 } |
688 | 690 |
689 const Key PARAMETER_NODE = const Key('parameter.node'); | 691 const Key PARAMETER_NODE = const Key('parameter.node'); |
690 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); | 692 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); |
OLD | NEW |