aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-30 02:57:03 +0300
committermax99x <max99x@gmail.com>2011-07-30 02:57:03 +0300
commit0e64105b7e8463ef65a2004d3b0d47a1aa61d98d (patch)
tree98f3e4c190334aee188995724c2a4cd3bdd8d453
parent7412ceb37a6789876a0d2055f6bb584d0938bc24 (diff)
Minor documentation and error message polish.
-rw-r--r--src/preamble.js4
-rw-r--r--src/runtime.js19
2 files changed, 14 insertions, 9 deletions
diff --git a/src/preamble.js b/src/preamble.js
index f6aaed14..21e9021e 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -553,7 +553,7 @@ function intArrayFromString(stringy, dontAddNull) {
var chr = stringy.charCodeAt(i);
if (chr > 0xFF) {
#if ASSERTIONS
- assert(false, 'Character code ' + chr + ' (' + stringy[i] + ') not in 0x00-0xFF.');
+ assert(false, 'Character code ' + chr + ' (' + stringy[i] + ') at offset ' + i + ' not in 0x00-0xFF.');
#endif
chr &= 0xFF;
}
@@ -573,7 +573,7 @@ function intArrayToString(array) {
var chr = array[i];
if (chr > 0xFF) {
#if ASSERTIONS
- assert(false, 'Character code ' + chr + ' (' + String.fromCharCode(chr) + ') not in 0x00-0xFF.');
+ assert(false, 'Character code ' + chr + ' (' + String.fromCharCode(chr) + ') at offset ' + i + ' not in 0x00-0xFF.');
#endif
chr &= 0xFF;
}
diff --git a/src/runtime.js b/src/runtime.js
index 730bf2ec..9a6cbc50 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -162,13 +162,18 @@ Runtime = {
// { field1: 0, field2: 4 } (depending on QUANTUM_SIZE)
//
// You can optionally provide a type name as a second parameter. In that
- // case, you do not need to provide the types (but you do still need to
- // provide the names, since they are not present in the .ll), for example,
- // generateStructInfo(['field1', 'field2'], '%struct.UserStructType');
- // (Note that you will need the full %struct.* name here at compile time,
- // but not at runtime. The reason is that during compilation we cannot simplify
- // the type names yet. At runtime, you can provide either the short or the
- // full name.)
+ // case, you do not need to provide the types. If the .ll contains debugging
+ // symbols (i.e. it was compiled with the -g flag), you can leave the struct
+ // parameter entirely empty, for example:
+ // generateStructInfo(null, '%struct.UserStructType');
+ // If the compilation was done without symbols, you will still need to provide
+ // the names, since they are not present in the .ll, for example:
+ // generateStructInfo(['field1', 'field2'], '%struct.UserStructType');
+ //
+ // Note that you will need the full %struct.* name here at compile time,
+ // but not at runtime. The reason is that during compilation we cannot
+ // simplify the type names yet. At runtime, you can provide either the short
+ // or the full name.
//
// When providing a typeName, you can generate information for nested
// structs, for example, struct = ['field1', { field2: ['sub1', 'sub2', 'sub3'] }, 'field3']