summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-11-14 15:55:10 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-11-14 15:57:06 +0100
commit4769941b14462ec366ef0b5a5cb934254d20ee02 (patch)
treef96017f9b7c4c6a56e8ea1e7a83cb8cea9c6786e
parent5dd7f7789a76de5ef93d1b3cfd11682c925e8b3d (diff)
downloadvala-4769941b14462ec366ef0b5a5cb934254d20ee02.tar.gz
vala: Properly restore SemanticAnalyzer.current_symbol to its original value
-rw-r--r--vala/valaconstructor.vala3
-rw-r--r--vala/valadestructor.vala3
-rw-r--r--vala/valaforeachstatement.vala3
3 files changed, 6 insertions, 3 deletions
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index 97f4bf4f4..2c923246c 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -71,6 +71,7 @@ public class Vala.Constructor : Subroutine {
this_parameter.check (context);
}
+ var old_symbol = context.analyzer.current_symbol;
context.analyzer.current_symbol = this;
if (body != null) {
@@ -87,7 +88,7 @@ public class Vala.Constructor : Subroutine {
}
}
- context.analyzer.current_symbol = parent_symbol;
+ context.analyzer.current_symbol = old_symbol;
return !error;
}
diff --git a/vala/valadestructor.vala b/vala/valadestructor.vala
index 61797ea22..f363fee1b 100644
--- a/vala/valadestructor.vala
+++ b/vala/valadestructor.vala
@@ -71,13 +71,14 @@ public class Vala.Destructor : Subroutine {
this_parameter.check (context);
}
+ var old_symbol = context.analyzer.current_symbol;
context.analyzer.current_symbol = this;
if (body != null) {
body.check (context);
}
- context.analyzer.current_symbol = parent_symbol;
+ context.analyzer.current_symbol = old_symbol;
return !error;
}
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 2c81b202a..7f77cdc33 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -378,6 +378,7 @@ public class Vala.ForeachStatement : Block {
element_variable.checked = true;
// analyze body
+ var old_symbol = context.analyzer.current_symbol;
owner = context.analyzer.current_symbol.scope;
context.analyzer.current_symbol = this;
@@ -391,7 +392,7 @@ public class Vala.ForeachStatement : Block {
local.active = false;
}
- context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
+ context.analyzer.current_symbol = old_symbol;
collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name));