Originally at 2011-09-05T23:25:24Z by Göran Krampe closed at 2012-05-08T15:55:45Z
Ok, so this works:
nil ifNil: [1] ifNotNil: [2]
...but not this:
^nil ifNil: [1] ifNotNil: [2]
It says "SyntaxError: Missing catch or finally after try" and the code generated looks like this:
smalltalk.method({ selector: "doIt", source: unescape("doIt%20%5E%5B%5Enil%20ifNil%3A%20%5B1%5D%20ifNotNil%3A%20%5B2%5D%5D%20value"), fn: function(){ var self=this; try{return smalltalk.send((function(){return (function(){throw({name: 'stReturn', selector: '_doIt', fn: function(){return (($receiver = nil) == nil || $receiver == undefined) ? (function(){return (1);})() : (function(){return (2);})()}})})();}), "_value", [])}})})(); return self; } catch(e) {if(e.name === 'stReturn' && e.selector === '_doIt'){return e.fn()} throw(e)}}, messageSends: ["value", "ifNil:ifNotNil:"], referencedClasses: []})
...now, perhaps some nesting wrong? Not sure.
Originally at 2011-09-05T23:25:24Z by Göran Krampe closed at 2012-05-08T15:55:45Z
Ok, so this works:
nil ifNil: [1] ifNotNil: [2]
...but not this:
^nil ifNil: [1] ifNotNil: [2]
It says "SyntaxError: Missing catch or finally after try" and the code generated looks like this:
smalltalk.method({ selector: "doIt", source: unescape("doIt%20%5E%5B%5Enil%20ifNil%3A%20%5B1%5D%20ifNotNil%3A%20%5B2%5D%5D%20value"), fn: function(){ var self=this; try{return smalltalk.send((function(){return (function(){throw({name: 'stReturn', selector: '_doIt', fn: function(){return (($receiver = nil) == nil || $receiver == undefined) ? (function(){return (1);})() : (function(){return (2);})()}})})();}), "_value", [])}})})(); return self; } catch(e) {if(e.name === 'stReturn' && e.selector === '_doIt'){return e.fn()} throw(e)}}, messageSends: ["value", "ifNil:ifNotNil:"], referencedClasses: []})
...now, perhaps some nesting wrong? Not sure.