You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec marks optional fields with | null. I was wondering whether optional fields may also be undefined. The spec describes it this way:
The loc field represents the source location information of the node. If the node contains no information about the source location, the field is null; otherwise it is an object consisting of ..
This would suggest that undefined is not allowed for these fields. Though various implementations do not set optional fields, causing that those fields are undefined. For instance, Acorn and Esprima do not set loc when location tracking is not turned on, meaning that loc is undefined. When writing transforms it is also easier to write { type: "Identifier", name: "foo" } than { type: "Identifier", loc: null, name: "foo" }.
Is the latter the desired interpretation? If so, could the spec be updated to reflect that?
The text was updated successfully, but these errors were encountered:
The spec marks optional fields with
| null
. I was wondering whether optional fields may also beundefined
. The spec describes it this way:This would suggest that
undefined
is not allowed for these fields. Though various implementations do not set optional fields, causing that those fields areundefined
. For instance, Acorn and Esprima do not setloc
when location tracking is not turned on, meaning thatloc
isundefined
. When writing transforms it is also easier to write{ type: "Identifier", name: "foo" }
than{ type: "Identifier", loc: null, name: "foo" }
.Is the latter the desired interpretation? If so, could the spec be updated to reflect that?
The text was updated successfully, but these errors were encountered: