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

Function parseClassElementName

packages/babel-parser/src/parser/statement.ts:1972–1996  ·  view source on GitHub ↗
(
    this: Parser,
    member: Undone<N.ClassMember>,
  )

Source from the content-addressed store, hash-verified

1970
1971 // https://tc39.es/ecma262/#prod-ClassElementName
1972 parseClassElementName(
1973 this: Parser,
1974 member: Undone<N.ClassMember>,
1975 ): N.Expression | N.Identifier | N.PrivateName {
1976 const { type, value } = this.state;
1977 if (
1978 (type === tt.name || type === tt.string) &&
1979 member.static &&
1980 value === "prototype"
1981 ) {
1982 this.raise(Errors.StaticPrototype, this.state.startLoc);
1983 }
1984
1985 if (type === tt.privateName) {
1986 if (value === "constructor") {
1987 this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
1988 }
1989 const key = this.parsePrivateName();
1990 member.key = key;
1991 return key;
1992 }
1993
1994 this.parsePropertyName(member);
1995 return member.key;
1996 }
1997
1998 parseClassStaticBlock(
1999 this: Parser,

Callers

nothing calls this directly

Calls 1

parsePrivateNameMethod · 0.80

Tested by

no test coverage detected