JScript.Net compiler bug
-
So I think I’ve discovered a bug in the JScript.Net compiler. It has to do with the VBArray object and it’s use in derived class' constructor; specifically when initializing the base class. I’ve taken a brief look into the compilers’ source code, but the problem isn’t just popping out at me, so further exploration into this will be necessary. The following code demonstrates the bug.
class BaseClass {
private var a\_ : Array; public function BaseClass ( a : Array ) { this.a\_ = a; }
}
class DerivedClass extends BaseClass {
public function DerivedClass ( a : VBArray ) { super ( **a.toArray ()** ); // compiler chokes here }
}
Here's a dump of the error, if anyone's interested. It looks like it got a problem with creating a local variable (why?), but that's just a guess at this point.
***INTERNAL COMPILER ERROR***
Microsoft.Vsa.VsaException: InternalCompilerError (0x80133021): System.ArgumentNullException: Value cannot be null.
Parameter name: local
at System.Reflection.Emit.ILGenerator.Emit(OpCode opcode, LocalBuilder local)
at Microsoft.JScript.Member.TranslateToLateBinding(ILGenerator il, Boolean speculativeEarlyBindingsExist)
at Microsoft.JScript.Binding.TranslateToIL(ILGenerator il, Type rtype, Boolean preSet, Boolean preSetPlusGet, Boolean calledFromDelete)
at Microsoft.JScript.Binding.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Member.TranslateToILWithDupOfThisOb(ILGenerator il)
at Microsoft.JScript.Binding.TranslateToILCall(ILGenerator il, Type rtype, ASTList argList, Boolean construct, Boolean brackets)
at Microsoft.JScript.Call.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Class.EmitInitialCalls(ILGenerator il, MethodBase supcons, ParameterInfo[] pars, ASTList argAST, Int32 callerParameterCount)
at Microsoft.JScript.FunctionObject.TranslateToIL(CompilerGlobals compilerGlobals)
at Microsoft.JScript.FunctionDeclaration.TranslateToILInitializer(ILGenerator il)
at Microsoft.JScript.Block.TranslateToILInstanceInitializers(ILGenerator il)
at Microsoft.JScript.Class.TranslateToCOMPlusClass()
at Microsoft.JScript.Class.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Block.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.ScriptBlock.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.ScriptBlock.TranslateToI -
So I think I’ve discovered a bug in the JScript.Net compiler. It has to do with the VBArray object and it’s use in derived class' constructor; specifically when initializing the base class. I’ve taken a brief look into the compilers’ source code, but the problem isn’t just popping out at me, so further exploration into this will be necessary. The following code demonstrates the bug.
class BaseClass {
private var a\_ : Array; public function BaseClass ( a : Array ) { this.a\_ = a; }
}
class DerivedClass extends BaseClass {
public function DerivedClass ( a : VBArray ) { super ( **a.toArray ()** ); // compiler chokes here }
}
Here's a dump of the error, if anyone's interested. It looks like it got a problem with creating a local variable (why?), but that's just a guess at this point.
***INTERNAL COMPILER ERROR***
Microsoft.Vsa.VsaException: InternalCompilerError (0x80133021): System.ArgumentNullException: Value cannot be null.
Parameter name: local
at System.Reflection.Emit.ILGenerator.Emit(OpCode opcode, LocalBuilder local)
at Microsoft.JScript.Member.TranslateToLateBinding(ILGenerator il, Boolean speculativeEarlyBindingsExist)
at Microsoft.JScript.Binding.TranslateToIL(ILGenerator il, Type rtype, Boolean preSet, Boolean preSetPlusGet, Boolean calledFromDelete)
at Microsoft.JScript.Binding.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Member.TranslateToILWithDupOfThisOb(ILGenerator il)
at Microsoft.JScript.Binding.TranslateToILCall(ILGenerator il, Type rtype, ASTList argList, Boolean construct, Boolean brackets)
at Microsoft.JScript.Call.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Class.EmitInitialCalls(ILGenerator il, MethodBase supcons, ParameterInfo[] pars, ASTList argAST, Int32 callerParameterCount)
at Microsoft.JScript.FunctionObject.TranslateToIL(CompilerGlobals compilerGlobals)
at Microsoft.JScript.FunctionDeclaration.TranslateToILInitializer(ILGenerator il)
at Microsoft.JScript.Block.TranslateToILInstanceInitializers(ILGenerator il)
at Microsoft.JScript.Class.TranslateToCOMPlusClass()
at Microsoft.JScript.Class.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.Block.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.ScriptBlock.TranslateToIL(ILGenerator il, Type rtype)
at Microsoft.JScript.ScriptBlock.TranslateToI -
No, I never really looked into it any further.
Regards, -B "[F]reedom isn't a licence, it's responsibility." [David Gerrold, Author's Note in "The Man Who Folded Himself", 2003, p. 119]