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 library summary_resynthesizer; | 5 library summary_resynthesizer; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 * Create a [_UnitResynthesizer] that will resynthesize the part with the | 1013 * Create a [_UnitResynthesizer] that will resynthesize the part with the |
1014 * given [uri]. Return `null` if the [uri] is invalid. | 1014 * given [uri]. Return `null` if the [uri] is invalid. |
1015 */ | 1015 */ |
1016 _UnitResynthesizer buildPart(_UnitResynthesizer definingUnitResynthesizer, | 1016 _UnitResynthesizer buildPart(_UnitResynthesizer definingUnitResynthesizer, |
1017 String uri, UnlinkedPart partDecl, int unitNum) { | 1017 String uri, UnlinkedPart partDecl, int unitNum) { |
1018 Source unitSource = | 1018 Source unitSource = |
1019 summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri); | 1019 summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri); |
1020 _UnitResynthesizer partResynthesizer = | 1020 _UnitResynthesizer partResynthesizer = |
1021 createUnitResynthesizer(unitNum, unitSource, partDecl); | 1021 createUnitResynthesizer(unitNum, unitSource, partDecl); |
1022 CompilationUnitElementImpl partUnit = partResynthesizer.unit; | 1022 CompilationUnitElementImpl partUnit = partResynthesizer.unit; |
1023 partUnit.uriOffset = partDecl.uriOffset; | |
1024 partUnit.uriEnd = partDecl.uriEnd; | |
1025 partUnit.source = unitSource; | 1023 partUnit.source = unitSource; |
1026 partUnit.librarySource = librarySource; | 1024 partUnit.librarySource = librarySource; |
1027 partUnit.uri = uri; | |
1028 return partResynthesizer; | 1025 return partResynthesizer; |
1029 } | 1026 } |
1030 | 1027 |
1031 /** | 1028 /** |
1032 * Set up data structures for deserializing a compilation unit. | 1029 * Set up data structures for deserializing a compilation unit. |
1033 */ | 1030 */ |
1034 _UnitResynthesizer createUnitResynthesizer( | 1031 _UnitResynthesizer createUnitResynthesizer( |
1035 int unitNum, Source unitSource, UnlinkedPart unlinkedPart) { | 1032 int unitNum, Source unitSource, UnlinkedPart unlinkedPart) { |
1036 LinkedUnit linkedUnit = linkedLibrary.units[unitNum]; | 1033 LinkedUnit linkedUnit = linkedLibrary.units[unitNum]; |
1037 UnlinkedUnit unlinkedUnit = unlinkedUnits[unitNum]; | 1034 UnlinkedUnit unlinkedUnit = unlinkedUnits[unitNum]; |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 static String _getElementIdentifier(String name, ReferenceKind kind) { | 1968 static String _getElementIdentifier(String name, ReferenceKind kind) { |
1972 if (kind == ReferenceKind.topLevelPropertyAccessor || | 1969 if (kind == ReferenceKind.topLevelPropertyAccessor || |
1973 kind == ReferenceKind.propertyAccessor) { | 1970 kind == ReferenceKind.propertyAccessor) { |
1974 if (!name.endsWith('=')) { | 1971 if (!name.endsWith('=')) { |
1975 return name + '?'; | 1972 return name + '?'; |
1976 } | 1973 } |
1977 } | 1974 } |
1978 return name; | 1975 return name; |
1979 } | 1976 } |
1980 } | 1977 } |
OLD | NEW |