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

Method exit

packages/babel-parser/src/util/class-scope.ts:34–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 }
33
34 exit() {
35 const oldClassScope = this.stack.pop()!;
36
37 // Migrate the usage of not yet defined private names to the outer
38 // class scope, or raise an error if we reached the top-level scope.
39
40 const current = this.current();
41
42 // Array.from is needed because this is compiled to an array-like for loop
43 for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) {
44 if (current) {
45 if (!current.undefinedPrivateNames.has(name)) {
46 current.undefinedPrivateNames.set(name, loc);
47 }
48 } else {
49 this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
50 identifierName: name,
51 });
52 }
53 }
54 }
55
56 declarePrivateName(name: string, elementType: ClassElementType, loc: number) {
57 const { privateNames, loneAccessors, undefinedPrivateNames } =

Callers

nothing calls this directly

Calls 3

currentMethod · 0.95
setMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected