@@ -23,7 +23,7 @@ namespace FourSlash {
23
23
ts . disableIncrementalParsing = false ;
24
24
25
25
// Represents a parsed source file with metadata
26
- export interface FourSlashFile {
26
+ interface FourSlashFile {
27
27
// The contents of the file (with markers, etc stripped out)
28
28
content : string ;
29
29
fileName : string ;
@@ -34,7 +34,7 @@ namespace FourSlash {
34
34
}
35
35
36
36
// Represents a set of parsed source files and options
37
- export interface FourSlashData {
37
+ interface FourSlashData {
38
38
// Global options (name/value pairs)
39
39
globalOptions : Harness . TestCaseParser . CompilerSettings ;
40
40
@@ -59,7 +59,7 @@ namespace FourSlash {
59
59
export interface Marker {
60
60
fileName : string ;
61
61
position : number ;
62
- data ?: any ;
62
+ data ?: { } ;
63
63
}
64
64
65
65
export interface Range {
@@ -89,21 +89,6 @@ namespace FourSlash {
89
89
end : number ;
90
90
}
91
91
92
- export import IndentStyle = ts . IndentStyle ;
93
-
94
- const entityMap = ts . createMapFromTemplate ( {
95
- "&" : "&" ,
96
- "\"" : """ ,
97
- "'" : "'" ,
98
- "/" : "/" ,
99
- "<" : "<" ,
100
- ">" : ">"
101
- } ) ;
102
-
103
- export function escapeXmlAttributeValue ( s : string ) {
104
- return s . replace ( / [ & < > " ' \/ ] / g, ch => entityMap . get ( ch ) ) ;
105
- }
106
-
107
92
// Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions
108
93
// To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames
109
94
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
@@ -1079,7 +1064,7 @@ namespace FourSlash {
1079
1064
for ( const reference of expectedReferences ) {
1080
1065
const { fileName, start, end } = reference ;
1081
1066
if ( reference . marker && reference . marker . data ) {
1082
- const { isWriteAccess, isDefinition } = reference . marker . data ;
1067
+ const { isWriteAccess, isDefinition } = reference . marker . data as { isWriteAccess ?: boolean , isDefinition ?: boolean } ;
1083
1068
this . verifyReferencesWorker ( actualReferences , fileName , start , end , isWriteAccess , isDefinition ) ;
1084
1069
}
1085
1070
else {
@@ -1108,7 +1093,16 @@ namespace FourSlash {
1108
1093
}
1109
1094
const fullExpected = ts . map < FourSlashInterface . ReferenceGroup , ReferenceGroupJson > ( parts , ( { definition, ranges } ) => ( {
1110
1095
definition : typeof definition === "string" ? definition : { ...definition , range : textSpanFromRange ( definition . range ) } ,
1111
- references : ranges . map ( rangeToReferenceEntry ) ,
1096
+ references : ranges . map < ts . ReferenceEntry > ( r => {
1097
+ const { isWriteAccess = false , isDefinition = false , isInString } = ( r . marker && r . marker . data || { } ) as { isWriteAccess ?: boolean , isDefinition ?: boolean , isInString ?: true } ;
1098
+ return {
1099
+ isWriteAccess,
1100
+ isDefinition,
1101
+ fileName : r . fileName ,
1102
+ textSpan : textSpanFromRange ( r ) ,
1103
+ ...( isInString ? { isInString : true } : undefined ) ,
1104
+ } ;
1105
+ } ) ,
1112
1106
} ) ) ;
1113
1107
1114
1108
for ( const startRange of toArray ( startRanges ) ) {
@@ -1122,15 +1116,6 @@ namespace FourSlash {
1122
1116
} ) ;
1123
1117
this . assertObjectsEqual ( fullActual , fullExpected ) ;
1124
1118
}
1125
-
1126
- function rangeToReferenceEntry ( r : Range ) : ts . ReferenceEntry {
1127
- const { isWriteAccess, isDefinition, isInString } = ( r . marker && r . marker . data ) || { isWriteAccess : false , isDefinition : false , isInString : undefined } ;
1128
- const result : ts . ReferenceEntry = { fileName : r . fileName , textSpan : textSpanFromRange ( r ) , isWriteAccess : ! ! isWriteAccess , isDefinition : ! ! isDefinition } ;
1129
- if ( isInString !== undefined ) {
1130
- result . isInString = isInString ;
1131
- }
1132
- return result ;
1133
- }
1134
1119
}
1135
1120
1136
1121
public verifyNoReferences ( markerNameOrRange ?: string | Range ) {
0 commit comments