Xtend Code generation for RichStrings (FIXED) [message #1739070] |
Wed, 27 July 2016 10:29 |
Neeraj Bhusare Messages: 177 Registered: July 2009 Location: Canada |
Senior Member |
|
|
Hi All,
In order to solve a problem, I need to understand how the code gets generated for RichString's. I have a very simple function - doPrint(StringConcatenationClient client). When I call this function with parameter '''Welcome «name»''' (name is a var), the following code gets generated.
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("Welcome ");
_builder.append(name, "");
}
};
With a bit of debugging, I was able to figure out the method "_toJavaStatement(RichString richString...)" in the class "XtendCompiler" that does most the job. What I didn't find was the code that generates the body of the appendTo method. To be specific, I am interested in the code that looks at '''Welcome «name»''' and generates the two "_builder.append" statements.
In the XtendLocationInFileProvider#getSignificantTextRegion(), I put a breakpoint inside "if (grammarAccess.getRICH_TEXT_INBETWEENRule() == ruleCall.getRule()) {", but it never got hit. I also spend some time going through classes - RichStringProcessor, AbstractRichTextValueConverter, RichTextInBetweenValueConverter, RichStringPrepareCompiler. But so far I haven't had much luck.
Am I missing something here ? Can someone please provide some pointers.
Tx in advance.
Twitter : @NeerajBhusare
Blog : https://nbhusare.github.io/
Best regards, Neeraj
[Updated on: Fri, 29 July 2016 03:48] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02391 seconds