summaryrefslogtreecommitdiff
path: root/vala/valagenieparser.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-12-25 12:04:01 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-01-02 12:42:02 +0100
commit71da3b84e23f9d97edaa1735f0e761304519d1f2 (patch)
tree202e7f220d8a81eca55088033220032d3bdd8ab3 /vala/valagenieparser.vala
parent016fa852b56d5c7f5863defffba1411a656c2661 (diff)
downloadvala-71da3b84e23f9d97edaa1735f0e761304519d1f2.tar.gz
parser: Allow custom invocations of parse_file()
Use CodeContext of SourceFile if needed https://bugzilla.gnome.org/show_bug.cgi?id=791936
Diffstat (limited to 'vala/valagenieparser.vala')
-rw-r--r--vala/valagenieparser.vala8
1 files changed, 8 insertions, 0 deletions
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 8c92e9599..dfffa23a7 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -399,6 +399,11 @@ public class Vala.Genie.Parser : CodeVisitor {
}
public void parse_file (SourceFile source_file) {
+ var has_global_context = (context != null);
+ if (!has_global_context) {
+ context = source_file.context;
+ }
+
scanner = new Scanner (source_file);
scanner.parse_file_comments ();
scanner.indent_spaces = 0;
@@ -430,6 +435,9 @@ public class Vala.Genie.Parser : CodeVisitor {
}
scanner = null;
+ if (!has_global_context) {
+ context = null;
+ }
}
void skip_symbol_name () throws ParseError {