[Laszlo-dev] problem with compiler and type casting , DHTML runtime

Donald Anderson dda at ddanderson.com
Sat Mar 22 18:29:34 PDT 2008


LzView(x) is probably not recognized as a cast,
but as a normal function call.  I wonder if we
should support the 'as' directive so we can
recognize and elide casts.

   var ip:LzView = (this.immediateparent as LzView);

The semantics are similar, except that 'as' can return
null in cases where casts would throw an exception.
The alternative is to recognize all class names.

On Mar 22, 2008, at 7:14 PM, Henry Minsky wrote:

> The difference is in the line
>
>
> $
> 2
> );this
> .__LZdelayedSetters
> =LzView.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var  
> $3=LzView(this.immediateparent);$3=this.immediateparent;this.mask= 
> $3.mask;this.__makeSprite($2);if("width" in $2){
>   ^^^^^^^^^^^
>
>
> $ 
> 2 
> );this 
> .__LZdelayedSetters 
> =LzView.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var  
> $3=this.immediateparent;$3=this.immediateparent;this.mask= 
> $3.mask;this.__makeSprite($2);if("width" in $2){
>
> So the type cast  "LzView(...)" is getting sent through to the  
> output, which must be confusing JS1.
>
>
>
>
>
> On Sat, Mar 22, 2008 at 7:10 PM, Henry Minsky  
> <henry.minsky at gmail.com> wrote:
> I have been having trouble merging the the changes to LzView from  
> swf9 back to swf8/dhtml, I keep getting a runtime
> error in DHTML with even the simplest app that has a view in it
>
> this.$lzsc$initialize has no properties
> nc()LFCdhtml.js (line 39)
> (?)(This is the canvas hasdatapath=true datapath=Object, Object  
> pixellock=true selectable=false clip=true)LFCdhtml.js (line 2556)
> (?)(This is the canvas hasdatapath=true datapath=Object, Object  
> pixellock=true selectable=false clip=true)LFCdhtml.js (line 3303)
> (?)(This is the canvas hasdatapath=true datapath=Object, Object  
> bgcolor=13434828 font=Verdana,Vera,sans-serif, null,  
> true)LFCdhtml.js (line 400)
> (?)(This is the canvas hasdatapath=true datapath=Object, Object  
> bgcolor=13434828 font=Verdana,Vera,sans-serif, null,  
> true)LFCdhtml.js (line 2554)
> nc()LFCdhtml.js (line 39)
> (?)(Object attrs=Object name=text, true)LFCdhtml.js (line 577)
> (?)([This is the canvas hasdatapath=true datapath=Object, [Object  
> attrs=Object name=view]], 500)LFCdhtml.js (line 6654)
> (?)()LFCdhtml.js (line 6642)
> (?)(132)LFCdhtml.js (line 925)
> __idleupdate()LFCdhtml.js (line 7387)
> __update()LFCdhtml.js (line 953)
> this.$lzsc$initialize.apply(this,arguments)
>
> I tracked it down to this line in LzView's construct method
>
>
>
>    var ip:LzView = LzView(this.immediateparent);
>
> If I change that to not use type casting, it works:
>
>
>     //var ip = this.immediateparent;
>
> Here's the diff in the DHTML LFC file which is produced by this  
> change:
>
> *** /tmp/good    2008-03-22 19:01:37 -0400
> --- /tmp/bad    2008-03-22 19:02:01 -0400
> ***************
> *** 2553,2560 ****
>   $4=null
>   };(arguments.callee.superclass? 
> arguments.callee.superclass.prototype["$lzsc 
> $initialize"]:this.nextMethod(arguments.callee,"$lzsc 
> $initialize")).call(this,$1,$2,$3,$4)
>   },"animators",void 0,"_height",void 0,"_width",void 0,"_y",void  
> 0,"_x",void 0,"_resource",void 0,"__LZhaser",void  
> 0,"onaddsubview",LzDeclaredEvent,"onbgcolor",LzDeclaredEvent,"onblur", 
> LzDeclaredEvent,"onclick",LzDeclaredEvent,"onclickable",LzDeclaredEven 
> t,"onfocus",LzDeclaredEvent,"onframe",LzDeclaredEvent,"onheight",LzDec 
> laredEvent,"onimload",LzDeclaredEvent,"onkeyup",LzDeclaredEvent,"onkey 
> down",LzDeclaredEvent,"onlastframe",LzDeclaredEvent,"onload",LzDeclare 
> dEvent,"onloadperc",LzDeclaredEvent,"onerror",LzDeclaredEvent,"ontimeout",LzDeclaredEvent,"onmousedown",LzDeclaredEvent,"onmouseout",LzDeclaredEvent,"onmouseover",LzDeclaredEvent,"onmousetrackover",LzDeclaredEvent,"onmousetrackup",LzDeclaredEvent,"onmouseup",LzDeclaredEvent,"onopacity",LzDeclaredEvent,"onplay",LzDeclaredEvent,"onremovesubview",LzDeclaredEvent,"onresource",LzDeclaredEvent,"onresourceheight",LzDeclaredEvent,"onresourcewidth",LzDeclaredEvent,"onrotation",LzDeclaredEvent,"onstop",LzDeclaredEvent,"ontotalframes",LzDeclaredEvent,"onunstretchedheight",LzDeclaredEvent,"onunstretchedwidth",LzDeclaredEvent,"onvisible",LzDeclaredEvent,"onvisibility",LzDeclaredEvent,"onwidth",LzDeclaredEvent,"onx",LzDeclaredEvent,"onxoffset",LzDeclaredEvent,"ony",LzDeclaredEvent,"onyoffset",LzDeclaredEvent,"ondblclick",LzDeclaredEvent,"DOUBLE_CLICK_TIME",500,"capabilities",LzSprite.prototype.capabilities,"construct",function($1,$2){
> ! (arguments.callee.superclass? 
> arguments 
> .callee 
> .superclass 
> .prototype 
> ["construct 
> "]:this.nextMethod(arguments.callee,"construct")).call(this,$1? 
> $1:canvas, 
> $ 
> 2 
> );this 
> .__LZdelayedSetters 
> =LzView.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var  
> $3=this.immediateparent;$3=this.immediateparent;this.mask= 
> $3.mask;this.__makeSprite($2);if("width" in $2){
>   this.hassetwidth=true;this.__LZcheckwidth=false
>   };if("height" in $2){
>   this.hassetheight=true;this.__LZcheckheight=false
> --- 2553,2560 ----
>   $4=null
>   };(arguments.callee.superclass? 
> arguments.callee.superclass.prototype["$lzsc 
> $initialize"]:this.nextMethod(arguments.callee,"$lzsc 
> $initialize")).call(this,$1,$2,$3,$4)
>   },"animators",void 0,"_height",void 0,"_width",void 0,"_y",void  
> 0,"_x",void 0,"_resource",void 0,"__LZhaser",void  
> 0,"onaddsubview",LzDeclaredEvent,"onbgcolor",LzDeclaredEvent,"onblur", 
> LzDeclaredEvent,"onclick",LzDeclaredEvent,"onclickable",LzDeclaredEven 
> t,"onfocus",LzDeclaredEvent,"onframe",LzDeclaredEvent,"onheight",LzDec 
> laredEvent,"onimload",LzDeclaredEvent,"onkeyup",LzDeclaredEvent,"onkey 
> down",LzDeclaredEvent,"onlastframe",LzDeclaredEvent,"onload",LzDeclare 
> dEvent,"onloadperc",LzDeclaredEvent,"onerror",LzDeclaredEvent,"ontimeout",LzDeclaredEvent,"onmousedown",LzDeclaredEvent,"onmouseout",LzDeclaredEvent,"onmouseover",LzDeclaredEvent,"onmousetrackover",LzDeclaredEvent,"onmousetrackup",LzDeclaredEvent,"onmouseup",LzDeclaredEvent,"onopacity",LzDeclaredEvent,"onplay",LzDeclaredEvent,"onremovesubview",LzDeclaredEvent,"onresource",LzDeclaredEvent,"onresourceheight",LzDeclaredEvent,"onresourcewidth",LzDeclaredEvent,"onrotation",LzDeclaredEvent,"onstop",LzDeclaredEvent,"ontotalframes",LzDeclaredEvent,"onunstretchedheight",LzDeclaredEvent,"onunstretchedwidth",LzDeclaredEvent,"onvisible",LzDeclaredEvent,"onvisibility",LzDeclaredEvent,"onwidth",LzDeclaredEvent,"onx",LzDeclaredEvent,"onxoffset",LzDeclaredEvent,"ony",LzDeclaredEvent,"onyoffset",LzDeclaredEvent,"ondblclick",LzDeclaredEvent,"DOUBLE_CLICK_TIME",500,"capabilities",LzSprite.prototype.capabilities,"construct",function($1,$2){
> ! (arguments.callee.superclass? 
> arguments 
> .callee 
> .superclass 
> .prototype 
> ["construct 
> "]:this.nextMethod(arguments.callee,"construct")).call(this,$1? 
> $1:canvas, 
> $ 
> 2 
> );this 
> .__LZdelayedSetters 
> =LzView.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var  
> $3=LzView(this.immediateparent);$3=this.immediateparent;this.mask= 
> $3.mask;this.__makeSprite($2);if("width" in $2){
>   this.hassetwidth=true;this.__LZcheckwidth=false
>   };if("height" in $2){
>   this.hassetheight=true;this.__LZcheckheight=false
>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080322/1cba44f1/attachment-0001.html


More information about the Laszlo-dev mailing list