-
I am using langium 0.4.0. I created a minimal language which models structs, which contain a list of attributes. These attributes can be of two types: arrays and scalar (https://github.com/goto40/msg-dsl-mixed-lookup-and-path):
Generating code from the list of attributes of a struct When this is done with the generated The following code "works":
The following code generates a problem for the else path:
Is this the intended way? Should I check for the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @goto40, I'm a bit confused, since I couldn't reproduce the problem that you experience with your repository. In general, the I've used a small test script: const ast = require('./language-server/generated/ast');
const isScalar = ast.isMsgScalarAttribute({ $type: 'MsgScalarAttribute' });
const isArray = ast.isMsgScalarAttribute({ $type: 'MsgArrayAttribute' });
console.log('scalar: ' + isScalar);
console.log('array: ' + isArray); However, it prints that |
Beta Was this translation helpful? Give feedback.
Hey @goto40,
I'm a bit confused, since I couldn't reproduce the problem that you experience with your repository. In general, the
langium-cli
will generate code (theAstReflection
) that allows to perform Class-like inheritance checking based on the$type
attribute and nothing else.I've used a small test script:
However, it prints that
MsgArrayAttribute
isn't aMsgScalarAttribute
as expected. Can you provide me with a…