diff options
author | Eduardo Julian | 2019-06-14 23:38:53 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-06-14 23:38:53 -0400 |
commit | 7ee04017ee2ef5376c566b00750fd521c0ecac42 (patch) | |
tree | fd7bac69714079cfc9bd44bb56fad0321350f534 /lux-js/source | |
parent | fcb8ce8340f4226a38d08f9e2f108e5ec0a95018 (diff) |
Some fixes for the scripting languages.
+ Small optimizations for pattern-matching generation.
Diffstat (limited to 'lux-js/source')
-rw-r--r-- | lux-js/source/program.lux | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 30ab46ced..00bdd2ef8 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -1,33 +1,35 @@ (.module: [lux #* + ["." host (#+ import: interface: do-to object)] + ["." debug] [abstract [monad (#+ do)]] [control ["." exception (#+ exception:)] - [cli (#+ program:)] - ["." io (#+ IO io)]] + ["." io (#+ IO io)] + [parser + [cli (#+ program:)]]] [data ["." maybe] ["." error (#+ Error)] [number ["." i64]] - ["." text ("#/." hash) + ["." text ("#@." hash) format] [collection - ["." array (#+ Array)] - ["." list ("#/." functor)]]] + ["." array (#+ Array)]]] [macro ["." template]] [world ["." file]] - ["." debug] - ["." host (#+ import: interface: do-to object) + ["@" target ["_" js]] [tool [compiler ["." name] [phase [macro (#+ Expander)] + ["." extension/bundle] ["." generation ["." js ["." runtime] @@ -109,10 +111,10 @@ [] ## Methods (program/IntValue - (getValue) java/lang/Object + [] (getValue self) java/lang/Object (:coerce java/lang/Object value)) (jdk/nashorn/api/scripting/AbstractJSObject - (getMember {member java/lang/String}) java/lang/Object + [] (getMember self {member java/lang/String}) java/lang/Object (case member (^ (static runtime.i64-high-field)) (|> value .nat runtime.high jvm-int) @@ -129,10 +131,10 @@ (object [] jdk/nashorn/api/scripting/AbstractJSObject [] [] (jdk/nashorn/api/scripting/AbstractJSObject - (isFunction) boolean + [] (isFunction self) boolean #1) (jdk/nashorn/api/scripting/AbstractJSObject - (call {this java/lang/Object} {args [java/lang/Object]}) java/lang/Object + [] (call self {this java/lang/Object} {args [java/lang/Object]}) java/lang/Object (debug.inspect js-object)) )) @@ -141,10 +143,10 @@ (object [] jdk/nashorn/api/scripting/AbstractJSObject [] [] (jdk/nashorn/api/scripting/AbstractJSObject - (isFunction) boolean + [] (isFunction self) boolean #1) (jdk/nashorn/api/scripting/AbstractJSObject - (call {this java/lang/Object} {args [java/lang/Object]}) java/lang/Object + [] (call self {this java/lang/Object} {args [java/lang/Object]}) java/lang/Object (|> (java/util/Arrays::copyOfRange value (|> args (array.read 0) maybe.assume (:coerce Int)) (.int (array.size value))) @@ -170,13 +172,13 @@ [] ## Methods (program/StructureValue - (getValue) java/lang/Object + [] (getValue self) java/lang/Object (:coerce (Array java/lang/Object) value)) (jdk/nashorn/api/scripting/AbstractJSObject - (isArray) boolean + [] (isArray self) boolean #1) (jdk/nashorn/api/scripting/AbstractJSObject - (getMember {member java/lang/String}) java/lang/Object + [] (getMember self {member java/lang/String}) java/lang/Object (case member "toString" (:coerce java/lang/Object @@ -207,7 +209,7 @@ (error! (exception.construct unknown-member [(:coerce Text member) (:coerce java/lang/Object value)]))) ) (jdk/nashorn/api/scripting/AbstractJSObject - (getSlot {idx int}) java/lang/Object + [] (getSlot self {idx int}) java/lang/Object (|> value (array.read (|> idx java/lang/Integer::longValue (:coerce Nat))) maybe.assume @@ -402,7 +404,7 @@ (-> javax/script/ScriptEngine Name _.Expression (Error [Text Any _.Statement])) (let [global (format (text.replace-all .module-separator ..separator module) ..separator (name.normalize name) - "___" (%n (text/hash name))) + "___" (%n (text@hash name))) @global (_.var global)] (do error.monad [#let [definition (_.define @global input)] @@ -446,8 +448,10 @@ _.null)))) (program: [{service /cli.service}] - (/.compiler ..expander + (/.compiler @.js + ..expander ..platform extension.bundle + extension/bundle.empty ..program service)) |