Yeah, the compiler translates "new Foo()" calls into Foo.make() calls. In
the LFC in compiler/LzRuntime.lzs there's a adaptor definitions which make
'make()' work for built-in and user defined classes that aren't descendants
of LzNode:
/**
* Trampoline for 'conventional' constructors
* @access private
*/
Function.prototype.make = function () {
#pragma "passThrough=true"
if (arguments.length > 0) {
// We have to work too hard to break a conventional constructor
// into a constructor and initializer when there are args, because
// Javascript does not support apply of new.
function xtor () {};
xtor.prototype = this.prototype;
var o = new xtor;
this.apply(o, arguments);
return o;
} else {
return new this;
}
}
..
...
...
Maybe you can see if those work for you. Note the pragma
#pragma "passThrough=true"
which if put into a code block causes the compiler to not make the "new
Foo()"
transformation to make().
On 3/3/07, strk <[EMAIL PROTECTED]> wrote:
UPDATES: GNash is now fixed to support this code
compiled with MTASC. So it works both with Ming and MTASC, but still
doesn't
work with Laszlo. Anyway, the "hello world" application
now works in openlaszlo even with the unmodified foundation
classes, which is a step forward.
Next I'll need to find the sources for the 'Instance.make' prototype
as it seems 'make' is called *even* when wiping out LFC7.lzl.
ACTIONSCRIPT ERROR: call_method can't find method make for object
N5gnash12swf_functionE (0x823b048)
--strk;
On Thu, Mar 01, 2007 at 06:12:51PM +0100, strk wrote:
> On Thu, Mar 01, 2007 at 10:16:52AM -0500, P T Withington wrote:
> > This has to work for our classes to work:
> >
> > <script when="immediate">
> > function A () { this.constructor = arguments.callee; };
> > A.prototype.test = function () { return true; }
> >
> > function B () { this.constructor = arguments.callee; };
> >
> > B.prototype = new A();
> >
> > B.prototype.test = function () {
> > if (this.constructor.prototype.constructor.prototype.test()) {
> > _global.trace("it works");
> > }
> > }
> >
> > (new B()).test();
> > </script>
>
> Ok, this works when compiled by Ming, but not when compiled by MTASC !
> Something simple to work on finally :)
> Thanks!
>
> --strk;
>
>
>
> _______________________________________________
> Gnash-dev mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/gnash-dev
--
() ASCII Ribbon Campaign
/\ Keep it simple!
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev