[Laszlo-dev] error compiling user class in swf9
Donald Anderson
dda at ddanderson.com
Thu Mar 27 18:23:12 PDT 2008
The error message is misleading. It's probably the
same global variable that is declared more than once.
It's detecting that it's trying to write a file by the same
name twice and complaining about that. Remember
that every global (top level variable) gets its own file.
If we have need to allow something like this:
var x;
...
var x;
(like they allow in C), I'll need to make some changes.
Let me know, In the meantime, I'll fix the error message.
On Mar 27, 2008, at 5:42 PM, Henry Minsky wrote:
> The compiler complains about compiling tests in test/lztest
>
> (I removed the debug=true from the lztest-animator.lzx, and it says
>
> Compiling: ../lztest/lztest-animator.lzx to ../lztest/lztest-
> animator.lzr=swf9.swf
> Compilation errors occurred:
> : org.openlaszlo.sc.CompilerError: cannot declare class name more
> than once: "LzTestManager"
>
> lps/components/lztest/lztestmanager.lzx defines the LzTestManager,
> it's not a class, just an object
> with methods on it (prototype-style OO).
>
> I haven't looked yet what it is compiling to, is there a way to get
> the script compiler to give more info?
>
>
> On Thu, Mar 27, 2008 at 5:30 PM, P T Withington <ptw at pobox.com> wrote:
> We're getting real close! Can we run an lzunit test now?
>
> On 2008-03-27, at 16:43 EDT, Henry Minsky wrote:
> > Hey, I got the test to run, by manually fixing up the superclass
> > name, the
> > entry in ConstructorMap, and that boolean type declaration.
> >
> > Yay!
> >
> >
> > On Thu, Mar 27, 2008 at 4:28 PM, Henry Minsky <henry.minsky at gmail.com
> >
> > wrote:
> >
> >> Tucker and I are working on the class name issue, we are putting
> >> something
> >> into the compiler to
> >> put the correct LFC classnames (LzView, LzNode, etc) as the
> >> superclass
> >> name.
> >>
> >> And we're adding code to enter the user-class name into the
> >> ConstructorMap
> >> table, so that the instantiator
> >> knows what real JS class name corresponds to the LZX tag name.
> >>
> >> Thanks!
> >>
> >> Maybe we should have a chat room going so we can all see what's
> >> happening. Are you on iChat Don?
> >>
> >>
> >>
> >> On Thu, Mar 27, 2008 at 4:06 PM, Donald Anderson <dda at ddanderson.com
> >
> >> wrote:
> >>
> >>> I'm looking at the generated code now.There's a few things that
> >>> pop out
> >>> right away.
> >>>
> >>> 1) we generate this:
> >>>
> >>> dynamic class $lzc$class_foobar extends $lzc$class_view {
> >>>
> >>> I'm guessing that this should be extends 'LzView' ?
> >>> That's what you need the LFC dictionary for?
> >>> So I changed the three occurrences of $lzc$class_view to LzView.
> >>>
> >>> 2) it looks like there are some static stuff in the user class
> like
> >>> this:
> >>>
> >>> static var tagname = "foobar";static var children =
> >>> LzNode.mergeChildren([{attrs:
> >>> {bgcolor: 16711000, height: 100, width: 100}, name: "view"},
> {attrs:
> >>> {bgcolor: 255, height: 150, width: 200, x: 175, y: 100}, name:
> >>> "view"}],
> >>> $lzc$class_view["children"]);static var attributes = new
> >>> LzInheritedHash($lzc$class_view.attributes);
> >>>
> >>> Is there some what that the name "foobar" gets registered to the
> >>> application to know about this class?
> >>> Is it some side effect of this static code? (if so, we need a way
> >>> to get
> >>> the class initialized).
> >>> But I don't see the string "foobar" anywhere, except in the
> tagname.
> >>>
> >>> After all, the main code has this:
> >>> LzInstantiateView({attrs: {x: 100}, name: "foobar"}, 3);
> >>>
> >>> So it's got to find the name "foobar" someplace?
> >>>
> >>> 3) there are compilation errors in $lzc$class_foobar.as, and we
> >>> don't
> >>> see them because
> >>> $lzc$class_foobar is never referenced anywhere. My temporary
> >>> workaround
> >>> was to insert
> >>> a dummy function in $lzc$class_foobar:
> >>>
> >>> static function $init$() { }
> >>>
> >>> And insert code into the LzApplication's constuctor():
> >>>
> >>> $lzc$class_foobar.$init$();
> >>>
> >>> (This is all done manually for debugging).
> >>>
> >>> Now when I compile I start getting errors:
> >>>
> >>> /Users/clients/laszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/
> >>> lzgen23563/$lzc$class_foobar.as(6):
> >>> col: 89 Error: Type was not found or was not a compile-time
> >>> constant:
> >>> boolean.
> >>>
> >>> function $lzc$class_foobar (parent:LzNode, attrs:Object,
> >>> children:Object? = null, async:boolean = null)
> >>>
> >>> So boolean = null should be Boolean = false (is this something
> >>> generated by tag compiler?)
> >>>
> >>> 4) fixing that gets a clean compile, but same behavior (blank
> >>> canvas).
> >>> I suspect it's something to do with 2) above - somehow we need
> >>> to register the 'foobar' class so it can be instantiated at
> >>> runtime as
> >>> needed.
> >>>
> >>> Henry - I think these issues need your expertise, but if there's
> >>> something
> >>> I can assist with, shout. BTW, my cell is 617-306-2057, feel free
> >>> to
> >>> call.
> >>> I'll be reading email too.
> >>>
> >>> - Don
> >>>
> >>>
> >>>
> >>> On Mar 27, 2008, at 1:20 PM, Henry Minsky wrote:
> >>>
> >>> with this test case
> >>>
> >>> <canvas width="1000" height="600" bgcolor="#eeeeff">
> >>> <class name="foobar" >
> >>> <view width="50" height="50" bgcolor='red'/>
> >>> <view y="50" x="75" width="100" height="50" bgcolor='blue'/>
> >>> </class>
> >>>
> >>> <foobar x="100"/>
> >>> <foobar x="200" y="200"/>
> >>> <foobar x="300" y="400"/>
> >>>
> >>>
> >>> </canvas>
> >>>
> >>> I get this compiler error in swf9
> >>>
> >>> lzc --runtime=swf9 hello-classes.lzx
> >>> Compiling: hello-classes.lzx to hello-classes.lzr=swf9.swf
> >>> Compilation errors occurred:
> >>> : org.openlaszlo.sc.CompilerError: $lzc$class_foobar: class or
> mixin
> >>> name may conflict with internally generated names
> >>> badtzmaru:swf9 hqm$
> >>>
> >>>
> >>> --
> >>> 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
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >> --
> >> Henry Minsky
> >> Software Architect
> >> hminsky at laszlosystems.com
> >>
> >>
> >
> >
> > --
> > 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/20080327/7f033cb8/attachment-0001.html
More information about the Laszlo-dev
mailing list