|
|
|
|
Re: JVM Model Infer Append String to XBlockExpression [message #1833992 is a reply to message #1833573] |
Thu, 29 October 2020 14:49 |
Ben Holland Messages: 34 Registered: April 2019 |
Member |
|
|
Sorry I didn't see this reply. I ended up restructuring my codegen design to not need this, but the part at the end was a string I planned to generate (an implicit initialization step I wanted to live in the same scope as the variables declared in the XBlockExpression). I have two follow up questions.
1) Perhaps a better question would be is it possible to concatenate two XBlockExpressions into a single body? I imagine I could try to create a new XBlockExpression and populate it with the contents of the other two XBlockExpressions.
2) I see the append(string) function is discouraged. What is the implication of using that function in place of an XExpression? Say for instance I wanted to create and initialize a field. Is there a good way to generate the XExpression to initialize the field and is it worth it to do that?
it.members += toField(myField, "myField", typeRef("com.foo.MyField"))[
it.visibility = JvmVisibility.PRIVATE;
it. final = true;
]
// CAN I DO THIS BY GENERATING AN XEXPRESSION THAT DID NOT COME FROM THE PARSER?
it.members += toConstructor(myObj)[
it.body = [append("this.myField = new com.foo.MyField();")];
]
[Updated on: Thu, 29 October 2020 14:50] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03817 seconds