[vala] Fix critical with invalid constant initializers



commit 18489bf24478bd1b97b4694d183d4826d29c54eb
Author: Jürg Billeter <j bitron ch>
Date:   Fri May 20 20:15:01 2011 +0200

    Fix critical with invalid constant initializers
    
    Fixes bug 640390.

 vala/valasemanticanalyzer.vala |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 6f8407f..21f67e4 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -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) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]