Fixed: dispose file even if an error occurs.
This commit is contained in:
parent
2fcab65c22
commit
8d899d019a
1 changed files with 12 additions and 6 deletions
18
context.cs
18
context.cs
|
@ -88,12 +88,18 @@ namespace arookas
|
|||
var result = ImportResolver.ResolveImport(name, out file);
|
||||
if (result == sunImportResult.Loaded)
|
||||
{
|
||||
ImportResolver.EnterFile(file);
|
||||
var parser = new sunParser();
|
||||
var tree = parser.Parse(file);
|
||||
tree.Compile(this);
|
||||
ImportResolver.ExitFile(file);
|
||||
file.Dispose();
|
||||
try
|
||||
{
|
||||
ImportResolver.EnterFile(file);
|
||||
var parser = new sunParser();
|
||||
var tree = parser.Parse(file);
|
||||
tree.Compile(this);
|
||||
ImportResolver.ExitFile(file);
|
||||
}
|
||||
finally
|
||||
{
|
||||
file.Dispose();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue