Browse Source

Compile nil receiver as `$nil`.

Herby Vojčík 4 years ago
parent
commit
3f59afc322

+ 2 - 2
lang/src/Compiler-Semantic.js

@@ -1534,7 +1534,7 @@ selector: "asReceiver",
 protocol: "testing",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "asReceiver\x0a\x09#{#self -> '$self'. #super -> '$self'}\x0a\x09\x09at: self name\x0a\x09\x09ifPresent: [ :newName | ^ self copy name: newName; yourself ]\x0a\x09\x09ifAbsent: [ ^ self ]",
+source: "asReceiver\x0a\x09#{#self -> '$self'. #super -> '$self'. #nil -> '$nil'}\x0a\x09\x09at: self name\x0a\x09\x09ifPresent: [ :newName | ^ self copy name: newName; yourself ]\x0a\x09\x09ifAbsent: [ ^ self ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
@@ -1547,7 +1547,7 @@ return $core.withContext(function($ctx1) {
 var $1;
 var $early={};
 try {
-$recv($globals.HashedCollection._newFromPairs_(["self","$self","super","$self"]))._at_ifPresent_ifAbsent_($self._name(),(function(newName){
+$recv($globals.HashedCollection._newFromPairs_(["self","$self","super","$self","nil","$nil"]))._at_ifPresent_ifAbsent_($self._name(),(function(newName){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");

+ 1 - 1
lang/src/Compiler-Semantic.st

@@ -370,7 +370,7 @@ alias
 !PseudoVar methodsFor: 'testing'!
 
 asReceiver
-	#{#self -> '$self'. #super -> '$self'}
+	#{#self -> '$self'. #super -> '$self'. #nil -> '$nil'}
 		at: self name
 		ifPresent: [ :newName | ^ self copy name: newName; yourself ]
 		ifAbsent: [ ^ self ]

+ 1 - 1
lang/src/Kernel-Infrastructure.js

@@ -1701,7 +1701,7 @@ basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return nil._asJavaScriptObject();
+return $nil._asJavaScriptObject();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");

+ 4 - 4
lang/src/Kernel-Tests.js

@@ -16957,7 +16957,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$self._assert_equals_(nil._copy(),nil);
+$self._assert_equals_($nil._copy(),nil);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
@@ -16981,7 +16981,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$self._assert_($recv(nil._deepCopy()).__eq(nil));
+$self._assert_($recv($nil._deepCopy()).__eq(nil));
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{})});
@@ -17064,8 +17064,8 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$self._assert_(nil._isNil());
-$self._deny_(nil._notNil());
+$self._assert_($nil._isNil());
+$self._deny_($nil._notNil());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"testIsNil",{})});