mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
add variable args to symbol table
This commit is contained in:
parent
48235fdba6
commit
8aaa64d8bd
@ -72,7 +72,7 @@ scope SymTab {
|
|||||||
StringBuilder argNames = new StringBuilder();
|
StringBuilder argNames = new StringBuilder();
|
||||||
bool first = true;
|
bool first = true;
|
||||||
if (args != null && args.Length > 0) {
|
if (args != null && args.Length > 0) {
|
||||||
argNames.Append("<");
|
argNames.Append("[");
|
||||||
foreach (TypeRepTemplate ty in args) {
|
foreach (TypeRepTemplate ty in args) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
argNames.Append(", ");
|
argNames.Append(", ");
|
||||||
@ -80,7 +80,7 @@ scope SymTab {
|
|||||||
}
|
}
|
||||||
argNames.Append(ty.TypeName);
|
argNames.Append(ty.TypeName);
|
||||||
}
|
}
|
||||||
argNames.Append(">");
|
argNames.Append("]");
|
||||||
}
|
}
|
||||||
TypeRepTemplate tyRep = AppEnv.Search($NSContext::globalNamespaces, name, new UnknownRepTemplate(name + argNames.ToString()));
|
TypeRepTemplate tyRep = AppEnv.Search($NSContext::globalNamespaces, name, new UnknownRepTemplate(name + argNames.ToString()));
|
||||||
tyRep.Apply(args);
|
tyRep.Apply(args);
|
||||||
@ -174,6 +174,14 @@ scope SymTab {
|
|||||||
return (CommonTree)adaptor.RulePostProcessing(root);
|
return (CommonTree)adaptor.RulePostProcessing(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CommonTree mkArray(CommonTree t, IToken tok) {
|
||||||
|
if (!t.IsNil) {
|
||||||
|
adaptor.AddChild(t, (CommonTree)adaptor.Create(OPEN_BRACKET, tok, "["));
|
||||||
|
adaptor.AddChild(t, (CommonTree)adaptor.Create(CLOSE_BRACKET, tok, "]"));
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
protected CommonTree dupTree(CommonTree t) {
|
protected CommonTree dupTree(CommonTree t) {
|
||||||
return (CommonTree)adaptor.DupTree(t);
|
return (CommonTree)adaptor.DupTree(t);
|
||||||
}
|
}
|
||||||
@ -1190,7 +1198,8 @@ default_argument:
|
|||||||
parameter_modifier:
|
parameter_modifier:
|
||||||
'ref' | 'out' | 'this' ;
|
'ref' | 'out' | 'this' ;
|
||||||
parameter_array:
|
parameter_array:
|
||||||
^('params' type identifier) ;
|
^(p='params' type identifier { $SymTab::symtab[$identifier.thetext] = findType("System.Array", new TypeRepTemplate[] {$type.dotNetType}); }) ;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
interface_declaration:
|
interface_declaration:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user