Skip to content

Commit feaf530

Browse files
committed
Update
[ghstack-poisoned]
1 parent 39be854 commit feaf530

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/apps/playground/components/Editor/EditorImpl.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function getReactFunctionType(id: t.Identifier | null): ReactFunctionType {
169169
return 'Other';
170170
}
171171

172-
function getFunctionName(
172+
function getFunctionIdentifier(
173173
fn:
174174
| NodePath<t.FunctionDeclaration>
175175
| NodePath<t.ArrowFunctionExpression>
@@ -183,7 +183,7 @@ function getFunctionName(
183183
}
184184

185185
let count = 0;
186-
function makeIdentifier(id: t.Identifier | null): t.Identifier {
186+
function withIdentifier(id: t.Identifier | null): t.Identifier {
187187
if (id != null && id.name != null) {
188188
return id;
189189
} else {
@@ -214,7 +214,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
214214
const config = parseConfigPragma(pragma);
215215

216216
for (const fn of parseFunctions(source, language)) {
217-
const id = getFunctionName(fn);
217+
const id = withIdentifier(getFunctionIdentifier(fn));
218218
for (const result of run(
219219
fn,
220220
{
@@ -227,7 +227,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
227227
null,
228228
null,
229229
)) {
230-
const fnName = id?.name ?? '(anonymous)';
230+
const fnName = id.name;
231231
switch (result.kind) {
232232
case 'ast': {
233233
upsert({
@@ -236,7 +236,7 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
236236
name: result.name,
237237
value: {
238238
type: 'FunctionDeclaration',
239-
id: makeIdentifier(result.value.id),
239+
id,
240240
async: result.value.async,
241241
generator: result.value.generator,
242242
body: result.value.body,

0 commit comments

Comments
 (0)