Commit 2dc47785 authored by Rico Tzschichholz's avatar Rico Tzschichholz

Release taken references to CodeContext after using it

https://bugzilla.gnome.org/show_bug.cgi?id=712694
parent 0c05b6e3
......@@ -526,6 +526,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var stream = FileStream.open (context.symbols_filename, "w");
if (stream == null) {
Report.error (null, "unable to open `%s' for writing".printf (context.symbols_filename));
this.context = null;
return;
}
......@@ -552,6 +553,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
Report.error (null, "unable to open `%s' for writing".printf (context.internal_header_filename));
}
}
this.context = null;
}
public void push_context (EmitContext emit_context) {
......
......@@ -165,6 +165,7 @@ public class Vala.GIRWriter : CodeVisitor {
stream = FileStream.open (filename, "w");
if (stream == null) {
Report.error (null, "unable to open `%s' for writing".printf (filename));
this.context = null;
return;
}
......@@ -196,6 +197,8 @@ public class Vala.GIRWriter : CodeVisitor {
if (our_namespaces.size == 0) {
Report.error (null, "No suitable namespace found to export for GIR");
}
this.context = null;
}
private void write_doc (string? comment) {
......
......@@ -112,6 +112,8 @@ public class Vala.FlowAnalyzer : CodeVisitor {
file.accept (this);
}
}
this.context = null;
}
public override void visit_source_file (SourceFile source_file) {
......
......@@ -86,6 +86,7 @@ public class Vala.Genie.Parser : CodeVisitor {
public void parse (CodeContext context) {
this.context = context;
context.accept (this);
this.context = null;
}
public override void visit_source_file (SourceFile source_file) {
......
......@@ -1327,6 +1327,8 @@ public class Vala.GirParser : CodeVisitor {
foreach (var metadata in metadata_roots) {
report_unused_metadata (metadata);
}
this.context = null;
}
void map_vala_to_gir () {
......
......@@ -76,6 +76,7 @@ public class Vala.Parser : CodeVisitor {
public void parse (CodeContext context) {
this.context = context;
context.accept (this);
this.context = null;
}
public override void visit_source_file (SourceFile source_file) {
......
......@@ -28,9 +28,8 @@ using GLib;
* Code visitor analyzing and checking code.
*/
public class Vala.SemanticAnalyzer : CodeVisitor {
public CodeContext context { get; set; }
CodeContext context;
public Symbol root_symbol;
public Symbol current_symbol { get; set; }
public SourceFile current_source_file { get; set; }
......@@ -181,7 +180,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
public void analyze (CodeContext context) {
this.context = context;
root_symbol = context.root;
var root_symbol = context.root;
bool_type = new BooleanType ((Struct) root_symbol.scope.lookup ("bool"));
string_type = new ObjectType ((Class) root_symbol.scope.lookup ("string"));
......@@ -224,6 +223,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
current_symbol = root_symbol;
context.root.check (context);
context.accept (this);
this.context = null;
}
public override void visit_source_file (SourceFile file) {
......
......@@ -42,6 +42,9 @@ public class Vala.SymbolResolver : CodeVisitor {
root_symbol = context.root;
context.root.accept (this);
root_symbol = null;
this.context = null;
}
public override void visit_namespace (Namespace ns) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment