vala r1290 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1290 - in trunk: . gobject vala
- Date: Mon, 21 Apr 2008 07:17:21 +0100 (BST)
Author: juergbi
Date: Mon Apr 21 06:17:21 2008
New Revision: 1290
URL: http://svn.gnome.org/viewvc/vala?rev=1290&view=rev
Log:
2008-04-21 Juerg Billeter <j bitron ch>
* vala/valasemanticanalyzer.vala:
* gobject/valaccodeassignmentbinding.vala:
* gobject/valaccodeelementaccessbinding.vala:
Fix element access for libgee collections
Modified:
trunk/ChangeLog
trunk/gobject/valaccodeassignmentbinding.vala
trunk/gobject/valaccodeelementaccessbinding.vala
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/gobject/valaccodeassignmentbinding.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentbinding.vala (original)
+++ trunk/gobject/valaccodeassignmentbinding.vala Mon Apr 21 06:17:21 2008
@@ -336,7 +336,14 @@
if (container_type != null && codegen.list_type != null && codegen.map_type != null &&
(container_type.is_subtype_of (codegen.list_type) || container_type.is_subtype_of (codegen.map_type))) {
- var set_method = (Method) container_type.scope.lookup ("set");
+ // lookup symbol in interface instead of class as implemented interface methods are not in VAPI files
+ Typesymbol collection_iface = null;
+ if (container_type.is_subtype_of (codegen.list_type)) {
+ collection_iface = codegen.list_type;
+ } else if (container_type.is_subtype_of (codegen.map_type)) {
+ collection_iface = codegen.map_type;
+ }
+ var set_method = (Method) collection_iface.scope.lookup ("set");
Collection<FormalParameter> set_params = set_method.get_parameters ();
Iterator<FormalParameter> set_params_it = set_params.iterator ();
set_params_it.next ();
@@ -348,7 +355,7 @@
}
var set_ccall = new CCodeFunctionCall (new CCodeIdentifier (set_method.get_cname ()));
- set_ccall.add_argument (new CCodeCastExpression (ccontainer, container_type.get_cname () + "*"));
+ set_ccall.add_argument (new CCodeCastExpression (ccontainer, collection_iface.get_cname () + "*"));
set_ccall.add_argument (cindex);
set_ccall.add_argument (codegen.convert_to_generic_pointer (rhs, expr.static_type));
Modified: trunk/gobject/valaccodeelementaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodeelementaccessbinding.vala (original)
+++ trunk/gobject/valaccodeelementaccessbinding.vala Mon Apr 21 06:17:21 2008
@@ -65,7 +65,13 @@
codenode = ccall;
} else if (container_type != null && codegen.list_type != null && codegen.map_type != null &&
(container_type.is_subtype_of (codegen.list_type) || container_type.is_subtype_of (codegen.map_type))) {
- var get_method = (Method) container_type.scope.lookup ("get");
+ Typesymbol collection_iface = null;
+ if (container_type.is_subtype_of (codegen.list_type)) {
+ collection_iface = codegen.list_type;
+ } else if (container_type.is_subtype_of (codegen.map_type)) {
+ collection_iface = codegen.map_type;
+ }
+ var get_method = (Method) collection_iface.scope.lookup ("get");
Collection<FormalParameter> get_params = get_method.get_parameters ();
Iterator<FormalParameter> get_params_it = get_params.iterator ();
get_params_it.next ();
@@ -77,7 +83,7 @@
}
var get_ccall = new CCodeFunctionCall (new CCodeIdentifier (get_method.get_cname ()));
- get_ccall.add_argument (new CCodeCastExpression (ccontainer, container_type.get_cname () + "*"));
+ get_ccall.add_argument (new CCodeCastExpression (ccontainer, collection_iface.get_cname () + "*"));
get_ccall.add_argument (cindex);
codenode = codegen.convert_from_generic_pointer (get_ccall, expr.static_type);
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Mon Apr 21 06:17:21 2008
@@ -2131,11 +2131,12 @@
var index = indices_it.get ();
index_int_type_check = false;
- var get_sym = container_type.scope.lookup ("get");
- if (!(get_sym is Method)) {
- expr.error = true;
- Report.error (expr.source_reference, "invalid get method in specified collection type");
- return;
+ // lookup symbol in interface instead of class as implemented interface methods are not in VAPI files
+ Symbol get_sym = null;
+ if (container_type.is_subtype_of (list_type)) {
+ get_sym = list_type.scope.lookup ("get");
+ } else if (container_type.is_subtype_of (map_type)) {
+ get_sym = map_type.scope.lookup ("get");
}
var get_method = (Method) get_sym;
Collection<FormalParameter> get_params = get_method.get_parameters ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]