generator: Mark instance_offset field as static
Those are per class and should not be overriden ever
This commit is contained in:
parent
9539c0b17b
commit
d1457f6e03
2 changed files with 5 additions and 3 deletions
|
@ -190,10 +190,12 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
protected virtual void WriteInstanceOffsetMethod(StreamWriter sw,
|
protected virtual void WriteInstanceOffsetMethod(StreamWriter sw,
|
||||||
string cs_parent_struct) {
|
string cs_parent_struct) {
|
||||||
|
string cs_parent = SymbolTable.Table.GetCSType(Elem.GetAttribute("parent"));
|
||||||
|
|
||||||
if (cs_parent_struct == "")
|
if (cs_parent_struct == "")
|
||||||
sw.WriteLine ("\t\tpublic virtual uint instance_offset { get { return 0; }}");
|
sw.WriteLine ("\t\tpublic static uint instance_offset { get { return 0; }}");
|
||||||
else
|
else
|
||||||
sw.WriteLine ("\t\tpublic override uint instance_offset {{ get {{ return ((uint) Marshal.SizeOf(typeof ({0})) + base.instance_offset); }} }}", cs_parent_struct);
|
sw.WriteLine ("\t\tpublic static uint instance_offset {{ get {{ return ((uint) Marshal.SizeOf(typeof ({0})) + {1}.instance_offset); }} }}", cs_parent_struct, cs_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GenerateStructureABI (GenerationInfo gen_info)
|
protected void GenerateStructureABI (GenerationInfo gen_info)
|
||||||
|
|
|
@ -823,7 +823,7 @@ namespace GLib {
|
||||||
public IntPtr g_class;
|
public IntPtr g_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual uint instance_offset { get { return 0; }}
|
public static uint instance_offset { get { return 0; }}
|
||||||
public uint GetFieldOffset(string field) { throw new NotImplementedException(); return 0; }
|
public uint GetFieldOffset(string field) { throw new NotImplementedException(); return 0; }
|
||||||
public struct GObject {
|
public struct GObject {
|
||||||
public GTypeInstance type_instance;
|
public GTypeInstance type_instance;
|
||||||
|
|
Loading…
Reference in a new issue