Skip to content

Commit cfd2c60

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

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,6 @@ function getFunctionIdentifier(
182182
return Array.isArray(id) === false && id.isIdentifier() ? id.node : null;
183183
}
184184

185-
let count = 0;
186-
function withIdentifier(id: t.Identifier | null): t.Identifier {
187-
if (id != null && id.name != null) {
188-
return id;
189-
} else {
190-
return t.identifier(`anonymous_${count++}`);
191-
}
192-
}
193-
194185
function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
195186
const results = new Map<string, PrintedCompilerPipelineValue[]>();
196187
const error = new CompilerError();
@@ -208,6 +199,14 @@ function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] {
208199
} else {
209200
language = 'typescript';
210201
}
202+
let count = 0;
203+
const withIdentifier = (id: t.Identifier | null): t.Identifier => {
204+
if (id != null && id.name != null) {
205+
return id;
206+
} else {
207+
return t.identifier(`anonymous_${count++}`);
208+
}
209+
};
211210
try {
212211
// Extract the first line to quickly check for custom test directives
213212
const pragma = source.substring(0, source.indexOf('\n'));

0 commit comments

Comments
 (0)