+2006-07-16 Jürg Billeter <j@bitron.ch>
+
+ * configure.ac: Post-release version bump.
+ * vala/parser.y: remove g_object_unref call to fix crash in parsing
+ array declarations
+ * vala/valasemanticanalyzer.vala, vala/valacodegenerator.vala: support
+ creating structs
+ * vapi/glib-2.0.vala: GString enhancements
+ * vapi/Makefile.am: dist gtk+-2.0.vala and pango.vala
+
2006-07-15 Jürg Billeter <j@bitron.ch>
* NEWS: update for 0.0.1 release
-AC_INIT([vala], [0.0.1], [j@bitron.ch], [vala])
+AC_INIT([vala], [0.0.2], [j@bitron.ch], [vala])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([dist-bzip2])
{
$$ = $1;
vala_type_reference_set_array ($$, TRUE);
- g_object_unref ($1);
}
;
ccheck.add_argument (new CCodeConstant (name = "NULL"));
} else if (ret_type.name == "bool") {
ccheck.add_argument (new CCodeConstant (name = "FALSE"));
- } else if (ret_type.name == "int" || ret_type is Enum || ret_type is Flags) {
+ } else if (ret_type.name == "int" || ret_type.name == "long" || ret_type.name == "double" || ret_type.name == "float" || ret_type is Enum || ret_type is Flags) {
ccheck.add_argument (new CCodeConstant (name = "0"));
} else {
Report.error (method_node.source_reference, "not supported return type for runtime type checks");
}
public override void visit_object_creation_expression (ObjectCreationExpression! expr) {
- var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_new"));
-
- ccall.add_argument (new CCodeConstant (name = expr.type_reference.get_upper_case_cname ("TYPE_")));
+ if (expr.type_reference.type is Class) {
+ var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_object_new"));
+
+ ccall.add_argument (new CCodeConstant (name = expr.type_reference.get_upper_case_cname ("TYPE_")));
- foreach (NamedArgument arg in expr.named_argument_list) {
- ccall.add_argument (new CCodeConstant (name = "\"%s\"".printf (arg.name)));
- ccall.add_argument ((CCodeExpression) arg.argument.ccodenode);
+ foreach (NamedArgument arg in expr.named_argument_list) {
+ ccall.add_argument (new CCodeConstant (name = "\"%s\"".printf (arg.name)));
+ ccall.add_argument ((CCodeExpression) arg.argument.ccodenode);
+ }
+ ccall.add_argument (new CCodeConstant (name = "NULL"));
+
+ expr.ccodenode = ccall;
+ } else {
+ var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = "g_new0"));
+
+ ccall.add_argument (new CCodeConstant (name = expr.type_reference.type.get_cname ()));
+
+ ccall.add_argument (new CCodeConstant (name = "1"));
+
+ expr.ccodenode = ccall;
}
- ccall.add_argument (new CCodeConstant (name = "NULL"));
-
- expr.ccodenode = ccall;
-
+
visit_expression (expr);
}
/* if type resolving didn't succeed, skip this check */
return;
}
+
+ if (!expr.type_reference.type.is_reference_type ()) {
+ expr.error = true;
+ Report.error (expr.source_reference, "Can't create instance of value type `%s'".printf (expr.type_reference.to_string ()));
+ return;
+ }
current_source_file.add_symbol_dependency (expr.type_reference.type.symbol, SourceFileDependencyType.SOURCE);
expr.static_type = expr.type_reference.copy ();
expr.static_type.is_ref = true;
- var cl = (Class) expr.type_reference.type;
- while (cl != null) {
- if (cl == initially_unowned_type) {
- expr.static_type.floating_reference = true;
- break;
+ if (expr.type_reference.type is Class) {
+ var cl = (Class) expr.type_reference.type;
+
+ if (cl.is_abstract) {
+ expr.static_type = null;
+ expr.error = true;
+ Report.error (expr.source_reference, "Can't create instance of abstract class `%s'".printf (expr.type_reference.to_string ()));
+ return;
}
-
- cl = cl.base_class;
+
+ while (cl != null) {
+ if (cl == initially_unowned_type) {
+ expr.static_type.floating_reference = true;
+ break;
+ }
+
+ cl = cl.base_class;
+ }
+ } else if (expr.named_argument_list.length () != 0) {
+ expr.static_type = null;
+ expr.error = true;
+ Report.error (expr.source_reference, "No arguments allowed when constructing struct `%s'".printf (expr.type_reference.to_string ()));
+ return;
}
}
dist_vapi_DATA = \
glib-2.0.vala \
libxml-2.0.vala \
+ gtk+-2.0.vala \
+ pango.vala \
$(NULL)
public String append_c (char c);
public String append_unichar (unichar wc);
public String append_len (string! val, long len);
+ public String prepend (string! val);
+ public String prepend_c (char c);
+ public String prepend_unichar (unichar wc);
+ public String prepend_len (string! val, long len);
public String insert (long pos, string! val);
public String erase (long pos, long len);