mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Translate method names in interfaces if using JavaNaming Convention
This commit is contained in:
parent
fb717e5dcb
commit
4e95c2b446
@ -1694,11 +1694,24 @@ interface_member_declaration:
|
||||
;
|
||||
interface_property_declaration [CommonTree atts, CommonTree mods, CommonTree type]:
|
||||
i=identifier '{' iads=interface_accessor_declarations[atts, mods, type, $i.text] '}' -> $iads ;
|
||||
interface_method_declaration [CommonTree atts, CommonTree mods, CommonTree type]:
|
||||
interface_method_declaration [CommonTree atts, CommonTree mods, CommonTree type]
|
||||
@init {
|
||||
string newMethodName = "";
|
||||
}:
|
||||
identifier type_parameter_list?
|
||||
'(' formal_parameter_list? ')' type_parameter_constraints_clauses? s=';' magicThrowsException[Cfg.TranslatorBlanketThrow,$s.token]
|
||||
{
|
||||
newMethodName = $identifier.text.Replace(".","___");
|
||||
if (newMethodName != "Main" && Cfg.TranslatorMakeJavaNamingConventions) {
|
||||
// Leave Main() as it is because we are going to wrap it with a special main method
|
||||
newMethodName = toJavaConvention(CSharpEntity.METHOD, newMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
magicIdentifier[$identifier.tree.Token, newMethodName]
|
||||
|
||||
-> ^(METHOD { dupTree($atts) } { dupTree($mods) } { dupTree($type) }
|
||||
identifier type_parameter_constraints_clauses? type_parameter_list? formal_parameter_list? magicThrowsException?);
|
||||
magicIdentifier type_parameter_constraints_clauses? type_parameter_list? formal_parameter_list? magicThrowsException?);
|
||||
interface_event_declaration [CommonTree atts, CommonTree mods]:
|
||||
//attributes? 'new'?
|
||||
e='event' type identifier ';' -> ^(EVENT[$e.token, "EVENT"] { dupTree($atts) } { dupTree($mods) } type identifier)
|
||||
|
@ -1227,6 +1227,9 @@ interface_method_declaration [string returnType]:
|
||||
'(' fpl=formal_parameter_list? ')'
|
||||
{ MethodRepTemplate meth = new MethodRepTemplate($returnType, $identifier.text, (gal == null ? null : $gal.tyargs.ToArray()), $fpl.paramlist);
|
||||
meth.ParamArray = $formal_parameter_list.paramarr;
|
||||
if ($identifier.text != "Main" && Cfg.TranslatorMakeJavaNamingConventions) {
|
||||
meth.JavaName = toJavaConvention(CSharpEntity.METHOD, $identifier.text);
|
||||
}
|
||||
((InterfaceRepTemplate)$NSContext::currentTypeRep).Methods.Add(meth); }
|
||||
type_parameter_constraints_clauses? ';'
|
||||
{ DebugDetail("Processing interface method declaration: " + $identifier.text); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user