diff options
author | Juerg Billeter <j@bitron.ch> | 2008-04-20 18:50:28 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-04-20 18:50:28 +0000 |
commit | 7ef89124bf751d257789f664561cf91e6836e9bc (patch) | |
tree | 80c1ad54a6974c49179ba30b4d9ccb42c6586fdc /vala/valadynamicmethod.vala | |
parent | bb54ceb5c77ea433e0799aec59c7bb4255b456de (diff) | |
download | vala-7ef89124bf751d257789f664561cf91e6836e9bc.tar.gz |
Improve support for dynamic types, add `dynamic' type modifier, port
2008-04-20 Juerg Billeter <j@bitron.ch>
* vala/Makefile.am, vala/valaclasstype.vala,
vala/valacodecontext.vala, vala/valacodegenerator.vala,
vala/valadatatype.vala, vala/valadynamicmethod.vala,
vala/valadynamicsignal.vala, vala/valainterface.vala,
vala/valainterfacetype.vala, vala/valamethod.vala,
vala/valamethodtype.vala, vala/valaparser.vala,
vala/valascanner.vala, vala/valasemanticanalyzer.vala,
vala/valasymbolresolver.vala, vala/valatokentype.vala,
vala/valaunresolvedtype.vala, vala/valavaluetype.vala,
gobject/Makefile.am, gobject/valaccodeassignmentbinding.vala,
gobject/valaccodebinding.vala,
gobject/valaccodedynamicmethodbinding.vala,
gobject/valaccodedynamicsignalbinding.vala,
gobject/valaccodegenerator.vala,
gobject/valaccodegeneratorsourcefile.vala,
gobject/valaccodeinterfacebinding.vala,
gobject/valaccodeinvocationexpressionbinding.vala,
gobject/valaccodemethodbinding.vala, compiler/valacompiler.vala,
vapi/dbus-glib-1.vapi:
Improve support for dynamic types, add `dynamic' type modifier,
port dynamic D-Bus client support
svn path=/trunk/; revision=1288
Diffstat (limited to 'vala/valadynamicmethod.vala')
-rw-r--r-- | vala/valadynamicmethod.vala | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/vala/valadynamicmethod.vala b/vala/valadynamicmethod.vala new file mode 100644 index 000000000..d63146c34 --- /dev/null +++ b/vala/valadynamicmethod.vala @@ -0,0 +1,59 @@ +/* valadynamicmethod.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + */ + +using GLib; +using Gee; + +/** + * Represents a late bound method. + */ +public class Vala.DynamicMethod : Method { + public DataType dynamic_type { get; set; } + + public InvocationExpression invocation { get; set; } + + private string cname; + + public DynamicMethod (DataType dynamic_type, string name, DataType return_type, SourceReference? source_reference = null) { + this.dynamic_type = dynamic_type; + this.name = name; + this.return_type = return_type; + this.source_reference = source_reference; + } + + public override Collection<string> get_cheader_filenames () { + return new ReadOnlyCollection<string> (); + } + + public override string get_default_cname () { + // return cname of wrapper method + if (cname == null) { + // FIXME support multiple dynamic methods with the same name + cname = "_dynamic_%s".printf (name); + } + return cname; + } + + public override CodeBinding? create_code_binding (CodeGenerator codegen) { + return codegen.create_dynamic_method_binding (this); + } +} |