Skip to content

Commit

Permalink
Merge branch 'num_types' of github.com:blacatena/skulpt into blacaten…
Browse files Browse the repository at this point in the history
…a-num_types
  • Loading branch information
bnmnetp committed Mar 5, 2013
2 parents a836b6a + 340413e commit d3839a8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Sk.builtin.type.makeIntoTypeObj = function(name, t)
t.tp$str = undefined;
t.tp$getattr = Sk.builtin.type.prototype.tp$getattr;
t.tp$setattr = Sk.builtin.object.prototype.GenericSetAttr;
t.tp$richcompare = Sk.builtin.type.prototype.tp$richcompare;
return t;
};

Expand Down Expand Up @@ -348,3 +349,16 @@ Sk.builtin.type.buildMRO = function(klass)
return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(klass));
};

Sk.builtin.type.prototype.tp$richcompare = function(other, op)
{
if (other.ob$type != Sk.builtin.type)
return undefined;

if (!this['$r'] || !other['$r'])
return undefined;

var r1 = this['$r']();
var r2 = other['$r']();

return r1.tp$richcompare(r2, op);
};

0 comments on commit d3839a8

Please sign in to comment.