| 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 * Create a [_UnitResynthesizer] that will resynthesize the part with the | 1031 * Create a [_UnitResynthesizer] that will resynthesize the part with the |
| 1032 * given [uri]. Return `null` if the [uri] is invalid. | 1032 * given [uri]. Return `null` if the [uri] is invalid. |
| 1033 */ | 1033 */ |
| 1034 _UnitResynthesizer buildPart(_UnitResynthesizer definingUnitResynthesizer, | 1034 _UnitResynthesizer buildPart(_UnitResynthesizer definingUnitResynthesizer, |
| 1035 String uri, UnlinkedPart partDecl, int unitNum) { | 1035 String uri, UnlinkedPart partDecl, int unitNum) { |
| 1036 Source unitSource = | 1036 Source unitSource = |
| 1037 summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri); | 1037 summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri); |
| 1038 _UnitResynthesizer partResynthesizer = | 1038 _UnitResynthesizer partResynthesizer = |
| 1039 createUnitResynthesizer(unitNum, unitSource, partDecl); | 1039 createUnitResynthesizer(unitNum, unitSource, partDecl); |
| 1040 CompilationUnitElementImpl partUnit = partResynthesizer.unit; | 1040 CompilationUnitElementImpl partUnit = partResynthesizer.unit; |
| 1041 partUnit.uriOffset = partDecl.uriOffset; |
| 1042 partUnit.uriEnd = partDecl.uriEnd; |
| 1041 partUnit.source = unitSource; | 1043 partUnit.source = unitSource; |
| 1042 partUnit.librarySource = librarySource; | 1044 partUnit.librarySource = librarySource; |
| 1045 partUnit.uri = uri; |
| 1043 return partResynthesizer; | 1046 return partResynthesizer; |
| 1044 } | 1047 } |
| 1045 | 1048 |
| 1046 /** | 1049 /** |
| 1047 * Set up data structures for deserializing a compilation unit. | 1050 * Set up data structures for deserializing a compilation unit. |
| 1048 */ | 1051 */ |
| 1049 _UnitResynthesizer createUnitResynthesizer( | 1052 _UnitResynthesizer createUnitResynthesizer( |
| 1050 int unitNum, Source unitSource, UnlinkedPart unlinkedPart) { | 1053 int unitNum, Source unitSource, UnlinkedPart unlinkedPart) { |
| 1051 LinkedUnit linkedUnit = linkedLibrary.units[unitNum]; | 1054 LinkedUnit linkedUnit = linkedLibrary.units[unitNum]; |
| 1052 UnlinkedUnit unlinkedUnit = unlinkedUnits[unitNum]; | 1055 UnlinkedUnit unlinkedUnit = unlinkedUnits[unitNum]; |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 static String _getElementIdentifier(String name, ReferenceKind kind) { | 1989 static String _getElementIdentifier(String name, ReferenceKind kind) { |
| 1987 if (kind == ReferenceKind.topLevelPropertyAccessor || | 1990 if (kind == ReferenceKind.topLevelPropertyAccessor || |
| 1988 kind == ReferenceKind.propertyAccessor) { | 1991 kind == ReferenceKind.propertyAccessor) { |
| 1989 if (!name.endsWith('=')) { | 1992 if (!name.endsWith('=')) { |
| 1990 return name + '?'; | 1993 return name + '?'; |
| 1991 } | 1994 } |
| 1992 } | 1995 } |
| 1993 return name; | 1996 return name; |
| 1994 } | 1997 } |
| 1995 } | 1998 } |
| OLD | NEW |