~ubuntu-branches/ubuntu/maverick/vala/maverick

« back to all changes in this revision

Viewing changes to codegen/valaccodememberaccessmodule.vala

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-04-02 10:10:55 UTC
  • mfrom: (1.4.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402101055-qbx3okzv0tnp3wpp
Tags: 0.8.0-0ubuntu1
* New upstream release:
  - Infer type arguments when calling generic methods.
  - Support `in' operator for arrays.
  - Add experimental support for regular expression literals.
  - Add experimental support for chained relational expressions.
  - Add va_list support.
  - Add clutter-gtk-0.10 bindings (Gordon Allott).
  - Add gdl-1.0 bindings (Nicolas Joseph).
  - Add gstreamer-app-0.10 bindings (Sebastian Dröge).
  - Add gstreamer-cdda-0.10 bindings (Sebastian Dröge).
  - Add gudev-1.0 bindings (Jim Nelson).
  - Add libgda-report-4.0 bindings (Shawn Ferris).
  - Add libgvc (graphviz) bindings (Martin Olsson).
  - Add purple bindings (Adrien Bustany).
  - Many bug fixes and binding updates.
* debian/patches/99_ltmain_as-needed.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* valaccodememberaccessmodule.vala
2
2
 *
3
 
 * Copyright (C) 2006-2009  Jürg Billeter
 
3
 * Copyright (C) 2006-2010  Jürg Billeter
4
4
 * Copyright (C) 2006-2008  Raffaele Sandrini
5
5
 *
6
6
 * This library is free software; you can redistribute it and/or
126
126
                                if (instance_target_type.data_type.is_reference_type () || (expr.inner != null && expr.inner.value_type is PointerType)) {
127
127
                                        expr.ccodenode = new CCodeMemberAccess.pointer (inst, f.get_cname ());
128
128
                                } else {
129
 
                                        expr.ccodenode = new CCodeMemberAccess (inst, f.get_cname ());
 
129
                                        if (inst is CCodeCommaExpression) {
 
130
                                                var ccomma = inst as CCodeCommaExpression;
 
131
                                                var inner = ccomma.get_inner ();
 
132
                                                var last = inner.get (inner.size - 1);
 
133
                                                ccomma.set_expression (inner.size - 1, new CCodeMemberAccess (last, f.get_cname ()));
 
134
                                                expr.ccodenode = ccomma;
 
135
                                        } else {
 
136
                                                expr.ccodenode = new CCodeMemberAccess (inst, f.get_cname ());
 
137
                                        }
130
138
                                }
131
139
                        } else if (f.binding == MemberBinding.CLASS) {
132
140
                                var cl = (Class) f.parent_symbol;
153
161
 
154
162
                                if (f.access == SymbolAccessibility.PRIVATE) {
155
163
                                        var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (cl.get_upper_case_cname ())));
156
 
                                        var ccall2 = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_FROM_CLASS"));
157
 
                                        ccall2.add_argument (cast);
158
 
                                        ccall.add_argument (ccall2);
 
164
                                        ccall.add_argument (klass);
159
165
                                        expr.ccodenode = new CCodeMemberAccess.pointer (ccall, f.get_cname ());
160
166
                                } else {
161
167
                                        expr.ccodenode = new CCodeMemberAccess.pointer (cast, f.get_cname ());
226
232
                        if (prop.binding == MemberBinding.INSTANCE &&
227
233
                            prop.get_accessor.automatic_body &&
228
234
                            current_type_symbol == prop.parent_symbol &&
 
235
                            current_type_symbol is Class &&
229
236
                            prop.base_property == null &&
230
237
                            prop.base_interface_property == null &&
231
238
                            !(prop.property_type is ArrayType || prop.property_type is DelegateType)) {
347
354
                        var local = (LocalVariable) expr.symbol_reference;
348
355
                        if (local.is_result) {
349
356
                                // used in postconditions
350
 
                                expr.ccodenode = new CCodeIdentifier ("result");
 
357
                                // structs are returned as out parameter
 
358
                                if (local.variable_type != null && local.variable_type.is_real_non_null_struct_type ()) {
 
359
                                        expr.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result"));
 
360
                                } else {
 
361
                                        expr.ccodenode = new CCodeIdentifier ("result");
 
362
                                }
351
363
                        } else if (local.captured) {
352
364
                                // captured variables are stored on the heap
353
365
                                var block = (Block) local.parent_symbol;
372
384
                        } else {
373
385
                                if (p.captured) {
374
386
                                        // captured variables are stored on the heap
375
 
                                        var block = ((Method) p.parent_symbol).body;
 
387
                                        var block = p.parent_symbol as Block;
 
388
                                        if (block == null) {
 
389
                                                block = ((Method) p.parent_symbol).body;
 
390
                                        }
376
391
                                        expr.ccodenode = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), get_variable_cname (p.name));
377
392
                                } else if (current_method != null && current_method.coroutine) {
378
393
                                        // use closure