-
-
Notifications
You must be signed in to change notification settings - Fork 936
Closed
Description
ObjectProperty currently looks like this:
pub struct ObjectProperty<'a> {
pub span: Span,
pub kind: PropertyKind,
pub key: PropertyKey<'a>,
pub value: Expression<'a>,
pub init: Option<Expression<'a>>, // for `CoverInitializedName`
pub method: bool,
pub shorthand: bool,
pub computed: bool,
}As I understand it, the init field is only used within parser as a temporary value, but final AST will always have this field as None.
It'd be ideal to remove this field for 2 reasons:
- It adds 16 bytes to
ObjectProperty, andObjectPropertyis extremely common in ASTs, so it's not an insignificant cost. - It's something of a footgun. Code should never set
initfield to anything other thanNone, but it currently can.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackPriority
None yet