MCPcopy
hub / github.com/rollup/rollup / PropertyDefinition

Class PropertyDefinition

src/ast/nodes/PropertyDefinition.ts:19–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17import { doNotDeoptimize, type ExpressionNode, NodeBase } from './shared/Node';
18
19export default class PropertyDefinition extends NodeBase {
20 declare key: ExpressionNode | PrivateIdentifier;
21 declare static: boolean;
22 declare type: NodeType.tPropertyDefinition;
23 declare value: ExpressionNode | null;
24 declare decorators: Decorator[];
25
26 get computed(): boolean {
27 return isFlagSet(this.flags, Flag.computed);
28 }
29 set computed(value: boolean) {
30 this.flags = setFlag(this.flags, Flag.computed, value);
31 }
32
33 deoptimizeArgumentsOnInteractionAtPath(
34 interaction: NodeInteraction,
35 path: ObjectPath,
36 recursionTracker: EntityPathTracker
37 ): void {
38 this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
39 }
40
41 deoptimizePath(path: ObjectPath): void {
42 this.value?.deoptimizePath(path);
43 }
44
45 getLiteralValueAtPath(
46 path: ObjectPath,
47 recursionTracker: EntityPathTracker,
48 origin: DeoptimizableEntity
49 ): LiteralValueOrUnknown {
50 return this.value
51 ? this.value.getLiteralValueAtPath(path, recursionTracker, origin)
52 : UnknownValue;
53 }
54
55 getReturnExpressionWhenCalledAtPath(
56 path: ObjectPath,
57 interaction: NodeInteractionCalled,
58 recursionTracker: EntityPathTracker,
59 origin: DeoptimizableEntity
60 ): [expression: ExpressionEntity, isPure: boolean] {
61 return this.value
62 ? this.value.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)
63 : UNKNOWN_RETURN_EXPRESSION;
64 }
65
66 hasEffects(context: HasEffectsContext): boolean {
67 return (
68 this.key.hasEffects(context) ||
69 (this.static && !!this.value?.hasEffects(context)) ||
70 checkEffectForNodes(this.decorators, context)
71 );
72 }
73
74 hasEffectsOnInteractionAtPath(
75 path: ObjectPath,
76 interaction: NodeInteraction,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…