Ver código fonte

Merge pull request #483 from clementbera/gh-478

fix issue 478
Nicolas Petton 11 anos atrás
pai
commit
cba56b2352
3 arquivos alterados com 45 adições e 0 exclusões
  1. 18 0
      js/Kernel-Objects.deploy.js
  2. 23 0
      js/Kernel-Objects.js
  3. 4 0
      st/Kernel-Objects.st

+ 18 - 0
js/Kernel-Objects.deploy.js

@@ -880,6 +880,24 @@ return $1;
 messageSends: ["ifTrue:ifFalse:", "="]}),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asBit",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self;
+if(smalltalk.assert($2)){
+$1=(1);
+} else {
+$1=(0);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
+messageSends: ["ifTrue:ifFalse:"]}),
+smalltalk.Boolean);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "asJSON",

+ 23 - 0
js/Kernel-Objects.js

@@ -1222,6 +1222,29 @@ referencedClasses: []
 }),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asBit",
+category: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self;
+if(smalltalk.assert($2)){
+$1=(1);
+} else {
+$1=(0);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
+args: [],
+source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
+messageSends: ["ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+smalltalk.Boolean);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "asJSON",

+ 4 - 0
st/Kernel-Objects.st

@@ -471,6 +471,10 @@ or: aBlock
 
 !Boolean methodsFor: 'converting'!
 
+asBit
+	^ self ifTrue: [ 1 ] ifFalse: [ 0 ]
+!
+
 asJSON
 	^self
 !