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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 /// Deserialize a [ResolvedAst] that is defined in terms of an AST together | 332 /// Deserialize a [ResolvedAst] that is defined in terms of an AST together |
333 /// with [TreeElements]. | 333 /// with [TreeElements]. |
334 static ResolvedAst deserializeParsed( | 334 static ResolvedAst deserializeParsed( |
335 Element element, | 335 Element element, |
336 ObjectDecoder objectDecoder, | 336 ObjectDecoder objectDecoder, |
337 ParsingContext parsing, | 337 ParsingContext parsing, |
338 Token getBeginToken(Uri uri, int charOffset), | 338 Token getBeginToken(Uri uri, int charOffset), |
339 DeserializerPlugin nativeDataDeserializer) { | 339 DeserializerPlugin nativeDataDeserializer) { |
340 CompilationUnitElement compilationUnit = element.compilationUnit; | 340 CompilationUnitElement compilationUnit = element.compilationUnit; |
341 DiagnosticReporter reporter = parsing.reporter; | 341 DiagnosticReporter reporter = parsing.reporter; |
| 342 Uri uri = objectDecoder.getUri(Key.URI); |
342 | 343 |
343 /// Returns the first [Token] for parsing the [Node] for [element]. | 344 /// Returns the first [Token] for parsing the [Node] for [element]. |
344 Token readBeginToken() { | 345 Token readBeginToken() { |
345 Uri uri = objectDecoder.getUri(Key.URI); | |
346 int charOffset = objectDecoder.getInt(Key.OFFSET); | 346 int charOffset = objectDecoder.getInt(Key.OFFSET); |
347 Token beginToken = getBeginToken(uri, charOffset); | 347 Token beginToken = getBeginToken(uri, charOffset); |
348 if (beginToken == null) { | 348 if (beginToken == null) { |
349 reporter.internalError( | 349 reporter.internalError( |
350 element, "No token found for $element in $uri @ $charOffset"); | 350 element, "No token found for $element in $uri @ $charOffset"); |
351 } | 351 } |
352 return beginToken; | 352 return beginToken; |
353 } | 353 } |
354 | 354 |
355 /// Create the [Node] for the element by parsing the source code. | 355 /// Create the [Node] for the element by parsing the source code. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 ObjectDecoder nativeDataDecoder = | 618 ObjectDecoder nativeDataDecoder = |
619 objectDecoder.getObject(Key.NATIVE, isOptional: true); | 619 objectDecoder.getObject(Key.NATIVE, isOptional: true); |
620 if (nativeDataDecoder != null) { | 620 if (nativeDataDecoder != null) { |
621 var nativeData = nativeDataDeserializer.onData(nativeDataDecoder); | 621 var nativeData = nativeDataDeserializer.onData(nativeDataDecoder); |
622 if (nativeData != null) { | 622 if (nativeData != null) { |
623 elements.registerNativeData(node, nativeData); | 623 elements.registerNativeData(node, nativeData); |
624 } | 624 } |
625 } | 625 } |
626 } | 626 } |
627 } | 627 } |
628 return new ParsedResolvedAst(element, root, body, elements); | 628 return new ParsedResolvedAst(element, root, body, elements, uri); |
629 } | 629 } |
630 } | 630 } |
OLD | NEW |