MCPcopy Create free account
hub / github.com/babel/babel / isForUsing

Function isForUsing

packages/babel-parser/src/parser/statement.ts:202–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 }
201
202 isForUsing(): boolean {
203 if (!this.isContextual(tt._using)) {
204 return false;
205 }
206 const next = this.nextTokenInLineStart();
207 const nextCh = this.codePointAtPos(next);
208 if (this.isUnparsedContextual(next, "of")) {
209 const nextCharAfterOf = this.lookaheadCharCodeSince(next + 2);
210 // `for( using of` must start either a for-lhs-of statement
211 // or a for lexical declaration
212 if (
213 nextCharAfterOf !== charCodes.equalsTo &&
214 nextCharAfterOf !== charCodes.colon &&
215 // recover from `for(using of;...);`
216 nextCharAfterOf !== charCodes.semicolon
217 ) {
218 return false;
219 }
220 }
221 if (
222 this.chStartsBindingIdentifier(nextCh, next) ||
223 this.isUnparsedContextual(next, "void")
224 ) {
225 return true;
226 }
227 return false;
228 }
229
230 nextTokenIsIdentifierOnSameLine(): boolean {
231 const next = this.nextTokenInLineStart();

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected