Herby Vojčík il y a 3 ans
Parent
commit
9a7bd82ab9

+ 9 - 1
cli/src/AmberCli.js

@@ -853,6 +853,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(stream)._writable())){
 return $recv(stream)._end();
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
@@ -1640,7 +1642,9 @@ $recv($self.fs)._stat_then_([$self._basePath()
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if(err == null || err.a$nil){
-if(!$core.assert($recv(stat)._isDirectory())){
+if($core.assert($recv(stat)._isDirectory())){
+return nil;
+} else {
 return [$recv(console)._warn_([$recv(["Warning: --base-path parameter ".__comma([$self._basePath()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx2.sendIdx["basePath"]=2
@@ -2000,6 +2004,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(each).__eq("--help"))){
 return $recv($globals.FileServer)._printHelp();
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -2802,6 +2808,8 @@ return $core.withContext(function($ctx2) {
 if($core.assert($recv(names)._includes_(aString))){
 $recv(cmd)._value();
 throw $early=[true];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});

+ 2 - 0
lang/src/Compiler-Core.js

@@ -1057,6 +1057,8 @@ return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
 if($core.assert($recv($recv(each)._origin()).__eq(eachSide))){
 return $self._install_forClass_protocol_($recv(each)._source(),eachSide,$recv(each)._protocol());
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});

+ 4 - 0
lang/src/Kernel-Classes.js

@@ -1720,6 +1720,8 @@ return [$recv([$recv($globals.Compiler)._new()
 ,$ctx2.sendIdx["install:forClass:protocol:"]=1
 //>>excludeEnd("ctx");
 ][0];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1765,6 +1767,8 @@ return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(
 ,$ctx2.sendIdx["class"]=5
 //>>excludeEnd("ctx");
 ][0],$recv(each)._protocol());
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});

+ 39 - 5
lang/src/Kernel-Collections.js

@@ -516,7 +516,9 @@ $self._do_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv(aBlock)._value_(each))){
+if($core.assert($recv(aBlock)._value_(each))){
+return nil;
+} else {
 throw $early=[false];
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -596,6 +598,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(each))){
 throw $early=[true];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -965,6 +969,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(each))){
 throw $early=[each];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1275,6 +1281,8 @@ $1=false;
 }
 if($core.assert($1)){
 return $recv(outputSet)._add_(each);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1334,6 +1342,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(item))){
 throw $early=[false];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
@@ -1396,6 +1406,8 @@ return $core.withContext(function($ctx2) {
 if($core.assert($recv(anObject).__eq(each))){
 tally=$recv(tally).__plus((1));
 return tally;
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1574,6 +1586,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(each))){
 return $recv(stream)._nextPut_(each);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1614,6 +1628,8 @@ if($core.assert([$recv(selectBlock)._value_(each)
 //>>excludeEnd("ctx");
 ][0])){
 return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -2749,6 +2765,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(value))){
 return $recv(newDict)._at_put_(key,value);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
@@ -2789,6 +2807,8 @@ if($core.assert([$recv(selectBlock)._value_(value)
 //>>excludeEnd("ctx");
 ][0])){
 return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
@@ -3823,7 +3843,9 @@ $self._withIndexDo_((function(each,i){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
+if($core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
+return nil;
+} else {
 throw $early=[false];
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -6734,6 +6756,8 @@ return $core.withContext(function($ctx2) {
 lineCount=$recv(lineCount).__plus((1));
 if($core.assert($recv(lineCount).__eq(anIndex))){
 throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
@@ -8392,6 +8416,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(aBlock)._value_(each))){
 return $recv(collection)._add_(each);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -8432,6 +8458,8 @@ if($core.assert([$recv(selectBlock)._value_(each)
 //>>excludeEnd("ctx");
 ][0])){
 return $recv(collection)._add_($recv(collectBlock)._value_(each));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -9119,7 +9147,9 @@ $recv(anInteger)._timesRepeat_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($self._atEnd())){
+if($core.assert($self._atEnd())){
+return nil;
+} else {
 return $recv(tempCollection)._add_($self._next());
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -9183,7 +9213,9 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-if(!$core.assert($self._atEnd())){
+if($core.assert($self._atEnd())){
+return nil;
+} else {
 return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -9541,7 +9573,9 @@ $recv(anInteger)._timesRepeat_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($self._atEnd())){
+if($core.assert($self._atEnd())){
+return nil;
+} else {
 tempCollection=$recv(tempCollection).__comma($self._next());
 return tempCollection;
 }

+ 9 - 3
lang/src/Kernel-Infrastructure.js

@@ -2387,11 +2387,13 @@ $recv(aCollection)._do_((function(import_){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert([$recv(import_)._isString()
+if($core.assert([$recv(import_)._isString()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx2.sendIdx["isString"]=1
 //>>excludeEnd("ctx");
 ][0])){
+return nil;
+} else {
 if(!$core.assert($recv(import_)._respondsTo_("key"))){
 [$self._error_("Imports must be Strings or Associations")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -2414,7 +2416,9 @@ if(!$core.assert($recv([$recv([$recv(import_)._key()
 //>>excludeEnd("ctx");
 ][0];
 }
-if(!$core.assert($recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$"))){
+if($core.assert($recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$"))){
+return nil;
+} else {
 return $self._error_("Keys must be identifiers");
 }
 }
@@ -3770,7 +3774,9 @@ $recv(classes)._do_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv(each).__eq($self._class()))){
+if($core.assert($recv(each).__eq($self._class()))){
+return nil;
+} else {
 return $recv(each)._initialize();
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);

+ 5 - 1
lang/src/Kernel-Methods.js

@@ -1187,6 +1187,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(each)._includesSelector_($self.selector))){
 throw $early=[true];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
@@ -1735,7 +1737,9 @@ block=$recv($self.queue)._nextIfAbsent_((function(){
 return sentinel;
 
 }));
-if(!$core.assert($recv(block).__eq_eq(sentinel))){
+if($core.assert($recv(block).__eq_eq(sentinel))){
+return nil;
+} else {
 return $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {

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

@@ -1353,13 +1353,17 @@ return $core.withContext(function($ctx1) {
 var $1,$2,$3,$4,$5,$6,$7,$8;
 if($core.assert(true)){
 $1="alternative block";
+} else {
+$1=nil;
 }
 [$self._assert_equals_($1,"alternative block")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["assert:equals:"]=1
 //>>excludeEnd("ctx");
 ][0];
-if(!$core.assert(true)){
+if($core.assert(true)){
+$2=nil;
+} else {
 $2="alternative block";
 }
 [$self._assert_equals_($2,nil)
@@ -1369,13 +1373,17 @@ $2="alternative block";
 ][0];
 if($core.assert(false)){
 $3="alternative block";
+} else {
+$3=nil;
 }
 [$self._assert_equals_($3,nil)
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["assert:equals:"]=3
 //>>excludeEnd("ctx");
 ][0];
-if(!$core.assert(false)){
+if($core.assert(false)){
+$4=nil;
+} else {
 $4="alternative block";
 }
 [$self._assert_equals_($4,"alternative block")
@@ -1449,17 +1457,21 @@ if($core.assert([true._yourself()
 //>>excludeEnd("ctx");
 ][0])){
 $1="alternative block";
+} else {
+$1=nil;
 }
 [$self._assert_equals_($1,"alternative block")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["assert:equals:"]=1
 //>>excludeEnd("ctx");
 ][0];
-if(!$core.assert([true._yourself()
+if($core.assert([true._yourself()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["yourself"]=2
 //>>excludeEnd("ctx");
 ][0])){
+$2=nil;
+} else {
 $2="alternative block";
 }
 [$self._assert_equals_($2,nil)
@@ -1473,17 +1485,21 @@ if($core.assert([false._yourself()
 //>>excludeEnd("ctx");
 ][0])){
 $3="alternative block";
+} else {
+$3=nil;
 }
 [$self._assert_equals_($3,nil)
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["assert:equals:"]=3
 //>>excludeEnd("ctx");
 ][0];
-if(!$core.assert([false._yourself()
+if($core.assert([false._yourself()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["yourself"]=4
 //>>excludeEnd("ctx");
 ][0])){
+$4=nil;
+} else {
 $4="alternative block";
 }
 [$self._assert_equals_($4,"alternative block")

+ 11 - 1
lang/src/Platform-ImportExport.js

@@ -110,6 +110,8 @@ return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
 if($core.assert($recv($recv(behavior)._protocols())._includes_(extensionName))){
 return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
@@ -924,6 +926,8 @@ return $core.withContext(function($ctx4) {
 //>>excludeEnd("ctx");
 if($core.assert($recv(category).__eq("*".__comma(name)))){
 return $recv(map)._at_put_(category,methods);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
@@ -983,7 +987,9 @@ $recv(aClass)._protocolsDo_((function(each,methods){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv(each)._match_("^\x5c*"))){
+if($core.assert($recv(each)._match_("^\x5c*"))){
+return nil;
+} else {
 return $recv(map)._at_put_(each,methods);
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -2925,6 +2931,8 @@ result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
 if($core.assert(lastEmpty)){
 lastEmpty=false;
 return $recv(result)._scanFrom_(parser);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
@@ -3039,6 +3047,8 @@ $1=$recv($recv(xhr)._status()).__lt((300));
 $1=false;
 }
 return $recv($1)._ifTrue_ifFalse_(aBlock,anotherBlock);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});

+ 6 - 0
lang/src/SUnit-Tests.js

@@ -1589,6 +1589,8 @@ return $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),$r
 }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
 //>>excludeEnd("ctx");
 }));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({ann:ann},$ctx2,3)});
@@ -1711,6 +1713,8 @@ return $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["
 }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
 //>>excludeEnd("ctx");
 }));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({ann:ann},$ctx2,3)});
@@ -1797,6 +1801,8 @@ return $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["
 }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
 //>>excludeEnd("ctx");
 }));
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({ann:ann},$ctx2,3)});

+ 19 - 3
lang/src/SUnit.js

@@ -372,6 +372,8 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 if($core.assert($self._isAsync())){
 return $recv(c)._execute_(aBlock);
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
@@ -1135,6 +1137,8 @@ return $recv($recv($globals.Smalltalk)._asSmalltalkException_(error))._pass();
 ,$ctx3.sendIdx["execute:"]=1
 //>>excludeEnd("ctx");
 ][0];
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,9)});
@@ -1143,7 +1147,9 @@ return $recv($recv($globals.Smalltalk)._asSmalltalkException_(error))._pass();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-if(!$core.assert(failed)){
+if($core.assert(failed)){
+return nil;
+} else {
 if($core.assert($recv($self.testCase)._isAsync())){
 return $self._execute_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -1154,12 +1160,16 @@ return $recv($self.testCase)._finished();
 }, function($ctx4) {$ctx4.fillBlock({},$ctx3,15)});
 //>>excludeEnd("ctx");
 }));
+} else {
+return nil;
 }
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,12)});
 //>>excludeEnd("ctx");
 }));
+} else {
+return nil;
 }
 } else {
 return $recv($self.testCase)._tearDown();
@@ -1304,7 +1314,9 @@ $ctx3.supercall = true,
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv($self.testCase)._isAsync())){
+if($core.assert($recv($self.testCase)._isAsync())){
+return nil;
+} else {
 $recv($self.result)._increaseRuns();
 return $recv($self.finished)._value();
 }
@@ -1651,11 +1663,13 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-if(!$core.assert($recv([$self._runs()
+if($core.assert($recv([$self._runs()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 ,$ctx1.sendIdx["runs"]=1
 //>>excludeEnd("ctx");
 ][0]).__eq_eq($self._total()))){
+return nil;
+} else {
 return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -1937,6 +1951,8 @@ return $core.withContext(function($ctx2) {
 runs=$recv($self.result)._runs();
 if($core.assert($recv(runs).__lt($recv($self.result)._total()))){
 return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
+} else {
+return nil;
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});