function add(disposable, layer) { if (verify.enabled) { var Disposable = scope.Disposable; a && ert(disposable instanceof Disposable); } var currentLayer = layer || (layers.length ? layers[layers.length - 1] : null); if (currentLayer) { currentLayer.add(disposable); } }
makeName(prefix) { a&&ert(_.isString(prefix)); let i = this._store[prefix] === undefined ? -1 : this._store[prefix]; this._store[prefix] = ++i; return prefix + String(i); }
findFastcallFunc(api, prefix, type) { const name = prefix + (type.indirection > 1 || type.code === 'p' ? 'Pointer' : this.toFastcallName(type.name)); const func = api[name]; a&&ert(_.isFunction(func), `Unknown API '${ name }' for function '${ this }'.`); return { name, type, func }; }
function Parser(library) { _classCallCheck(this, Parser); a && ert(library); this.library = library; this.functionParser = new FunctionParser(this); this.refTypeParser = new RefTypeParser(this); this.multilineParser = new MultilineParser(this); }
initialize() { assert(!this._released, `Library "${ this.path }" has already been released.`); if (this._initialized) { return; } this._pLib = native.dynload.loadLibrary(this.path); this._loop = native.callback.newLoop(); if (this.options.syncMode === defs.syncMode.lock) { this._mutex = native.mutex.newMutex(); a&&ert(this._mutex instanceof Buffer); } this._initialized = true; return this; }
constructor(library) { a&&ert(library); this.library = library; this.functionParser = new FunctionParser(this); this.refTypeParser = new RefTypeParser(this); this.multilineParser = new MultilineParser(this); }
function getPointerArgIndices(func) { const indices = []; if (func.function) { const args = func.function.args; a&&ert(_.isArray(args)); for (let i = 0; i < args.length; i++) { const arg = args[i]; a&&ert(_.isObject(arg.type)); if (arg.type.indirection > 1) { indices.push(i); } } } return indices; }
_resolveStringTypes(defObj) { a&&ert(_.isObject(defObj)); const result = {}; _.each(defObj, (value, key) => { let type = defObj[key]; if (_.isString(type)) { type = this._resolveStringType(type); } result[key] = type; }); return result; }
function () { function NameFactory() { _classCallCheck(this, NameFactory); this._store = {}; } _createClass(NameFactory, [{ key: 'makeName', value: function makeName(prefix) { a && ert(_.isString(prefix)); var i = this._store[prefix] === undefined ? -1 : this._store[prefix]; this._store[prefix] = ++i; return prefix + String(i); } }]); return NameFactory; }()
constructor(library, propertyName, def) { a&&ert(_.isObject(library), 'Argument "library" is not an object.'); a&&ert(_.isString(propertyName), 'Argument "propertyName" is not a string.'); this.library = library; this.propertyName = propertyName; const parser = new Parser(library); const parsed = parser.parseRefType(def, propertyName); a&&ert(_.isObject(parsed)); a&&ert(parsed.body); a&&ert(_.isFunction(parsed.factoryType)); a&&ert(parsed.type); a&&ert(_.isString(parsed.name) && parsed.name.length); this.name = parsed.name; this._body = parsed.body; this._factoryType = parsed.factoryType; this._type = parsed.type; this._type[this.propertyName] = this; }
constructor(parser) { a&&ert(parser); this.parser = parser; }
function add(disposable, layer) { if (verify.enabled) { const Disposable = scope.Disposable; a&&ert(disposable instanceof Disposable); } const currentLayer = layer || (layers.length ? layers[layers.length - 1] : null); if (currentLayer) { currentLayer.add(disposable); } }
constructor(parser) { a&&ert(parser); this.parser = parser; }
constructor(parser) { a&&ert(parser); this.parser = parser; }