1
0
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:
Kevin Glynn 2011-01-25 12:21:10 +01:00
parent 48235fdba6
commit 8aaa64d8bd

View File

@ -72,7 +72,7 @@ scope SymTab {
StringBuilder argNames = new StringBuilder();
bool first = true;
if (args != null && args.Length > 0) {
argNames.Append("<");
argNames.Append("[");
foreach (TypeRepTemplate ty in args) {
if (!first) {
argNames.Append(", ");
@ -80,7 +80,7 @@ scope SymTab {
}
argNames.Append(ty.TypeName);
}
argNames.Append(">");
argNames.Append("]");
}
TypeRepTemplate tyRep = AppEnv.Search($NSContext::globalNamespaces, name, new UnknownRepTemplate(name + argNames.ToString()));
tyRep.Apply(args);
@ -174,6 +174,14 @@ scope SymTab {
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) {
return (CommonTree)adaptor.DupTree(t);
}
@ -1190,7 +1198,8 @@ default_argument:
parameter_modifier:
'ref' | 'out' | 'this' ;
parameter_array:
^('params' type identifier) ;
^(p='params' type identifier { $SymTab::symtab[$identifier.thetext] = findType("System.Array", new TypeRepTemplate[] {$type.dotNetType}); }) ;
///////////////////////////////////////////////////////
interface_declaration: