* module/language/ecmascript/impl.scm: Add <js-module-object>, that wraps
a module. Add js-require, a javascript-happy function that returns an
object that wraps a Guile module. Bind it to `require' in the default
environment.
* module/language/ecmascript/array.scm (*array-prototype*): Declare the
constructor.
* module/language/ecmascript/base.scm (pput, pdel): Remove some needless
checks.
(new): Move definition of new here, and use the constructor.
* module/language/ecmascript/compile-ghil.scm (compile-ghil): Add a stub
so that when we load a compiled JS program, we make sure the runtime
has been booted.
* module/language/ecmascript/function.scm (js-constructor): Export a
js-constructor method instead of a new method.
* module/language/ecmascript/impl.scm (<js-global-object>): Define a new
class for the global "this" object, wrapping bindings from the current
module.
(init-js-bindings!): Define the dozen or so global properties, in the
current module.
(+): Define addition operations for non-numbers. This is efficient
because the generics are only dispatched if the fast-path fails.
* module/language/ecmascript/compile-ghil.scm (comp): Use ghil-bind when
making temp vars, so that disassembly understands things. Implement do,
while, and for.
* module/language/ecmascript/parse.scm (parse-ecmascript): Some tweaks.
* module/language/ecmascript/impl.scm (language): Export ->boolean.
* module/language/ecmascript/base.scm: Implement some more robust
property getters that convert strings to symbols. Implement
has-property?.
* module/language/ecmascript/compile-ghil.scm (comp): Implement lots more
mathematical operators. We now do all expressions; on to statements.
* module/language/ecmascript/impl.scm: Define some math helpers. They
probably need to call ->number on some things.
* module/language/ecmascript/parse.scm (parse-ecmascript): Fix a typo.
* module/language/ecmascript/compile-ghil.scm (@impl): Implement with
@implv.
(comp): Implement ++ and -- (pre- and post-). Quite a pain. I'll be
looking for ways to simplify this notation. Also implement new, delete,
and void.
* module/language/ecmascript/impl.scm: Implement typeof.
* module/language/ecmascript/base.scm:
* module/language/ecmascript/compile-ghil.scm:
* module/language/ecmascript/impl.scm:
* module/language/ecmascript/parse.scm: Compile "method calls" in such a
way that "this" gets propagated correctly.
* module/language/Makefile.am:
* module/language/ecmascript/impl.scm:
* module/language/ecmascript/array.scm:
* module/language/ecmascript/base.scm:
* module/language/ecmascript/function.scm: Split out the runtime into
different files. Implement more of the spec's runtime.
* module/language/ecmascript/parse.scm (parse-ecmascript): And update the
function declaration forms for the new var syntax.
* module/language/ecmascript/compile-ghil.scm (comp): Support foo["bar"]
in addition to foo.bar.
* module/language/ecmascript/impl.scm (pget, pput): Some fixes for when
we get non-symbols -- it can happen, yo. I suppose we should allow for
non-string keys too..
* module/language/ecmascript/compile-ghil.scm (@impl): Ok, don't recurse
on args here.
(comp): Implement property gets and puts and lexical assignment.
(comp-body): Fix scanning of var forms.
* module/language/ecmascript/impl.scm (prop-attrs): Allow for the prop
attr array to be #f.
* module/language/ecmascript/parse.scm (parse-ecmascript): Fix assignment
parsing.
* libguile/vm-i-system.c (drop, return): Declare drop and return as
popping one arg from the stack.
* module/language/ghil/compile-glil.scm:
* module/language/glil/compile-assembly.scm (make-meta): Adjust so that
we declare 'drop and 'return calls as popping one arg from the stack.
* module/language/ecmascript/compile-ghil.scm (comp, comp-body): Flesh
out a bit more. Most significantly, scoping within functions obeys
javascript semantics better, modulo bits about with() forms.
* module/language/ecmascript/impl.scm: Define some runtime helper
routines.
* module/language/Makefile.am (SOURCES): Add impl.scm.
* module/language/ecmascript/parse.scm (parse-ecmascript): Minor tweaks.
* module/language/ecmascript/tokenize.scm (read-identifier): Identifiers
now read as symbols, not strings.