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

Function pushClassAccessorProperty

packages/babel-parser/src/parser/statement.ts:2057–2079  ·  view source on GitHub ↗
(
    this: Parser,
    classBody: Undone<N.ClassBody>,
    prop: Undone<N.ClassAccessorProperty>,
    isPrivate: boolean,
  )

Source from the content-addressed store, hash-verified

2055 }
2056
2057 pushClassAccessorProperty(
2058 this: Parser,
2059 classBody: Undone<N.ClassBody>,
2060 prop: Undone<N.ClassAccessorProperty>,
2061 isPrivate: boolean,
2062 ) {
2063 if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
2064 // Non-computed field, which is either an identifier named "constructor"
2065 // or a string literal named "constructor"
2066 this.raise(Errors.ConstructorClassField, prop.key);
2067 }
2068
2069 const node = this.parseClassAccessorProperty(prop);
2070 classBody.body.push(node);
2071
2072 if (isPrivate) {
2073 this.classScope.declarePrivateName(
2074 this.getPrivateNameSV(node.key as N.PrivateName),
2075 ClassElementType.OTHER,
2076 node.key.start!,
2077 );
2078 }
2079 }
2080
2081 pushClassMethod(
2082 this: Parser,

Callers

nothing calls this directly

Calls 5

nameIsConstructorMethod · 0.80
declarePrivateNameMethod · 0.80
getPrivateNameSVMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected