Fixed: dispose the script streams once they exit.

This commit is contained in:
arookas 2015-12-10 17:53:00 -05:00
parent 0c973514d9
commit 0b78c1dafe
2 changed files with 7 additions and 1 deletions

View file

@ -93,6 +93,7 @@ namespace arookas
var tree = parser.Parse(file); var tree = parser.Parse(file);
tree.Compile(this); tree.Compile(this);
ImportResolver.ExitFile(file); ImportResolver.ExitFile(file);
file.Dispose();
} }
return result; return result;
} }

View file

@ -85,7 +85,7 @@ namespace arookas
FailedToLoad, FailedToLoad,
} }
public class sunScriptFile public class sunScriptFile : IDisposable
{ {
public string Name { get; private set; } public string Name { get; private set; }
public Stream Stream { get; private set; } public Stream Stream { get; private set; }
@ -108,6 +108,11 @@ namespace arookas
Stream = stream; Stream = stream;
} }
public void Dispose()
{
Stream.Dispose();
}
public TextReader GetReader() public TextReader GetReader()
{ {
return new StreamReader(Stream); return new StreamReader(Stream);