[vala] Use fully-qualified name in the code writer
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Use fully-qualified name in the code writer
- Date: Tue, 14 Apr 2009 11:44:08 -0400 (EDT)
commit 97d1920e65b9744dcaf0fbc3360c402ebc5ec84b
Author: Jürg Billeter <j bitron ch>
Date: Tue Apr 14 17:38:50 2009 +0200
Use fully-qualified name in the code writer
Fixes bug 516859.
---
vala/valamemberaccess.vala | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 4f99208..0469026 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -133,10 +133,34 @@ public class Vala.MemberAccess : Expression {
}
public override string to_string () {
- if (inner == null) {
- return member_name;
+ bool instance = true;
+ if (symbol_reference is Field) {
+ var f = (Field) symbol_reference;
+ instance = (f.binding == MemberBinding.INSTANCE);
+ } else if (symbol_reference is Method) {
+ var m = (Method) symbol_reference;
+ if (!(m is CreationMethod)) {
+ instance = (m.binding == MemberBinding.INSTANCE);
+ }
+ } else if (symbol_reference is Property) {
+ var prop = (Property) symbol_reference;
+ instance = (prop.binding == MemberBinding.INSTANCE);
+ } else if (symbol_reference is EnumValue) {
+ instance = false;
+ } else if (symbol_reference is ErrorCode) {
+ instance = false;
+ }
+
+ if (instance) {
+ if (inner == null) {
+ return member_name;
+ } else {
+ return "%s.%s".printf (inner.to_string (), member_name);
+ }
} else {
- return "%s.%s".printf (inner.to_string (), member_name);
+ // ensure to always use fully-qualified name
+ // to refer to static members
+ return symbol_reference.get_full_name ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]