2002-10-19 Miguel de Icaza <miguel@ximian.com>
+ * ecore.cs (FieldExpr.AddressOf): We had a special code path for
+ init-only variables, but this path did not take into account that
+ there might be also instance readonly variables. Correct this
+ problem.
+
+ This fixes bug 32253
+
* delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
delegates as well.
// Handle initonly fields specially: make a copy and then
// get the address of the copy.
//
- if (FieldInfo.IsInitOnly){
- if (ec.IsConstructor) {
- ig.Emit (OpCodes.Ldsflda, FieldInfo);
- } else {
- LocalBuilder local;
+ if (FieldInfo.IsInitOnly && !ec.IsConstructor){
+ LocalBuilder local;
- Emit (ec);
- local = ig.DeclareLocal (type);
- ig.Emit (OpCodes.Stloc, local);
- ig.Emit (OpCodes.Ldloca, local);
- }
+ Emit (ec);
+ local = ig.DeclareLocal (type);
+ ig.Emit (OpCodes.Stloc, local);
+ ig.Emit (OpCodes.Ldloca, local);
return;
}