basic-types/bug787152.vala \
basic-types/bug788775.vala \
constants/array-type-invalid.test \
+ constants/delegate-type.vala \
constants/glog.vala \
constants/member-access.vala \
constants/member-access-enum.vala \
--- /dev/null
+/* constants_delegate_type.c generated by valac, the Vala compiler
+ * generated from constants_delegate_type.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define FOO _func_foo_func
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef const gchar* (*FooFunc) (void);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN const gchar* func (void);
+static const gchar* _func_foo_func (void);
+static void _vala_main (void);
+
+static const gchar*
+_func_foo_func (void)
+{
+ const gchar* result;
+ result = func ();
+ return result;
+}
+
+const gchar*
+func (void)
+{
+ const gchar* result;
+ result = "foo";
+ return result;
+}
+
+static void
+_vala_main (void)
+{
+ static const FooFunc foo = _func_foo_func;
+ const gchar* _tmp0_;
+ const gchar* _tmp1_;
+ _tmp0_ = foo ();
+ _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "foo () == \"foo\"");
+ _tmp1_ = FOO ();
+ _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "FOO () == \"foo\"");
+}
+
+int
+main (int argc,
+ char ** argv)
+{
+ _vala_main ();
+ return 0;
+}
+
--- /dev/null
+[CCode (has_target = false)]
+delegate unowned string FooFunc ();
+
+const FooFunc FOO = func;
+
+unowned string func () {
+ return "foo";
+}
+
+void main () {
+ const FooFunc foo = func;
+ assert (foo () == "foo");
+ assert (FOO () == "foo");
+}
} else if (type is ArrayType) {
unowned ArrayType array_type = (ArrayType) type;
return check_const_type (array_type.element_type, context);
+ } else if (type is DelegateType) {
+ unowned DelegateType delegate_type = (DelegateType) type;
+ return !delegate_type.type_symbol.get_attribute_bool ("CCode", "has_target", true);
} else if (type.type_symbol != null) {
return type.type_symbol.is_subtype_of (context.analyzer.string_type.type_symbol);
} else {