vala r1432 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1432 - in trunk: . vala
- Date: Sun, 25 May 2008 14:59:15 +0000 (UTC)
Author: juergbi
Date: Sun May 25 14:59:14 2008
New Revision: 1432
URL: http://svn.gnome.org/viewvc/vala?rev=1432&view=rev
Log:
2008-05-25 Juerg Billeter <j bitron ch>
* vala/valaarraytype.vala:
* vala/valadatatype.vala:
* vala/valadelegatetype.vala:
* vala/valafieldprototype.vala:
* vala/valainterfacewriter.vala:
* vala/valamethodtype.vala:
* vala/valapointertype.vala:
* vala/valaunresolvedtype.vala:
* vala/valavoidtype.vala:
Write qualified types in the interface writer
Modified:
trunk/ChangeLog
trunk/vala/valaarraytype.vala
trunk/vala/valadatatype.vala
trunk/vala/valadelegatetype.vala
trunk/vala/valafieldprototype.vala
trunk/vala/valainterfacewriter.vala
trunk/vala/valamethodtype.vala
trunk/vala/valapointertype.vala
trunk/vala/valaunresolvedtype.vala
trunk/vala/valavoidtype.vala
Modified: trunk/vala/valaarraytype.vala
==============================================================================
--- trunk/vala/valaarraytype.vala (original)
+++ trunk/vala/valaarraytype.vala Sun May 25 14:59:14 2008
@@ -140,8 +140,8 @@
return true;
}
- public override string to_string () {
- return element_type.to_string () + "[]";
+ public override string to_qualified_string (Scope? scope) {
+ return element_type.to_qualified_string (scope) + "[]";
}
public override bool compatible (DataType target_type) {
Modified: trunk/vala/valadatatype.vala
==============================================================================
--- trunk/vala/valadatatype.vala (original)
+++ trunk/vala/valadatatype.vala Sun May 25 14:59:14 2008
@@ -145,10 +145,30 @@
}
public override string to_string () {
+ return to_qualified_string (null);
+ }
+
+ public virtual string to_qualified_string (Scope? scope = null) {
string s;
if (data_type != null) {
- s = data_type.get_full_name ();
+ Symbol global_symbol = data_type;
+ while (global_symbol.parent_symbol.name != null) {
+ global_symbol = global_symbol.parent_symbol;
+ }
+
+ Symbol sym = null;
+ Scope parent_scope = scope;
+ while (sym == null && parent_scope != null) {
+ sym = parent_scope.lookup (global_symbol.name);
+ parent_scope = parent_scope.parent_scope;
+ }
+
+ if (sym != null && global_symbol != sym) {
+ s = "global::" + data_type.get_full_name ();;
+ } else {
+ s = data_type.get_full_name ();
+ }
} else if (type_parameter != null) {
s = type_parameter.name;
} else {
@@ -168,7 +188,7 @@
if (!type_arg.value_owned) {
s += "weak ";
}
- s += type_arg.to_string ();
+ s += type_arg.to_qualified_string (scope);
}
s += ">";
}
Modified: trunk/vala/valadelegatetype.vala
==============================================================================
--- trunk/vala/valadelegatetype.vala (original)
+++ trunk/vala/valadelegatetype.vala Sun May 25 14:59:14 2008
@@ -45,7 +45,7 @@
return delegate_symbol.get_parameters ();
}
- public override string to_string () {
+ public override string to_qualified_string (Scope? scope) {
string s = delegate_symbol.get_full_name ();
if (nullable) {
s += "?";
Modified: trunk/vala/valafieldprototype.vala
==============================================================================
--- trunk/vala/valafieldprototype.vala (original)
+++ trunk/vala/valafieldprototype.vala Sun May 25 14:59:14 2008
@@ -37,7 +37,7 @@
return result;
}
- public override string to_string () {
+ public override string to_qualified_string (Scope? scope) {
return field_symbol.get_full_name ();
}
}
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Sun May 25 14:59:14 2008
@@ -38,6 +38,8 @@
string current_cheader_filename;
+ Scope current_scope;
+
/**
* Writes the public interface of the specified code context into the
* specified file.
@@ -54,8 +56,12 @@
write_newline ();
write_newline ();
+ current_scope = context.root.scope;
+
context.accept (this);
-
+
+ current_scope = null;
+
stream = null;
}
@@ -78,7 +84,9 @@
write_identifier (ns.name);
write_begin_block ();
+ current_scope = ns.scope;
ns.accept_children (this);
+ current_scope = current_scope.parent_scope;
write_end_block ();
write_newline ();
@@ -177,7 +185,9 @@
}
write_begin_block ();
+ current_scope = cl.scope;
cl.accept_children (this);
+ current_scope = current_scope.parent_scope;
write_end_block ();
write_newline ();
@@ -241,7 +251,9 @@
write_begin_block ();
+ current_scope = st.scope;
st.accept_children (this);
+ current_scope = current_scope.parent_scope;
write_end_block ();
write_newline ();
@@ -311,7 +323,9 @@
}
write_begin_block ();
+ current_scope = iface.scope;
iface.accept_children (this);
+ current_scope = current_scope.parent_scope;
write_end_block ();
write_newline ();
@@ -378,9 +392,11 @@
write_newline ();
}
+ current_scope = en.scope;
foreach (Method m in en.get_methods ()) {
m.accept (this);
}
+ current_scope = current_scope.parent_scope;
write_end_block ();
write_newline ();
@@ -851,7 +867,7 @@
}
private void write_type (DataType type) {
- write_string (type.to_string ());
+ write_string (type.to_qualified_string (current_scope));
}
private void write_string (string s) {
Modified: trunk/vala/valamethodtype.vala
==============================================================================
--- trunk/vala/valamethodtype.vala (original)
+++ trunk/vala/valamethodtype.vala Sun May 25 14:59:14 2008
@@ -59,7 +59,7 @@
return dt.delegate_symbol.matches_method (method_symbol);
}
- public override string to_string () {
+ public override string to_qualified_string (Scope? scope) {
return method_symbol.get_full_name ();
}
Modified: trunk/vala/valapointertype.vala
==============================================================================
--- trunk/vala/valapointertype.vala (original)
+++ trunk/vala/valapointertype.vala Sun May 25 14:59:14 2008
@@ -46,8 +46,8 @@
this.source_reference = source_reference;
}
- public override string to_string () {
- return base_type.to_string () + "*";
+ public override string to_qualified_string (Scope? scope) {
+ return base_type.to_qualified_string (scope) + "*";
}
public override string? get_cname () {
Modified: trunk/vala/valaunresolvedtype.vala
==============================================================================
--- trunk/vala/valaunresolvedtype.vala (original)
+++ trunk/vala/valaunresolvedtype.vala Sun May 25 14:59:14 2008
@@ -100,7 +100,7 @@
return result;
}
- public override string to_string () {
+ public override string to_qualified_string (Scope? scope) {
return unresolved_symbol.to_string ();
}
}
Modified: trunk/vala/valavoidtype.vala
==============================================================================
--- trunk/vala/valavoidtype.vala (original)
+++ trunk/vala/valavoidtype.vala Sun May 25 14:59:14 2008
@@ -33,7 +33,7 @@
return (type2 is VoidType);
}
- public override string to_string () {
+ public override string to_qualified_string (Scope? scope) {
return "void";
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]