Skip to content

Commit 38333b0

Browse files
committed
workaround for the goog.inherits problem
1 parent caeb64b commit 38333b0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/collections.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,16 @@ var $builtinmodule = function (name) {
469469
return false;
470470
}
471471

472+
var Skinherits = function(childCtor, parentCtor) {
473+
/** @constructor */
474+
function tempCtor() {};
475+
tempCtor.prototype = parentCtor.prototype;
476+
childCtor.superClass_ = parentCtor.prototype;
477+
childCtor.prototype = new tempCtor();
478+
/** @override */
479+
childCtor.prototype.constructor = childCtor;
480+
};
481+
472482
mod.namedtuple = function (name, fields) {
473483
if (Sk.ffi.remapToJs(Sk.misceval.callsim(keywds.$d['iskeyword'],name ))) {
474484
throw new Sk.builtin.ValueError("Type names and field names cannot be a keyword: " + name.v);
@@ -514,7 +524,7 @@ var $builtinmodule = function (name) {
514524
};
515525
mod.namedtuples[nm] = cons;
516526

517-
goog.inherits(cons, Sk.builtin.tuple);
527+
Skinherits(cons, Sk.builtin.tuple);
518528
cons.prototype.tp$name = nm;
519529
cons.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj(nm, mod.namedtuples[nm]);
520530
cons.prototype["$r"] = function () {

0 commit comments

Comments
 (0)