Index: compiled/bindings.ipp |
=================================================================== |
--- a/compiled/bindings.ipp |
+++ b/compiled/bindings.ipp |
@@ -481,60 +481,61 @@ namespace bindings_internal |
return result; |
} |
void printHelpers() |
{ |
printf("var sizeofString = %i;\n", sizeof(String)); |
puts(R"( |
- function copyString(str, buffer) |
- { |
- var length = str.length; |
- for (var i = 0, pointer = (buffer >> 1); i < length; i++, pointer++) |
- HEAP16[pointer] = str.charCodeAt(i); |
- return length; |
- } |
- |
- function createString(str) |
- { |
- var length = 0; |
- var buffer = 0; |
- if (str) |
- { |
- buffer = Runtime.stackAlloc(str.length * 2); |
- length = copyString(str, buffer); |
- } |
+ function copyString(str, buffer) |
+ { |
+ var length = str.length; |
+ for (var i = 0, pointer = (buffer >> 1); i < length; i++, pointer++) |
+ HEAP16[pointer] = str.charCodeAt(i); |
+ return length; |
+ } |
- var result = Module.Runtime.stackAlloc(sizeofString); |
- Module._InitString(result, buffer, length); |
- return result; |
- } |
- |
- function readString(str) |
- { |
- var length = Module._GetStringLength(str); |
- var pointer = Module._GetStringData(str) >> 1; |
- return String.fromCharCode.apply(String, HEAP16.slice(pointer, pointer + length)); |
- } |
+ function createString(str) |
+ { |
+ var length = 0; |
+ var buffer = 0; |
+ if (str) |
+ { |
+ buffer = Runtime.stackAlloc(str.length * 2); |
+ length = copyString(str, buffer); |
+ } |
- function createClass(superclass, ref_counted_offset) |
- { |
- var result = function(pointer) |
- { |
- this._pointer = pointer; |
- }; |
- if (superclass) |
- result.prototype = Object.create(superclass.prototype); |
- result.prototype.delete = function() |
- { |
- Module._ReleaseRef(this._pointer + ref_counted_offset); |
- }; |
- return result; |
- })"); |
+ var result = Runtime.stackAlloc(sizeofString); |
+ Module._InitString(result, buffer, length); |
+ return result; |
+ } |
+ |
+ function readString(str) |
+ { |
+ var length = Module._GetStringLength(str); |
+ var pointer = Module._GetStringData(str) >> 1; |
+ return String.fromCharCode.apply(String, HEAP16.slice(pointer, pointer + length)); |
+ } |
+ |
+ function createClass(superclass, ref_counted_offset) |
+ { |
+ var result = function(pointer) |
+ { |
+ this._pointer = pointer; |
+ }; |
+ if (superclass) |
+ result.prototype = Object.create(superclass.prototype); |
+ result.prototype.delete = function() |
+ { |
+ Module._ReleaseRef(this._pointer + ref_counted_offset); |
+ }; |
+ return result; |
+ } |
+ )"); |
} |
void printClass(const ClassInfo& cls) |
{ |
DifferentiatorInfo differentiator = cls.subclass_differentiator; |
if (differentiator.offset != SIZE_MAX) |
{ |
printf("var %s_mapping = \n", cls.name.c_str()); |