|Passing XExpressions as arguments outside of an XBlockExpression [message #1722587]
||Sat, 06 February 2016 09:12
| Larry LeBron
Registered: October 2015
I'm writing a language using XBase, using the JVMModelInferrer.|
In my language, I have entities which define parameters much like a java method:
'entity' name=ID '(' (params+=FullJvmFormalParameter (',' params+=FullJvmFormalParameter)* )?
Elsewhere in my code, I reference these entities and want to be able to pass arguments to them from outside of XBlockExpressions. Current grammar:
'entRef' entity=[Entity] '(' (args+=XExpression (',' args+=XExpression)*)? ')' ';'
These are not standard function calls, so would not work in a standard XBlockExpression. In my generated code, I need to obtain these arguments as a list of Java Expressions.
What is the best approach here? I've tried getting an instance of the XBaseCompiler and calling toJavaExpression(), but it's getting a null pointer exception which seems to be because the argument XExpression has a null type. Perhaps I've just got it set up wrong? I haven't yet been able to find an example.
I did find a reference to this post, which mentions the delegate pattern. However, I'd love a more concise option, if one exists.
Powered by FUDForum
. Page generated in 0.02535 seconds