1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

support foo["bar"] in addition to foo.bar

* 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..
This commit is contained in:
Andy Wingo 2009-02-19 17:25:52 +01:00
parent b72880eb17
commit cdad2166e7
3 changed files with 28 additions and 25 deletions

View file

@ -114,10 +114,14 @@
args)))
((pref ,obj ,prop)
(@impl e l pget (list (comp obj e) (make-ghil-quote e l prop))))
((aref ,obj ,index)
(@impl e l pget (list (comp obj e) (comp index e))))
((= (ref ,name) ,val)
(make-ghil-set e l (ghil-var-for-set! e name) (comp val e)))
((= (pref ,obj ,prop) ,val)
(@impl e l pput (list (comp obj e) (make-ghil-quote e l prop) (comp val e))))
((= (aref ,obj ,prop) ,val)
(@impl e l pput (list (comp obj e) (comp prop e) (comp val e))))
(else
(error "compilation not yet implemented:" x)))))