aboutsummaryrefslogtreecommitdiff
path: root/src/intertyper.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-09 17:54:25 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-09 17:54:25 -0700
commitfa307241513ecc2e9a7711c79ed0b3a7e321f686 (patch)
tree3f0b4cb306187897f7a7b3cecb1764eff7a34c14 /src/intertyper.js
parentedf26eb8c4704fa07cc7e646b2b9ccd59a698467 (diff)
experimental support for inline js
Diffstat (limited to 'src/intertyper.js')
-rw-r--r--src/intertyper.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 7dafed6f..26f55392 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -660,17 +660,19 @@ function intertyper(data, sidePass, baseLineNums) {
item.type = item.tokens[1].text;
Types.needAnalysis[item.type] = 0;
while (['@', '%'].indexOf(item.tokens[2].text[0]) == -1 && !(item.tokens[2].text in PARSABLE_LLVM_FUNCTIONS) &&
- item.tokens[2].text != 'null') {
- // We cannot compile assembly. If you hit this, perhaps tell the compiler not
- // to generate arch-specific code? |-U__i386__ -U__x86_64__| might help, it undefines
- // the standard archs.
+ item.tokens[2].text != 'null' && item.tokens[2].text != 'asm') {
assert(item.tokens[2].text != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
item.tokens.splice(2, 1);
}
var tokensLeft = item.tokens.slice(2);
item.ident = eatLLVMIdent(tokensLeft);
- // We cannot compile assembly, see above.
- assert(item.ident != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
+ if (item.ident == 'asm') {
+ // Inline assembly is just JavaScript that we paste into the code
+ item.intertype = 'value';
+ if (tokensLeft[0].text == 'sideeffect') tokensLeft.splice(0, 1);
+ item.ident = tokensLeft[0].text.substr(1, tokensLeft[0].text.length-2);
+ return { forward: null, ret: [item], item: item };
+ }
if (item.ident.substr(-2) == '()') {
// See comment in isStructType()
item.ident = item.ident.substr(0, item.ident.length-2);