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
|
@ -87,14 +87,20 @@ namespace arookas
|
||||||
sunScriptFile file;
|
sunScriptFile file;
|
||||||
var result = ImportResolver.ResolveImport(name, out file);
|
var result = ImportResolver.ResolveImport(name, out file);
|
||||||
if (result == sunImportResult.Loaded)
|
if (result == sunImportResult.Loaded)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ImportResolver.EnterFile(file);
|
ImportResolver.EnterFile(file);
|
||||||
var parser = new sunParser();
|
var parser = new sunParser();
|
||||||
var tree = parser.Parse(file);
|
var tree = parser.Parse(file);
|
||||||
tree.Compile(this);
|
tree.Compile(this);
|
||||||
ImportResolver.ExitFile(file);
|
ImportResolver.ExitFile(file);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
file.Dispose();
|
file.Dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue