Commit 84c5de5a authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Add base_struct property to Struct class, patch by Andreas Brauchli

2009-02-12  Jürg Billeter  <j@bitron.ch>

	* vala/valastruct.vala:
	* vala/valasymbolresolver.vala:

	Add base_struct property to Struct class, patch by Andreas Brauchli

svn path=/trunk/; revision=2436
parent 610168a4
2009-02-12 Jürg Billeter <j@bitron.ch>
* vala/valastruct.vala:
* vala/valasymbolresolver.vala:
Add base_struct property to Struct class, patch by Andreas Brauchli
2009-02-12 Jürg Billeter <j@bitron.ch> 2009-02-12 Jürg Billeter <j@bitron.ch>
* vala/valamember.vala: * vala/valamember.vala:
......
...@@ -51,7 +51,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -51,7 +51,7 @@ public class Vala.Struct : TypeSymbol {
private string destroy_function; private string destroy_function;
/** /**
* Specifies the base struct. * Specifies the base type.
*/ */
public DataType? base_type { public DataType? base_type {
get { get {
...@@ -63,6 +63,18 @@ public class Vala.Struct : TypeSymbol { ...@@ -63,6 +63,18 @@ public class Vala.Struct : TypeSymbol {
} }
} }
/**
* Specifies the base Struct.
*/
public Struct? base_struct {
get {
if (_base_type != null) {
return _base_type.data_type as Struct;
}
return null;
}
}
/** /**
* Specifies the default construction method. * Specifies the default construction method.
*/ */
...@@ -293,7 +305,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -293,7 +305,7 @@ public class Vala.Struct : TypeSymbol {
*/ */
public bool is_boolean_type () { public bool is_boolean_type () {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null && st.is_boolean_type ()) { if (st != null && st.is_boolean_type ()) {
return true; return true;
} }
...@@ -308,7 +320,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -308,7 +320,7 @@ public class Vala.Struct : TypeSymbol {
*/ */
public bool is_integer_type () { public bool is_integer_type () {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null && st.is_integer_type ()) { if (st != null && st.is_integer_type ()) {
return true; return true;
} }
...@@ -323,7 +335,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -323,7 +335,7 @@ public class Vala.Struct : TypeSymbol {
*/ */
public bool is_floating_type () { public bool is_floating_type () {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null && st.is_floating_type ()) { if (st != null && st.is_floating_type ()) {
return true; return true;
} }
...@@ -421,7 +433,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -421,7 +433,7 @@ public class Vala.Struct : TypeSymbol {
if (type_id == null) { if (type_id == null) {
if (!has_type_id) { if (!has_type_id) {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null) { if (st != null) {
return st.get_type_id (); return st.get_type_id ();
} }
...@@ -445,7 +457,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -445,7 +457,7 @@ public class Vala.Struct : TypeSymbol {
public override string? get_marshaller_type_name () { public override string? get_marshaller_type_name () {
if (marshaller_type_name == null) { if (marshaller_type_name == null) {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null) { if (st != null) {
return st.get_marshaller_type_name (); return st.get_marshaller_type_name ();
} }
...@@ -468,7 +480,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -468,7 +480,7 @@ public class Vala.Struct : TypeSymbol {
public override string? get_get_value_function () { public override string? get_get_value_function () {
if (get_value_function == null) { if (get_value_function == null) {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null) { if (st != null) {
return st.get_get_value_function (); return st.get_get_value_function ();
} }
...@@ -489,7 +501,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -489,7 +501,7 @@ public class Vala.Struct : TypeSymbol {
public override string? get_set_value_function () { public override string? get_set_value_function () {
if (set_value_function == null) { if (set_value_function == null) {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null) { if (st != null) {
return st.get_set_value_function (); return st.get_set_value_function ();
} }
...@@ -522,7 +534,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -522,7 +534,7 @@ public class Vala.Struct : TypeSymbol {
// inherit default value from base type // inherit default value from base type
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null) { if (st != null) {
return st.get_default_value (); return st.get_default_value ();
} }
...@@ -553,7 +565,7 @@ public class Vala.Struct : TypeSymbol { ...@@ -553,7 +565,7 @@ public class Vala.Struct : TypeSymbol {
*/ */
public bool is_simple_type () { public bool is_simple_type () {
if (base_type != null) { if (base_type != null) {
var st = base_type.data_type as Struct; var st = base_struct;
if (st != null && st.is_simple_type ()) { if (st != null && st.is_simple_type ()) {
return true; return true;
} }
......
...@@ -84,7 +84,7 @@ public class Vala.SymbolResolver : CodeVisitor { ...@@ -84,7 +84,7 @@ public class Vala.SymbolResolver : CodeVisitor {
st.accept_children (this); st.accept_children (this);
if (st.base_type != null) { if (st.base_type != null) {
var base_type = st.base_type.data_type as Struct; var base_type = st.base_struct;
if (base_type != null) { if (base_type != null) {
if (base_type.is_subtype_of (st)) { if (base_type.is_subtype_of (st)) {
st.error = true; st.error = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment