|
@@ -1865,6 +1865,159 @@ return self;
|
|
|
}; }),
|
|
|
$globals.AbstractJavaScriptGatewayTest);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicSuperDifferentNames",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicSuperDifferentNames\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09self while: 'bar: anObject baz: anotherObject\x0a\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09^ super bar: anObject baz: anotherObject' should: [\x0a\x09\x09self shouldnt: [ receiver bar: 3 baz: 4 ] raise: Error.\x0a\x09\x09self assert: (receiver bar: 4 baz: true) equals: '4,true' ]",
|
|
|
+referencedClasses: ["ObjectMock", "ObjectMock2", "Error"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "while:should:", "shouldnt:raise:", "bar:baz:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+$self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
|
|
|
+$recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
|
|
|
+$1=$recv($globals.ObjectMock2)._new();
|
|
|
+$recv($1)._foo_("should be shadowed");
|
|
|
+$self.receiver=$recv($1)._yourself();
|
|
|
+$self._while_should_("bar: anObject baz: anotherObject\x0a\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09^ super bar: anObject baz: anotherObject",(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$self._shouldnt_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return [$recv($self.receiver)._bar_baz_((3),(4))
|
|
|
+
|
|
|
+,$ctx3.sendIdx["bar:baz:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}),$globals.Error);
|
|
|
+return $self._assert_equals_($recv($self.receiver)._bar_baz_((4),true),"4,true");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicSuperDifferentNames",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractJavaScriptGatewayTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicSuperDifferentNamesNested",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicSuperDifferentNamesNested\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09self while: 'bar: anObject baz: anotherObject\x0a\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09^ [ super bar: anObject baz: anotherObject ] value' should: [\x0a\x09\x09self shouldnt: [ receiver bar: 3 baz: 4 ] raise: Error.\x0a\x09\x09self assert: (receiver bar: 4 baz: true) equals: '4,true' ]",
|
|
|
+referencedClasses: ["ObjectMock", "ObjectMock2", "Error"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "while:should:", "shouldnt:raise:", "bar:baz:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+$self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
|
|
|
+$recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
|
|
|
+$1=$recv($globals.ObjectMock2)._new();
|
|
|
+$recv($1)._foo_("should be shadowed");
|
|
|
+$self.receiver=$recv($1)._yourself();
|
|
|
+$self._while_should_("bar: anObject baz: anotherObject\x0a\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09^ [ super bar: anObject baz: anotherObject ] value",(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$self._shouldnt_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return [$recv($self.receiver)._bar_baz_((3),(4))
|
|
|
+
|
|
|
+,$ctx3.sendIdx["bar:baz:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}),$globals.Error);
|
|
|
+return $self._assert_equals_($recv($self.receiver)._bar_baz_((4),true),"4,true");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicSuperDifferentNamesNested",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractJavaScriptGatewayTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testMonadicSuperDifferentNames",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testMonadicSuperDifferentNames\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09self while: 'bar: anObject <jsOverride: #foo args: #(anObject)> ^ super bar: anObject' should: [\x0a\x09\x09self shouldnt: [ receiver bar: 3 ] raise: Error.\x0a\x09\x09self assert: (receiver bar: 4) equals: '4,undefined' ]",
|
|
|
+referencedClasses: ["ObjectMock", "ObjectMock2", "Error"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "while:should:", "shouldnt:raise:", "bar:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+$self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
|
|
|
+$recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
|
|
|
+$1=$recv($globals.ObjectMock2)._new();
|
|
|
+$recv($1)._foo_("should be shadowed");
|
|
|
+$self.receiver=$recv($1)._yourself();
|
|
|
+$self._while_should_("bar: anObject <jsOverride: #foo args: #(anObject)> ^ super bar: anObject",(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$self._shouldnt_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return [$recv($self.receiver)._bar_((3))
|
|
|
+
|
|
|
+,$ctx3.sendIdx["bar:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}),$globals.Error);
|
|
|
+return $self._assert_equals_($recv($self.receiver)._bar_((4)),"4,undefined");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMonadicSuperDifferentNames",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractJavaScriptGatewayTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testNiladicSuper",
|
|
@@ -2462,6 +2615,205 @@ return self;
|
|
|
}; }),
|
|
|
$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicJSOverrideArgMismatch",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicJSOverrideArgMismatch\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherNumber)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(aNumber anotherInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anotherNumber anInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+[$self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherNumber)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError)
|
|
|
+
|
|
|
+,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(aNumber anotherInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError)
|
|
|
+
|
|
|
+,$ctx1.sendIdx["shouldntInstall:andRaise:"]=2
|
|
|
+
|
|
|
+][0];
|
|
|
+$self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anotherNumber anInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideArgMismatch",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicJSOverrideInOneArg",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicJSOverrideInOneArg\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+[$self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError)
|
|
|
+
|
|
|
+,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+$self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideInOneArg",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicJSOverrideInUnary",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicJSOverrideInUnary\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux <jsOverride: #mux args: #(anInteger anotherInteger)> ^ (foo := foo + 3)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$self._shouldntInstall_andRaise_("quux <jsOverride: #mux args: #(anInteger anotherInteger)> ^ (foo := foo + 3)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideInUnary",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicJSOverrideRepeatedArgs",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicJSOverrideRepeatedArgs\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+[$self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError)
|
|
|
+
|
|
|
+,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+$self._shouldntInstall_andRaise_("quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideRepeatedArgs",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testDyadicSOverrideDifferentNames",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testDyadicSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 and: -1 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(2 -2)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 1 foo: 4) equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
|
|
|
+referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:and:", "assert:equals:", "basicPerform:withArguments:", "quux:foo:", "basicPerform:", "foo"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$recv($self.receiver)._foo_((4));
|
|
|
+$self._while_should_("quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)",(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+[$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._mux();
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}),$globals.MessageNotUnderstood)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["should:raise:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._mux_and_((2),(-1));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
|
|
|
+
|
|
|
+}),$globals.MessageNotUnderstood)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["should:raise:"]=2
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(2), (-2)]),(6))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._assert_equals_($recv($self.receiver)._quux_foo_((1),(4)),(10))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=2
|
|
|
+
|
|
|
+][0];
|
|
|
+$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._basicPerform_("quux");
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
|
|
|
+
|
|
|
+}),$globals.Error);
|
|
|
+return $self._assert_equals_($recv($self.receiver)._foo(),(10));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testDyadicSOverrideDifferentNames",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testInvalidAssignment",
|
|
@@ -2525,6 +2877,135 @@ return self;
|
|
|
}; }),
|
|
|
$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testMonadicJSOverrideArgMismatch",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testMonadicJSOverrideArgMismatch\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + aNumber)'\x0a\x09\x09andRaise: CompilerError\x0a",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$self._shouldntInstall_andRaise_("quux: aNumber <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + aNumber)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideArgMismatch",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testMonadicJSOverrideDifferentNames",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testMonadicJSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + anInteger)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(2)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 4) equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
|
|
|
+referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:", "assert:equals:", "basicPerform:withArguments:", "quux:", "basicPerform:", "foo"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$recv($self.receiver)._foo_((4));
|
|
|
+$self._while_should_("quux: anInteger <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + anInteger)",(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+[$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._mux();
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}),$globals.MessageNotUnderstood)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["should:raise:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._mux_((2));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
|
|
|
+
|
|
|
+}),$globals.MessageNotUnderstood)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["should:raise:"]=2
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(2)]),(6))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+[$self._assert_equals_($recv($self.receiver)._quux_((4)),(10))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=2
|
|
|
+
|
|
|
+][0];
|
|
|
+$self._should_raise_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self.receiver)._basicPerform_("quux");
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
|
|
|
+
|
|
|
+}),$globals.Error);
|
|
|
+return $self._assert_equals_($recv($self.receiver)._foo(),(10));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideDifferentNames",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testMonadicJSOverrideInUnary",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testMonadicJSOverrideInUnary\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + 3)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$self._shouldntInstall_andRaise_("quux <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + 3)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideInUnary",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testNiladicJSOverride",
|
|
@@ -2648,6 +3129,31 @@ return self;
|
|
|
}; }),
|
|
|
$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testNiladicJSOverrideInOneArg",
|
|
|
+protocol: "tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testNiladicJSOverrideInOneArg\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger <jsOverride: #mux> ^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError",
|
|
|
+referencedClasses: ["ObjectMock", "CompilerError"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["new", "shouldntInstall:andRaise:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self.receiver=$recv($globals.ObjectMock)._new();
|
|
|
+$self._shouldntInstall_andRaise_("quux: anInteger <jsOverride: #mux> ^ (foo := foo + anInteger)",$globals.CompilerError);
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverrideInOneArg",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testPragmaInBlock",
|
|
@@ -4180,14 +4686,14 @@ $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCT
|
|
|
$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.CodeGeneratorTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InliningCodeGeneratorTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TClassBuildingTest}], $globals.AbstractJavaScriptGatewayTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.DebuggedJSGTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InlinedJSGTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.InterpretedJSGTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.PlainJSGTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPCNodeVisitorTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPositionTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.AbstractCodeGeneratorInstallTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TCTNonInlined}], $globals.CodeGeneratorInstallTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TCTInlined}], $globals.InliningCodeGeneratorInstallTest);
|
|
|
-$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.InterpretedJSGTest);
|
|
|
-$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.DebuggedJSGTest);
|
|
|
|
|
|
});
|