Selaa lähdekoodia

Adds MessageSend class

Nicolas Petton 11 vuotta sitten
vanhempi
commit
8ca3ec5e14
6 muutettua tiedostoa jossa 636 lisäystä ja 0 poistoa
  1. 181 0
      js/Kernel-Methods.deploy.js
  2. 247 0
      js/Kernel-Methods.js
  3. 43 0
      js/Kernel-Tests.deploy.js
  4. 53 0
      js/Kernel-Tests.js
  5. 82 0
      st/Kernel-Methods.st
  6. 30 0
      st/Kernel-Tests.st

+ 181 - 0
js/Kernel-Methods.deploy.js

@@ -850,6 +850,187 @@ messageSends: ["selector:", "new", "arguments:", "yourself"]}),
 smalltalk.Message.klass);
 
 
+smalltalk.addClass('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._arguments();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
+messageSends: ["arguments"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._arguments_(aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
+messageSends: ["arguments:"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@message"]=_st($Message())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
+messageSends: ["initialize", "new"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
+$1=aStream;
+_st($1)._nextPutAll_("(");
+_st($1)._nextPutAll_(_st(self)._receiver());
+_st($1)._nextPutAll_(" >> ");
+_st($1)._nextPutAll_(_st(self)._selector());
+$2=_st($1)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
+messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@receiver"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageSend)})},
+messageSends: []}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@receiver"]=anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageSend)})},
+messageSends: []}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._selector();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
+messageSends: ["selector"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._selector_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
+messageSends: ["selector:"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._sendTo_(_st(self)._receiver());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
+messageSends: ["sendTo:", "receiver"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([anObject]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
+messageSends: ["arguments:", "sendTo:", "receiver"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:",
+fn: function (firstArgument,secondArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
+messageSends: ["arguments:", "sendTo:", "receiver"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:value:",
+fn: function (firstArgument,secondArgument,thirdArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
+messageSends: ["arguments:", "sendTo:", "receiver"]}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithPossibleArguments:",
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self)._arguments_(aCollection);
+$1=_st(self)._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
+messageSends: ["arguments:", "value"]}),
+smalltalk.MessageSend);
+
+
+
 smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
 smalltalk.addMethod(
 smalltalk.method({

+ 247 - 0
js/Kernel-Methods.js

@@ -1154,6 +1154,253 @@ referencedClasses: []
 smalltalk.Message.klass);
 
 
+smalltalk.addClass('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
+smalltalk.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.\x0a"
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._arguments();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
+args: [],
+source: "arguments\x0a\x09^ message arguments",
+messageSends: ["arguments"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+category: 'accessing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._arguments_(aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
+args: ["aCollection"],
+source: "arguments: aCollection\x0a\x09message arguments: aCollection",
+messageSends: ["arguments:"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@message"]=_st($Message())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["Message"]
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+category: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
+$1=aStream;
+_st($1)._nextPutAll_("(");
+_st($1)._nextPutAll_(_st(self)._receiver());
+_st($1)._nextPutAll_(" >> ");
+_st($1)._nextPutAll_(_st(self)._selector());
+$2=_st($1)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@receiver"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageSend)})},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+category: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@receiver"]=anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageSend)})},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09receiver := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._selector();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
+args: [],
+source: "selector\x0a\x09^ message selector",
+messageSends: ["selector"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+category: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._selector_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
+args: ["aString"],
+source: "selector: aString\x0a\x09message selector: aString",
+messageSends: ["selector:"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+category: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._sendTo_(_st(self)._receiver());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
+args: [],
+source: "value\x0a\x09^ message sendTo: self receiver",
+messageSends: ["sendTo:", "receiver"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+category: 'evaluating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([anObject]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
+args: ["anObject"],
+source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:",
+category: 'evaluating',
+fn: function (firstArgument,secondArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
+args: ["firstArgument", "secondArgument"],
+source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:value:",
+category: 'evaluating',
+fn: function (firstArgument,secondArgument,thirdArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
+$3=_st($2)._sendTo_(_st(self)._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
+args: ["firstArgument", "secondArgument", "thirdArgument"],
+source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithPossibleArguments:",
+category: 'evaluating',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self)._arguments_(aCollection);
+$1=_st(self)._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
+args: ["aCollection"],
+source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
+messageSends: ["arguments:", "value"],
+referencedClasses: []
+}),
+smalltalk.MessageSend);
+
+
+
 smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
 smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a\x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js"
 smalltalk.addMethod(

+ 43 - 0
js/Kernel-Tests.deploy.js

@@ -2104,6 +2104,49 @@ smalltalk.JavaScriptExceptionTest);
 
 
 
+smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testValue",
+fn: function (){
+var self=this;
+var messageSend;
+function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
+function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageSend())._new();
+_st($1)._receiver_(_st($Object())._new());
+_st($1)._selector_("asString");
+$2=_st($1)._yourself();
+messageSend=$2;
+_st(self)._assert_equals_(_st(messageSend)._value(),"an Object");
+return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
+messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]}),
+smalltalk.MessageSendTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testValueWithArguments",
+fn: function (){
+var self=this;
+var messageSend;
+function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageSend())._new();
+_st($1)._receiver_((2));
+_st($1)._selector_("+");
+$2=_st($1)._yourself();
+messageSend=$2;
+_st(self)._assert_equals_(_st(messageSend)._value_((3)),(5));
+_st(self)._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
+return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
+messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]}),
+smalltalk.MessageSendTest);
+
+
+
 smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 53 - 0
js/Kernel-Tests.js

@@ -2639,6 +2639,59 @@ smalltalk.JavaScriptExceptionTest);
 
 
 
+smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testValue",
+category: 'tests',
+fn: function (){
+var self=this;
+var messageSend;
+function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
+function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageSend())._new();
+_st($1)._receiver_(_st($Object())._new());
+_st($1)._selector_("asString");
+$2=_st($1)._yourself();
+messageSend=$2;
+_st(self)._assert_equals_(_st(messageSend)._value(),"an Object");
+return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
+args: [],
+source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
+messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
+referencedClasses: ["Object", "MessageSend"]
+}),
+smalltalk.MessageSendTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testValueWithArguments",
+category: 'tests',
+fn: function (){
+var self=this;
+var messageSend;
+function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageSend())._new();
+_st($1)._receiver_((2));
+_st($1)._selector_("+");
+$2=_st($1)._yourself();
+messageSend=$2;
+_st(self)._assert_equals_(_st(messageSend)._value_((3)),(5));
+_st(self)._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
+return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
+args: [],
+source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
+messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
+referencedClasses: ["MessageSend"]
+}),
+smalltalk.MessageSendTest);
+
+
+
 smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 82 - 0
st/Kernel-Methods.st

@@ -415,6 +415,88 @@ selector: aString arguments: anArray
 		yourself
 ! !
 
+Object subclass: #MessageSend
+	instanceVariableNames: 'receiver message'
+	package: 'Kernel-Methods'!
+!MessageSend commentStamp!
+I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. 
+
+Use `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.!
+
+!MessageSend methodsFor: 'accessing'!
+
+arguments
+	^ message arguments
+!
+
+arguments: aCollection
+	message arguments: aCollection
+!
+
+receiver
+	^ receiver
+!
+
+receiver: anObject
+	receiver := anObject
+!
+
+selector
+	^ message selector
+!
+
+selector: aString
+	message selector: aString
+! !
+
+!MessageSend methodsFor: 'evaluating'!
+
+value
+	^ message sendTo: self receiver
+!
+
+value: anObject
+	^ message 
+		arguments: { anObject };
+		sendTo: self receiver
+!
+
+value: firstArgument value: secondArgument
+	^ message 
+		arguments: { firstArgument. secondArgument };
+		sendTo: self receiver
+!
+
+value: firstArgument value: secondArgument value: thirdArgument
+	^ message 
+		arguments: { firstArgument. secondArgument. thirdArgument };
+		sendTo: self receiver
+!
+
+valueWithPossibleArguments: aCollection
+	self arguments: aCollection.
+	^ self value
+! !
+
+!MessageSend methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	message := Message new
+! !
+
+!MessageSend methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream
+		nextPutAll: '(';
+		nextPutAll: self receiver;
+		nextPutAll: ' >> ';
+		nextPutAll: self selector;
+		nextPutAll: ')'
+! !
+
 Object subclass: #MethodContext
 	instanceVariableNames: ''
 	package: 'Kernel-Methods'!

+ 30 - 0
st/Kernel-Tests.st

@@ -992,6 +992,36 @@ testRaisingException
 	self should: [ self throwException ] raise: JavaScriptException
 ! !
 
+TestCase subclass: #MessageSendTest
+	instanceVariableNames: ''
+	package: 'Kernel-Tests'!
+
+!MessageSendTest methodsFor: 'tests'!
+
+testValue
+	| messageSend |
+	
+	messageSend := MessageSend new
+		receiver: Object new;
+		selector: #asString;
+		yourself.
+		
+	self assert: messageSend value equals: 'an Object'
+!
+
+testValueWithArguments
+	| messageSend |
+	
+	messageSend := MessageSend new
+		receiver: 2;
+		selector: '+';
+		yourself.
+		
+	self assert: (messageSend value: 3) equals: 5.
+	
+	self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6
+! !
+
 TestCase subclass: #NumberTest
 	instanceVariableNames: ''
 	package: 'Kernel-Tests'!