Skip to content

Commit c95e2e4

Browse files
committed
Support members with dots in their name
1 parent 4f21fd5 commit c95e2e4

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

build/monaco/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName,
135135
}
136136
else {
137137
const memberName = member.name.text;
138+
const memberAccess = (memberName.indexOf('.') >= 0 ? `['${memberName}']` : `.${memberName}`);
138139
if (isStatic(member)) {
139-
usage.push(`a = ${staticTypeName}.${memberName};`);
140+
usage.push(`a = ${staticTypeName}${memberAccess};`);
140141
}
141142
else {
142-
usage.push(`a = (<${instanceTypeName}>b).${memberName};`);
143+
usage.push(`a = (<${instanceTypeName}>b)${memberAccess};`);
143144
}
144145
}
145146
}

build/monaco/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati
167167
result = result.replace(memberText, '');
168168
} else {
169169
const memberName = (<ts.Identifier | ts.StringLiteral>member.name).text;
170+
const memberAccess = (memberName.indexOf('.') >= 0 ? `['${memberName}']` : `.${memberName}`);
170171
if (isStatic(member)) {
171-
usage.push(`a = ${staticTypeName}.${memberName};`);
172+
usage.push(`a = ${staticTypeName}${memberAccess};`);
172173
} else {
173-
usage.push(`a = (<${instanceTypeName}>b).${memberName};`);
174+
usage.push(`a = (<${instanceTypeName}>b)${memberAccess};`);
174175
}
175176
}
176177
} catch (err) {

0 commit comments

Comments
 (0)