mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
+ for strings, global js object, new Foo() works
* 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.
This commit is contained in:
parent
aec8febc46
commit
8c306808c2
6 changed files with 97 additions and 35 deletions
|
@ -41,7 +41,8 @@
|
|||
(else o))))))
|
||||
|
||||
(define *array-prototype* (make <js-object> #:class "Array"
|
||||
#:value new-array))
|
||||
#:value new-array
|
||||
#:constructor new-array))
|
||||
|
||||
(hashq-set! *program-wrappers* new-array *array-prototype*)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue