Closed viceice closed 3 years ago
Simplified repro:
var engine = new ScriptEngine();
engine.Execute(@"
function func(a) {
function z() { }
}
(function() {
var x;
func(x);
})();
");
throws:
System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at Jurassic.Compiler.RuntimeScope.SetValueCore(String variableName, Object value, Boolean strictMode, Int32 lineNumber, String sourcePath) in C:\Users\developer4\Desktop\Jurassic\jurassic\Jurassic\Compiler\ExecutionContext\RuntimeScope.cs:line 335
at Jurassic.Compiler.RuntimeScope.SetValue(String variableName, Object value, Int32 lineNumber, String sourcePath) in C:\Users\developer4\Desktop\Jurassic\jurassic\Jurassic\Compiler\ExecutionContext\RuntimeScope.cs:line 306
at func(ExecutionContext , Object[] )
at Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues)
at Jurassic.Library.FunctionInstance.CallWithStackTrace(String path, String function, Int32 line, Object thisObject, Object[] argumentValues)
at anonymous(ExecutionContext , Object[] )
at Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues)
at Jurassic.Library.FunctionInstance.CallWithStackTrace(String path, String function, Int32 line, Object thisObject, Object[] argumentValues)
at global(ExecutionContext )
at Jurassic.Compiler.GlobalOrEvalMethodGenerator.Execute(ScriptEngine engine, RuntimeScope parentScope, Object thisObject)
at Jurassic.CompiledScript.Execute(ScriptEngine engine)
at Jurassic.ScriptEngine.Execute(ScriptSource source)
at Jurassic.ScriptEngine.Execute(String code)
at JurassicConsoleCore.Program.Main(String[] args)
The issue appears to have been introduced with #185; before that commit, the exception doesn't occur.
Thanks for the bug report; I've published an updated Nuget package (version 3.2.3), it should fix the issue :-)
Works thanks for fast fix.
I'm getting the follwing error since the jurassic update at https://github.com/viceice/dotnet-ts-testing/pull/156
current code path of called typescript compiler: