aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parser.js8
-rw-r--r--src/snippets.js4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/parser.js b/src/parser.js
index 6da567db..40bffff0 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -68,6 +68,7 @@ function pointingLevels(type) {
function toNiceIdent(ident) {
if (parseFloat(ident) == ident) return ident;
+ if (ident == 'null') return '0'; // see parseNumerical
return ident.replace(/[" \.@%:<>,\*]/g, '_');
}
@@ -325,6 +326,10 @@ function parseNumerical(value, type) {
// "The one non-intuitive notation for constants is the hexadecimal form of floating point constants."
return IEEEUnHex(value);
}
+ if (value == 'null') {
+ // NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.)
+ return '0';
+ }
return value;
}
@@ -2139,12 +2144,11 @@ function JSify(data) {
item.JS = (item.overrideSSA ? '' : 'var ') + toNiceIdent(item.ident);
var type = item.value.type.text;
- var value = item.value.JS;
+ var value = parseNumerical(item.value.JS);
//print("zz var: " + item.JS);
var impl = getVarData(item.funcData, item.ident);
switch (impl) {
case VAR_NATIVE: {
- value = parseNumerical(value, type);
break;
}
case VAR_NATIVIZED: {
diff --git a/src/snippets.js b/src/snippets.js
index 83cc26e6..5d84f1a0 100644
--- a/src/snippets.js
+++ b/src/snippets.js
@@ -56,6 +56,10 @@ var Snippets = {
}
}
},
+
+ __assert_fail: function(condition, file, line) {
+ throw 'Assertion failed: ' + Pointer_stringify(condition);//JSON.stringify(arguments)//condition;
+ },
};
// Aliases