Donate Share

jsc (c# to javascript)

Tracker: Bugs

5 statement cannot be a load instruction (compiler fault?) - ID: 2138496
Last Update: Settings changed ( zproxy )

Using jsc with VS2008Express to compile C# to ActionScript (using the
template), i get this error :
(version: 20080925)

Snippet OK:
===========

string textToDisplay = "w="+this.root.width.ToString() + " h=" +
this.root.height;

Snippet KO:
===========
[Script, ScriptApplicationEntryPoint]
public class MyClass : Sprite
{
public MyClass()
{
string textToDisplay = "w="+this.root.width.ToString() + " h=" +
this.root.height.ToString();

script : error JSC1000: statement cannot be a load instruction (compiler
fault?): type: MyNamespace.ActionScript.MyClass offset: 0x0021 method:Void
.ctor()
}
}


Benjamin Mayrargue ( softlion ) - 2008-09-30 16:01

5

Closed

Later

Nobody/Anonymous

jsc

None

Public


Comment ( 1 )

Date: 2008-10-05 06:43
Sender: zproxyProject Admin

The code is almost equal to this pseudocode:

[0] string textToDisplay,
[1] float64 CS$0$0000)

textToDisplay = "w=" + (0$0000 = this.get_root().get_width()).ToString() +
(0$0000 = this.get_root().get_height()).ToString()

It is doing an assignment in the middle of the statement - which is not
supported by jsc yet.

For now you need to use a workaround.

Code analyzed:

.method private hidebysig instance void GetText(class
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.text.TextField t) cil
managed
{
.maxstack 4
.locals init (
[0] string textToDisplay,
[1] float64 CS$0$0000)
L_0000: nop
L_0001: ldstr "w="
L_0006: ldarg.0
L_0007: call instance class
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject::get_root()
L_000c: callvirt instance float64
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject::get_width()
L_0011: stloc.1
L_0012: ldloca.s CS$0$0000
L_0014: call instance string [mscorlib]System.Double::ToString()
L_0019: ldstr " h="
L_001e: ldarg.0
L_001f: call instance class
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject::get_root()
L_0024: callvirt instance float64
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.display.DisplayObject::get_height()
L_0029: stloc.1
L_002a: ldloca.s CS$0$0000
L_002c: call instance string [mscorlib]System.Double::ToString()
L_0031: call string [mscorlib]System.String::Concat(string, string,
string, string)
L_0036: stloc.0
L_0037: ldarg.1
L_0038: ldloc.0
L_0039: callvirt instance void
[ScriptCoreLib]ScriptCoreLib.ActionScript.flash.text.TextField::set_text(string)
L_003e: nop
L_003f: ret
}






Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
status_id Open 2008-10-05 06:47 zproxy
resolution_id None 2008-10-05 06:47 zproxy
close_date - 2008-10-05 06:47 zproxy