aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-11 21:27:14 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-11 21:27:14 -0700
commitf937b0464b18aa98e46ef6cd37e973f468906e88 (patch)
treec13bd6fe38d833bff4cf3ccc4b77db8448ed877a
parentc0b0c3f87bb5050860fb1248a3fae20f5e0aefa2 (diff)
we only allow 1 exported variable from inline js; #1613
-rw-r--r--src/intertyper.js1
-rw-r--r--tests/test_core.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index c4f62ec4..082fd993 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -716,6 +716,7 @@ function intertyper(data, sidePass, baseLineNums) {
item.intertype = 'value';
if (tokensLeft[0].text == 'sideeffect') tokensLeft.splice(0, 1);
item.ident = tokensLeft[0].text.substr(1, tokensLeft[0].text.length-2) || ';'; // use ; for empty inline assembly
+ assert((item.tokens[5].text.match(/=/g) || []).length <= 1, 'we only support at most 1 exported variable from inline js: ' + item.ident);
var i = 0;
var params = [], args = [];
splitTokenList(tokensLeft[3].item.tokens).map(function(element) {
diff --git a/tests/test_core.py b/tests/test_core.py
index 06ef76b2..d02e6778 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3760,14 +3760,14 @@ def process(filename):
// Test that passing multiple input and output variables works.
int src1 = 1, src2 = 2, src3 = 3;
int dst1 = 0, dst2 = 0, dst3 = 0;
- asm("Module.print(%3); Module.print(%4); Module.print(%5); %0 = %3; %1 = %4; %2 = %5;" : "=r"(dst1),"=r"(dst2),"=r"(dst3): "r"(src1),"r"(src2),"r"(src3));
- printf("%d\n%d\n%d\n", dst1, dst2, dst3);
+ // TODO asm("Module.print(%3); Module.print(%4); Module.print(%5); %0 = %3; %1 = %4; %2 = %5;" : "=r"(dst1),"=r"(dst2),"=r"(dst3): "r"(src1),"r"(src2),"r"(src3));
+ // TODO printf("%d\n%d\n%d\n", dst1, dst2, dst3);
return 0;
}
'''
- self.do_run(src, 'Inline JS is very cool\n3.64\n1\n2\n3\n1\n2\n3\n')
+ self.do_run(src, 'Inline JS is very cool\n3.64\n') # TODO 1\n2\n3\n1\n2\n3\n')
def test_inlinejs2(self):
if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code