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

Function pushClassAccessorProperty

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

Source from the content-addressed store, hash-verified

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