/*global Module*/
/*global _malloc, _free, _memcpy*/
/*global FUNCTION_TABLE, HEAP32*/
/*global Pointer_stringify, writeStringToMemory*/
/*global __emval_register, _emval_handle_array, __emval_decref*/
/*global ___getDynamicPointerType: false*/
/*global ___dynamicPointerCast: false*/
/*global ___typeName:false*/
/*global ___staticPointerCast: false*/
function exposePublicSymbol(name, value) {
if (Module.hasOwnProperty(name)) {
throw new BindingError("Cannot register public name '" + name + "' twice");
}
Module[name] = value;
}
function createNamedFunction(name, body) {
/*jshint evil:true*/
return new Function(
"body",
"return function " + name + "() {\n" +
" return body.apply(this, arguments);\n" +
"};\n"
)(body);
}
function _embind_repr(v) {
var t = typeof v;
if (t === 'object' || t === 'array' || t === 'function') {
return v.toString();
} else {
return '' + v;
}
}
var typeRegistry = {};
function resolveType(type) {
function createInheritedFunctionOrProperty(baseClassName, name, baseClassPrototype, baseClassType) {
if (!type.Handle.prototype.hasOwnProperty(name)) {
var desc = Object.getOwnPropertyDescriptor(baseClassPrototype, baseClassName);
if (desc) { // some names in the list may not be present in this particular base class
if (baseClassPrototype.constructor.memberType[baseClassName] === 'field') {
var newDescriptor = {
enumerable: true,
get: function() {
var save = this.ptr;
var baseClassPtr = ___staticPointerCast(this.ptr, type.rawType, baseClassType.rawType);
try {
this.ptr = baseClassPtr;
return desc.get();
} finally {
this.ptr = save; // todo: still not good, if the base class routine calls through the current handle
}
},
set: function(v) {
var save = this.ptr;
var baseClassPtr = ___staticPointerCast(this.ptr, type.rawType, baseClassType.rawType);
try {
this