Class Expr::Property

A property definition in an object literal, which may be either a value property, a property getter, or a property setter.

Note that property definitions are not expressions.

Examples:

var p = {
  x: 1,                                                          // value property
  y: 1,                                                          // value property
  diag: function() { return this.x - this.y; },                  // value property
  get area() { return this.x * this.y; },                        // property getter
  set area(a) { this.x = Math.sqrt(a); this.y = Math.sqrt(a); }  // property setter
}

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getADecorator

Gets a decorator applied to this property.

getContainer

Gets the function or toplevel in which this property occurs.

getDecorator

Gets the ith decorator applied to this property.

getFirstControlFlowNode

Gets the first control flow node belonging to this syntactic entity.

getIndex

Gets the (0-based) index at which this property appears in its enclosing literal.

getInit

Gets the expression specifying the initial value of this property.

getKind

Gets the kind of this property, which is an opaque integer value indicating whether this property is a value property, a property getter, or a property setter.

getName

Gets the name of this property.

getNameExpr

Gets the expression specifying the name of this property.

getObjectExpr

Gets the object literal this property belongs to.

isComputed

Holds if the name of this property is computed.

isImpure

Holds if this property is impure, that is, the evaluation of its name or its initializer expression could have side effects.

isMethod

Holds if this property is defined using method syntax.

isShorthand

Holds if this property is defined using shorthand syntax.

toString

Gets a textual representation of this element.

Inherited predicates

getAChild

Gets a child node of this node.

from ASTNode
getAChildExpr

Gets a child expression of this node.

from ASTNode
getAChildStmt

Gets a child statement of this node.

from ASTNode
getAToken

Gets a token belonging to this element.

from ASTNode
getChild

Gets the ith child node of this node.

from ASTNode
getChildExpr

Gets the ith child expression of this node.

from ASTNode
getChildStmt

Gets the ith child statement of this node.

from ASTNode
getChildTypeExpr

Gets the ith child type expression of this node.

from ASTNode
getDocumentation

Gets the JSDoc comment for this element, if any.

from Documentable
getEndLine

Gets the line on which this element ends.

from Locatable
getFile

Gets the file this program element comes from.

from Locatable
getFirstToken

Gets the first token belonging to this element.

from ASTNode
getLastToken

Gets the last token belonging to this element.

from ASTNode
getLocation

Gets this element’s location.

from ASTNode
getNumChild

Gets the number of child nodes of this node.

from ASTNode
getNumChildExpr

Gets the number of child expressions of this node.

from ASTNode
getNumChildStmt

Gets the number of child statements of this node.

from ASTNode
getNumLines

Gets the number of lines covered by this element.

from Locatable
getParent

Gets the parent node of this node, if any.

from ASTNode
getStartLine

Gets the line on which this element starts.

from Locatable
getTopLevel

Gets the toplevel syntactic unit to which this element belongs.

from ASTNode
inExternsFile

Holds if this syntactic entity belongs to an externs file.

from ASTNode
isAmbient

Holds if this is part of an ambient declaration or type annotation in a TypeScript file.

from ASTNode

Charpred