diff options
| author | Arun Isaac | 2025-12-17 21:38:48 +0000 |
|---|---|---|
| committer | Arun Isaac | 2025-12-17 22:26:38 +0000 |
| commit | fe3899b59908b86bb00d63fa970b708de0950f91 (patch) | |
| tree | d4a3f9a486cf254cfcbb3bd7ae51eb20443a4918 | |
| parent | cf91c081404cc2fc06677840a02b1bb84cffacbe (diff) | |
| download | ravanan-fe3899b59908b86bb00d63fa970b708de0950f91.tar.gz ravanan-fe3899b59908b86bb00d63fa970b708de0950f91.tar.lz ravanan-fe3899b59908b86bb00d63fa970b708de0950f91.zip | |
javascript: Short circuit trivial null, true and false expressions.
We can handle these without falling back to node.
| -rw-r--r-- | ravanan/javascript.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ravanan/javascript.scm b/ravanan/javascript.scm index 5061085..ad53820 100644 --- a/ravanan/javascript.scm +++ b/ravanan/javascript.scm @@ -146,6 +146,13 @@ keys @code{\"inputs\"}, @code{\"self\"} and @code{\"runtime\"}. segments)) context expression-lib))))) + ;; Quick short circuiting for null, true and false + (('javascript-expression "(null)") + (if context 'null #~'null)) + (('javascript-expression "(true)") + (if context #t #~#t)) + (('javascript-expression "(false)") + (if context #f #~#f)) ;; This is a more complex javascript expression. Fall back to node. (('javascript-expression expression) (evaluate-using-node expression context expression-lib)) |
