-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tokenIndex to SymbolNode #2796
base: develop
Are you sure you want to change the base?
Changes from all commits
742e662
32793d7
b722237
173b20a
e3706b8
fea1cbe
c169f7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,6 +221,7 @@ Jaeu Jeong <[email protected]> | |
cyavictor88 <[email protected]> | ||
David Contreras <[email protected]> | ||
Jakub Riegel <[email protected]> | ||
Matthew Canestraro <[email protected]> | ||
Angus Comrie <[email protected]> | ||
TMTron <[email protected]> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,9 +47,10 @@ export const createAccessorNode = /* #__PURE__ */ factory(name, dependencies, ({ | |
* @param {Node} object The object from which to retrieve | ||
* a property or subset. | ||
* @param {IndexNode} index IndexNode containing ranges | ||
* @param {MetaOptions} object with additional options for building this node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for clarity: to make this valid JSDoc, the lines like:
Should be changed to:
And if meta is optional:
|
||
*/ | ||
constructor (object, index) { | ||
super() | ||
constructor (object, index, meta = {}) { | ||
super(meta) | ||
if (!isNode(object)) { | ||
throw new TypeError('Node expected for parameter "object"') | ||
} | ||
|
@@ -133,10 +134,13 @@ export const createAccessorNode = /* #__PURE__ */ factory(name, dependencies, ({ | |
|
||
/** | ||
* Create a clone of this node, a shallow copy | ||
* @param {MetaOptions} object with additional options for cloning this node | ||
* @return {AccessorNode} | ||
*/ | ||
clone () { | ||
return new AccessorNode(this.object, this.index) | ||
clone (meta = {}) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value for meta, an empty object I think it is best to have /**
* Create a clone of this node, a shallow copy
* @param {MetaOptions} [meta] object with additional options for cloning this node
* @return {AccessorNode}
*/
clone (meta) {
const cloned = new AccessorNode(this.object, this.index, meta ?? { sources: this.sources })
return cloned
} Having to construct a default meta object via const defaultMetaOptions = {
sources = []
}
class Node {
/**
* @constructor Node
* A generic node, the parent of other AST nodes
* @param {MetaOptions} [meta] object with additional options for building this node
*/
constructor (meta = defaultMetaOptions) {
this.meta = meta
}
// ...
} |
||
meta.sources = meta.sources || this.sources | ||
const cloned = new AccessorNode(this.object, this.index, meta) | ||
return cloned | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
options
are optional, can you describe that here and for all constructors in the docs?