aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-15 23:15:05 -0700
committeralon@honor <none@none>2010-10-15 23:15:05 -0700
commit0be63d3eeba00b0e68d309e4af84f4906b1750aa (patch)
tree80ea79592e02ecfaaa4365b382b40471c5251dc0
parent5c33e208873515258c577350f2e006c1563b12af (diff)
avoid redirection for math funcs
-rw-r--r--src/jsifier.js4
-rw-r--r--src/library.js8
2 files changed, 7 insertions, 5 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 32b284ad..1f432afc 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -198,7 +198,9 @@ function JSify(data) {
if (shortident in Library) {
var snippet = Library[shortident];
if (typeof snippet === 'string') {
- snippet = Library[snippet]; // redirection for aliases
+ if (Library[snippet]) {
+ snippet = Library[snippet]; // redirection for aliases
+ }
}
item.JS = item.ident + ' = ' + snippet.toString();
} else {
diff --git a/src/library.js b/src/library.js
index 0663d6c1..fc9e34c6 100644
--- a/src/library.js
+++ b/src/library.js
@@ -180,10 +180,10 @@ var Library = {
// math.h
- cos: function(x) { return Math.cos(x) },
- sin: function(x) { return Math.sin(x) },
- sqrt: function(x) { return Math.sqrt(x) },
- llvm_sqrt_f64: 'sqrt',
+ cos: 'Math.cos',
+ sin: 'Math.sin',
+ sqrt: 'Math.sqrt',
+ llvm_sqrt_f64: 'Math.sqrt',
// unistd.h