public CodeGen CodeGen {\r
get { return codegen; }\r
}\r
- \r
+\r
+ private ITypeRef GetTypeRef (ITypeRef b)\r
+ {\r
+ ExternTypeRefInst etri = b as ExternTypeRefInst;\r
+ ExternTypeRef etr;\r
+\r
+ if (etri != null)\r
+ return etri.Clone ();\r
+\r
+ etr = b as ExternTypeRef;\r
+ if (etr != null)\r
+ return etr.Clone ();\r
+\r
+ return b;\r
+ }\r
%}\r
\r
%token EOF\r
}\r
| type OPEN_BRACKET CLOSE_BRACKET\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((TypeRef) $1);\r
base_type.MakeArray ();\r
$$ = base_type;\r
}\r
| type OPEN_BRACKET bounds CLOSE_BRACKET\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
ArrayList bound_list = (ArrayList) $3;\r
base_type.MakeBoundArray (bound_list);\r
$$ = base_type;\r
}\r
| type AMPERSAND\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
base_type.MakeManagedPointer ();\r
$$ = base_type;\r
}\r
| type STAR\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
base_type.MakeUnmanagedPointer ();\r
$$ = base_type;\r
}\r
| type K_PINNED\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
base_type.MakePinned ();\r
$$ = base_type;\r
}\r
| type K_MODREQ OPEN_PARENS class_ref CLOSE_PARENS\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
IClassRef class_ref = (IClassRef) $4;\r
base_type.MakeCustomModified (codegen,\r
CustomModifier.modopt, class_ref);\r
}\r
| type K_MODOPT OPEN_PARENS class_ref CLOSE_PARENS\r
{\r
- ITypeRef base_type = (ITypeRef) $1;\r
- if (base_type is ExternTypeRef)\r
- base_type = ((ExternTypeRef) base_type).Clone ();\r
+ ITypeRef base_type = GetTypeRef ((ITypeRef) $1);\r
IClassRef class_ref = (IClassRef) $4;\r
base_type.MakeCustomModified (codegen,\r
CustomModifier.modopt, class_ref);\r