]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix critical with invalid constant initializers
authorJürg Billeter <j@bitron.ch>
Fri, 20 May 2011 18:15:01 +0000 (20:15 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 20 May 2011 18:15:01 +0000 (20:15 +0200)
Fixes bug 640390.

vala/valasemanticanalyzer.vala

index 6f8407f84077de1aff009e082abc3961fb3dae40..21f67e4ed8368f2ed60fb0355fcaecc8a8ef4d30 100644 (file)
@@ -59,7 +59,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public Method? current_method {
                get {
                        unowned Symbol sym = current_symbol;
-                       while (sym is Block) {
+                       while (sym is Block || sym is Constant) {
                                sym = sym.parent_symbol;
                        }
                        return sym as Method;
@@ -69,7 +69,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public Method? current_async_method {
                get {
                        unowned Symbol sym = current_symbol;
-                       while (sym is Block || sym is Method) {
+                       while (sym is Block || sym is Constant || sym is Method) {
                                var m = sym as Method;
                                if (m != null && m.coroutine) {
                                        break;
@@ -84,7 +84,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public PropertyAccessor? current_property_accessor {
                get {
                        unowned Symbol sym = current_symbol;
-                       while (sym is Block) {
+                       while (sym is Block || sym is Constant) {
                                sym = sym.parent_symbol;
                        }
                        return sym as PropertyAccessor;
@@ -94,7 +94,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public Symbol? current_method_or_property_accessor {
                get {
                        unowned Symbol sym = current_symbol;
-                       while (sym is Block) {
+                       while (sym is Block || sym is Constant) {
                                sym = sym.parent_symbol;
                        }
                        if (sym is Method) {
@@ -860,14 +860,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        }
 
        public Method? find_parent_method (Symbol sym) {
-               while (sym is Block) {
+               while (sym is Block || sym is Constant) {
                        sym = sym.parent_symbol;
                }
                return sym as Method;
        }
 
        public Symbol? find_parent_method_or_property_accessor (Symbol sym) {
-               while (sym is Block) {
+               while (sym is Block || sym is Constant) {
                        sym = sym.parent_symbol;
                }
                if (sym is Method) {