Implicit parameters [message #1082255] |
Thu, 08 August 2013 09:54 |
Thomas Goossens Messages: 32 Registered: August 2013 |
Member |
|
|
In the DSL I'm creating I want in some special cases to have methods that implicitly have parameters (that you don't have to type, because they are ALWAYS there)
So:
function example(int a){
}
Should expand to:
public void example(int a, MyClass x){
}
For given parameters I could do:
parameter.toParameter(parameter.name, parameter.parameterType)
But I'm not sure what to do.
I don't expect a fully detailed answer, just some hints would make me already very happy :)
[Updated on: Thu, 08 August 2013 09:54] Report message to a moderator
|
|
|
Re: Implicit parameters [message #1082326 is a reply to message #1082255] |
Thu, 08 August 2013 12:15 |
|
Hi
you are talking about the jvmmodelinferrer right
so what about using
org.eclipse.xtext.common.types.util.TypeReferences.getTypeForName(String, Notifier, JvmTypeReference...)
to get a new type (first param is name of the class, second the context (in this case your funktion or the first parameter)
function.toParameter("x", type)
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03720 seconds