Skip to content

What is the recommended way to create a model element (an AstNode) programatically? #773

Answered by spoenemann
goto40 asked this question in Q&A
Discussion options

You must be logged in to vote
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 $refNode optional to better support programmatic construction.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@spoenemann
Comment options

Answer selected by goto40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants