What is the recommended way to create a model element (an AstNode) programatically? #773
-
What is the recommended way to create a model element (an AstNode) programatically? I have a generator and I would like to create some artifical AstElements to pass to the generator.
Example:
In this example I would like to create a |
Beta Was this translation helpful? Give feedback.
Answered by
spoenemann
Nov 22, 2022
Replies: 1 comment 1 reply
-
const property: Property = {
$type: Property,
definition: {
ref: definition,
$refText: definition.name,
$refNode: undefined! // This is currently mandatory
},
value: 1234
};
// Add the new node to the AST
container.properties.push(property);
linkContentToContainer(container); We should make |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
goto40
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We should make
$refNode
optional to better support programmatic construction.