diff options
author | Ankit Jain <radical@corewars.org> | 2006-01-10 19:38:08 +0300 |
---|---|---|
committer | Ankit Jain <radical@corewars.org> | 2006-01-10 19:38:08 +0300 |
commit | c11b7068c03225c7dbb9774d27a987382190f3ab (patch) | |
tree | 4dde567a93aa944667914a4038b6b9649350e5cc /mcs/ilasm | |
parent | c2af6f8b343f23d15331e8d318f7e647b2dc3a54 (diff) |
In ilasm/parser:
* ILParser.jay (type | BANG ..): Move !* and !!* rules to ..
(generic_class_ref): ..this, to allow using VAR/MVARs as class refs.
Eg. "extends !0"
In class/PEAPI:
* Metadata.cs (GenParam): Don't use GetTypeSpec to create typespec for GenParam.
Adding required methods directly to GenParam.
* PEAPI.cs (PEFile.AddGenericParam): Add it to the TypeSpec table directly.
svn path=/trunk/mcs/; revision=55306
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/parser/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/ilasm/parser/ILParser.jay | 56 |
2 files changed, 34 insertions, 28 deletions
diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog index b2c663af82c..f09ac97c18b 100644 --- a/mcs/ilasm/parser/ChangeLog +++ b/mcs/ilasm/parser/ChangeLog @@ -1,3 +1,9 @@ +2006-01-10 Ankit Jain <jankit@novell.com> + + * ILParser.jay (type | BANG ..): Move !* and !!* rules to .. + (generic_class_ref): ..this, to allow using VAR/MVARs as class refs. + Eg. "extends !0" + 2006-01-09 Ankit Jain <jankit@novell.com> * ILParser.jay (type_spec : class_ref): Remove. diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index f1b37b9cbed..854ca5c755b 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -681,6 +681,34 @@ generic_class_ref : class_ref else
$$ = $2;
}
+ | BANG int32
+ {
+ GenParam gpar = new GenParam ((int) $2, "", GenParamType.Var);
+ $$ = new GenericParamRef (gpar, $2.ToString ());
+ }
+ | BANG BANG int32
+ {
+ GenParam gpar = new GenParam ((int) $3, "", GenParamType.MVar);
+ $$ = new GenericParamRef (gpar, $3.ToString ());
+ }
+ | BANG id
+ {
+ int num = -1;
+ string name = (string) $2;
+ if (codegen.CurrentTypeDef != null)
+ num = codegen.CurrentTypeDef.GetGenericParamNum (name);
+ GenParam gpar = new GenParam (num, name, GenParamType.Var);
+ $$ = new GenericParamRef (gpar, name);
+ }
+ | BANG BANG id
+ {
+ int num = -1;
+ string name = (string) $3;
+ if (codegen.CurrentMethodDef != null)
+ num = codegen.CurrentMethodDef.GetGenericParamNum (name);
+ GenParam gpar = new GenParam (num, name, GenParamType.MVar);
+ $$ = new GenericParamRef (gpar, name);
+ }
;
formal_typars : formal_typar_attr constraints_clause formal_typar
@@ -1005,34 +1033,6 @@ type : generic_class_ref {
$$ = new PrimitiveTypeRef (PrimitiveType.NativeUInt, "System.UIntPtr");
}
- | BANG int32
- {
- GenParam gpar = new GenParam ((int) $2, "", GenParamType.Var);
- $$ = new GenericParamRef (gpar, $2.ToString ());
- }
- | BANG BANG int32
- {
- GenParam gpar = new GenParam ((int) $3, "", GenParamType.MVar);
- $$ = new GenericParamRef (gpar, $3.ToString ());
- }
- | BANG id
- {
- int num = -1;
- string name = (string) $2;
- if (codegen.CurrentTypeDef != null)
- num = codegen.CurrentTypeDef.GetGenericParamNum (name);
- GenParam gpar = new GenParam (num, name, GenParamType.Var);
- $$ = new GenericParamRef (gpar, name);
- }
- | BANG BANG id
- {
- int num = -1;
- string name = (string) $3;
- if (codegen.CurrentMethodDef != null)
- num = codegen.CurrentMethodDef.GetGenericParamNum (name);
- GenParam gpar = new GenParam (num, name, GenParamType.MVar);
- $$ = new GenericParamRef (gpar, name);
- }
;
bounds : bound
|