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

Function parseClassElementName

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

parsePrivateNameMethod · 0.80

Tested by

no test coverage detected