Lucian Brănescu-Mihăilă avatar Lucian Brănescu-Mihăilă committed dffcf65

Switch away from find_method usage, this fixes several int tests.

Comments (0)

Files changed (2)

objects/src/int.winxed

 namespace Python {
 
 function int(type, object) {
-    var i = type.__new__(type, 'int', [object]);
+    var f = type.__new__;
+    var i = f(type, 'int', [object]);
 
     i.__new__ = function(cls, int value[optional]) {
         var n = new Python.instance;
 
     i.__add__ = function(obj, other) {
         var result = obj.__value__ + other.__value__;
-        return obj.__new__(obj.__class__, result);
+        var f = obj.__new__;
+        return f(obj.__class__, result);
     };
 
     return i;
 
     function create() {
         var i = intcls();
+        var f = i.__new__;
     
-        self.assert.equal(i.__new__(i, 2).__value__, 2);
+        self.assert.equal(f(i, 2).__value__, 2);
     }
 
     function create_zero() {
         var i = intcls();
+        var f = i.__new__;
 
-        self.assert.equal(i.__new__(i).__value__, 0);
+        self.assert.equal(f(i).__value__, 0);
     }
 
     function create_one() {
         var i = intcls();
 
-        var a = i.__new__(i, 1);
+        var f = i.__new__;
+        var a = f(i, 1);
+
         self.assert.equal(a.__value__, 1);
     }
 
     function repr() {
         var i = intcls();
-        var a = i.__new__(i, 1);
+
+        var f = i.__new__;
+        var a = f(i, 1);
 
         self.assert.equal(a.__repr__(a), '1');
     }
 
     function add() {
         var i = intcls();
-        var a = i.__new__(i, 20); 
-        var b = i.__new__(i, 22);
 
-        var r = i.__add__(a, b);
+        var f = i.__new__;
+        
+        var a = f(i, 20); 
+        var b = f(i, 22);
+
+        var add = i.__add__;
+        var r = add(a, b);
         self.assert.equal(r.__value__, 42);
     }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.