diff options
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index addf0f21..1f875584 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -914,13 +914,13 @@ function parseI64Constant(str, legalized) { } function parseNumerical(value, type) { - if ((!type || type == 'double' || type == 'float') && (value.substr && value.substr(0,2) == '0x')) { + if ((!type || type === 'double' || type === 'float') && /^0x/.test(value)) { // Hexadecimal double value, as the llvm docs say, // "The one non-intuitive notation for constants is the hexadecimal form of floating point constants." value = IEEEUnHex(value); } else if (USE_TYPED_ARRAYS == 2 && isIllegalType(type)) { return value; // do not parseFloat etc., that can lead to loss of precision - } else if (value == 'null') { + } else if (value === 'null') { // NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.) value = '0'; } else if (value === 'true') { @@ -930,7 +930,7 @@ function parseNumerical(value, type) { } if (isNumber(value)) { var ret = parseFloat(value); // will change e.g. 5.000000e+01 to 50 - if (type in Runtime.FLOAT_TYPES) { + if (type === 'double' || type === 'float') { if (value[0] === '-' && ret === 0) return '-.0'; // fix negative 0, toString makes it 0 if (!RUNNING_JS_OPTS) ret = asmEnsureFloat(ret, type); } @@ -2474,13 +2474,6 @@ function walkInterdata(item, pre, post, obj) { if (walkInterdata(item.params[i], pre, post, obj)) return true; } } - if (item.possibleVars) { // other attributes that might contain interesting data; here, variables - var box = { intertype: 'value', ident: '' }; - for (i = 0; i <= item.possibleVars.length; i++) { - box.ident = item[item.possibleVars[i]]; - if (walkInterdata(box, pre, post, obj)) return true; - } - } return post && post(item, originalObj, obj); } @@ -2500,7 +2493,6 @@ function walkAndModifyInterdata(item, pre) { if (repl = walkAndModifyInterdata(item.params[i], pre)) item.params[i] = repl; } } - // Ignore possibleVars because we can't replace them anyhow } function parseBlockAddress(segment) { |