]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix uncaught errors in constructors and destructors
authorJürg Billeter <j@bitron.ch>
Fri, 22 Oct 2010 13:40:23 +0000 (15:40 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 23 Oct 2010 16:11:46 +0000 (18:11 +0200)
codegen/valaccodebasemodule.vala
codegen/valagerrormodule.vala

index 9a53fc21f85e8625eb5d2f357e3ac974e1f0ba9c..e37416fc48e13ed64a76c8d83700e344d8dbb975 100644 (file)
@@ -130,7 +130,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
                }
        }
 
-       bool is_in_constructor () {
+       public bool is_in_constructor () {
                var sym = current_symbol;
                while (sym != null) {
                        if (sym is Constructor) {
@@ -141,7 +141,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
                return false;
        }
 
-       bool is_in_destructor () {
+       public bool is_in_destructor () {
                var sym = current_symbol;
                while (sym != null) {
                        if (sym is Destructor) {
index b7b4436adeef1b2e83a5d176c9de908877dadec6..3ccc68f3425be8551ca9644aace3df5455bef06a 100644 (file)
@@ -135,7 +135,9 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                ccode.add_expression (ccritical);
                ccode.add_expression (cclear);
 
-               if (current_method is CreationMethod) {
+               if (is_in_constructor () || is_in_destructor ()) {
+                       // just print critical, do not return prematurely
+               } else if (current_method is CreationMethod) {
                        if (current_method.parent_symbol is Struct) {
                                ccode.add_return ();
                        } else {