diff options
author | Eduardo Julian | 2018-02-23 00:42:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-02-23 00:42:23 -0400 |
commit | c8e2898611fa759cbe7c2ac84738b5b403575664 (patch) | |
tree | 24d8ccebc1b6e32e55964726f016432ff3815958 /new-luxc/source/luxc/lang/translation/js | |
parent | c8cda71ba02ab0986e3d4d839088aabdd02b37fa (diff) |
- Added all the missing tests for translation of common procedures.
- Implemented some missing process functionality in the JVM runtime.
- Minor bug fixes.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux | 4 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux | 18 |
2 files changed, 14 insertions, 8 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index 685043b83..efef6084c 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -398,7 +398,7 @@ ## [[IO]] (def: (io//log messageJS) Unary - (void (format "console.log(" messageJS ")"))) + (void (format runtimeT.io//log "(" messageJS ")"))) (def: (io//error messageJS) Unary @@ -425,7 +425,7 @@ (def: (atom//read atomJS) Unary - (format atomJS "." runtimeT.atom-field)) + (format (self-contained atomJS) "." runtimeT.atom-field)) (def: (atom//compare-and-swap [atomJS oldJS newJS]) Trinary diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index 8c33b2a82..70f648be1 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -1018,15 +1018,13 @@ (runtime: text//char "textChar" (format "(function " @ "(text,idx) {" - "var result = text.charAt(idx.L);" - (format "if(result === '') {" + "var result = text.charCodeAt(idx.L);" + (format "if(result === NaN) {" (format "return " none ";") "}" "else {" - (format "return " (some "{'C':result}") ";") + (format "return " (some (format int//from-number "(result)")) ";") "}") - "var reEscaped = toFind.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');" - "return text.replace(new RegExp(reEscaped, 'g'), replaceWith);" "})")) (runtime: text//hash "textHash" @@ -1076,6 +1074,13 @@ __array//put __array//remove)) +(runtime: io//log "log" + (format "(function " @ "(message) {" + "if(typeof console !== \"undefined\" && console.log) { console.log(message); }" + "else if(typeof print !== \"undefined\") { print(message); }" + "return " unit ";" + "})")) + (runtime: io//error "error" (format "(function " @ "(message) {" "throw new Error(message);" @@ -1083,7 +1088,8 @@ (def: runtime//io Runtime - (format __io//error)) + (format __io//log + __io//error)) (def: #export atom-field Text "V") |