Fixed: dispose file even if an error occurs.

This commit is contained in:
arookas 2015-12-12 16:52:34 -05:00
parent 2fcab65c22
commit 8d899d019a

View file

@ -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;
}