From 500a86d20a4e0426adc1925b4efa1622d6393beb Mon Sep 17 00:00:00 2001 From: "alon@honor" Date: Mon, 27 Sep 2010 18:26:22 -0700 Subject: [PATCH] simplify intertyping of store --- src/intertyper.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/intertyper.js b/src/intertyper.js index f8c5ea063..9c91b22ab 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -490,29 +490,16 @@ function intertyper(data) { substrate.addZyme('Store', { processItem: function(item) { if (item.tokens[0].text == 'volatile') item.tokens.shift(0); - if (item.tokens[3].text != ',') { - // complex input - likely getelementptr - var commaIndex = 4; - while (item.tokens[commaIndex].text != ',') commaIndex ++; - return [{ - __result__: true, - intertype: 'store', - valueType: item.tokens[1], - value: parseFunctionCall(item.tokens.slice(1, commaIndex)), - pointerType: item.tokens[commaIndex+1], - pointer: item.tokens[commaIndex+2], - ident: item.tokens[commaIndex+2].text, - lineNum: item.lineNum, - }]; - } + var commaIndex = 3; + while (item.tokens[commaIndex].text != ',') commaIndex ++; return [{ __result__: true, intertype: 'store', valueType: item.tokens[1], - value: addIdent(item.tokens[2]), - pointerType: item.tokens[4], - pointer: item.tokens[5], - ident: item.tokens[5].text, + value: commaIndex == 3 ? addIdent(item.tokens[2]) : parseFunctionCall(item.tokens.slice(1, commaIndex)), + pointerType: item.tokens[commaIndex+1], + pointer: item.tokens[commaIndex+2], + ident: item.tokens[commaIndex+2].text, lineNum: item.lineNum, }]; },