Optional
argument: ExpressionNodeOptional
range: [number, number]Optional
loc: SourceLocationOptional
locThe loc
field represents the source location information of the node.
If the node contains no information about the source location,
the field is null
or undefined
;
otherwise it is an object consisting of
a start position (the position of the first character of the parsed source region)
and an end position (the position of the first character after the parsed source region):
and offset index (the position of the first character)
Optional
rangestart and end position offset
The type
field is a string representing the AST variant type.
Each subtype of Node
is documented below with the specific string of its type field.
You can use this field to determine which interface a node implements.
get all dependencies form an expression node
the return from this method, is represent an answer for what identifiers this expression depends-on.
ex:
x + y;
+
operator : the answer should be lhs
and rhs
,x
identifier: the answer should be node x
,y
identifier: the answer should be node y
.so, the return from +
will be [ node 'x', node 'y']
and:
x.y.z * a
==> [ member node
x.y.z, identifier 'a']
Optional
computed: trueex:
x + y;
+
operator : the answer should be lhs
and rhs
,x
identifier: the answer should be node x
,y
identifier: the answer should be node y
.so, the return from +
will be ['x', 'y']
and:
x.y.z
==> ['x', 'y', 'z']
x[y].z
==> ['x', ]Optional
computed: truerequired for member and chaining operators
get all the events form this expression
the return from this method, is represent an answer for what is this expression depends-on as identifier name
ex:
x + y;
+
operator : the answer should be lhs
and rhs
,x
identifier: the answer should be x
y
identifier: the answer should be y
the final output will beso, the return from +
will be { x: undefined, y: undefined }
and:
x.y.z * a
==> { x: { y: { z: undefined }, a: undefined } }
x.y.z > x.y.h.g
==> { x: { y: { z: undefined, h: { g: undefined} } } }
x[Symbol.toStringTag] + 'Class' + classType + array[3]
==> { x: { 'Symbol.toStringTag': undefined }, classType: undefined, array: { 3: undefined } }
'name'
==> {}
user[firstName + son of ${fatherName}
]
``` ==> { user: { 'firstName:fatherName': undefined }, firstName: undefined, fatherName: undefined }
execute/get the code for this expression and return the result value.
just a helper method to force class that implement this interface to
have a static method fromJSON
to help reconstruct this ExpressionNode
from an ESTree json object,
with all necessary implementation to execute the code
used to map this object to represent an ESTree json object
Optional
key: stringStatic
fromJSONStatic
visit
The expression whose value is to be returned. If omitted, undefined is returned instead.