Browse Source

Implemented Point >> =

Bernat Romagosa 12 years ago
parent
commit
c2b6b08eeb
3 changed files with 31 additions and 0 deletions
  1. 11 0
      js/Kernel.deploy.js
  2. 16 0
      js/Kernel.js
  3. 4 0
      st/Kernel.st

+ 11 - 0
js/Kernel.deploy.js

@@ -5609,6 +5609,17 @@ return self;}
 }),
 smalltalk.Point);
 
+smalltalk.addMethod(
+'__eq',
+smalltalk.method({
+selector: '=',
+fn: function (aPoint){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_x", []), "__eq", [smalltalk.send(self, "_x", [])]), "_&", [smalltalk.send(smalltalk.send(aPoint, "_y", []), "__eq", [smalltalk.send(self, "_y", [])])]);
+return self;}
+}),
+smalltalk.Point);
+
 
 smalltalk.addMethod(
 '_x_y_',

+ 16 - 0
js/Kernel.js

@@ -7991,6 +7991,22 @@ referencedClasses: []
 }),
 smalltalk.Point);
 
+smalltalk.addMethod(
+unescape('__eq'),
+smalltalk.method({
+selector: unescape('%3D'),
+category: 'arithmetic',
+fn: function (aPoint){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_x", []), "__eq", [smalltalk.send(self, "_x", [])]), "_&", [smalltalk.send(smalltalk.send(aPoint, "_y", []), "__eq", [smalltalk.send(self, "_y", [])])]);
+return self;},
+args: ["aPoint"],
+source: unescape('%3D%20aPoint%0A%09%5E%20%28aPoint%20x%20%3D%20self%20x%29%20%26%20%28aPoint%20y%20%3D%20self%20y%29'),
+messageSends: [unescape("%26"), unescape("%3D"), "x", "y"],
+referencedClasses: []
+}),
+smalltalk.Point);
+
 
 smalltalk.addMethod(
 unescape('_x_y_'),

+ 4 - 0
st/Kernel.st

@@ -2778,6 +2778,10 @@ x: aNumber
 
 / aPoint
 	^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y
+!
+
+= aPoint
+	^ (aPoint x = self x) & (aPoint y = self y)
 ! !
 
 !Point methodsFor: 'converting'!