1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009 |
- define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
- var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
- var $pkg = $core.addPackage("Kernel-Exceptions");
- $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
- $core.addClass("Error", $globals.Object, "Kernel-Exceptions");
- $core.setSlots($globals.Error, ["message", "stack", "amberHandled", "context", "smalltalkError"]);
- $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
- $core.addMethod(
- $core.method({
- selector: "basicSignal",
- protocol: "private",
- args: [],
- source: "basicSignal\x0a\x09<inlineJS: 'throw self;'>",
- referencedClasses: [],
- pragmas: [["inlineJS:", ["throw self;"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- throw self;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicSignal",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "beHandled",
- protocol: "accessing",
- args: [],
- source: "beHandled\x0a\x09amberHandled := true",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- $self.amberHandled=true;
- return self;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "beUnhandled",
- protocol: "accessing",
- args: [],
- source: "beUnhandled\x0a\x09amberHandled := false",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- $self.amberHandled=false;
- return self;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: "accessing",
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.context;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- args: ["aMethodContext"],
- source: "context: aMethodContext\x0a\x09context := aMethodContext",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aMethodContext){
- var self=this,$self=this;
- $self.context=aMethodContext;
- return self;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- args: [],
- source: "initialize\x0a\x09self messageText: 'Errorclass: ', self class name.",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["messageText:", ",", "name", "class"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "isError",
- protocol: "testing",
- args: [],
- source: "isError\x0a\x09^ true",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return true;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "jsStack",
- protocol: "accessing",
- args: [],
- source: "jsStack\x0a\x09^ stack",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.stack;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: "accessing",
- args: [],
- source: "messageText\x0a\x09^ message",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.message;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "messageText:",
- protocol: "accessing",
- args: ["aString"],
- source: "messageText: aString\x0a\x09message := aString",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- $self.message=aString;
- return self;
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "outer",
- protocol: "signaling",
- args: [],
- source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["pass"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return $self._pass();
- }, function($ctx1) {$ctx1.fill(self,"outer",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "pass",
- protocol: "signaling",
- args: [],
- source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x0a\x09self beUnhandled; basicSignal",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["beUnhandled", "basicSignal"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- $self._beUnhandled();
- $self._basicSignal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"pass",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "resignal",
- protocol: "signaling",
- args: [],
- source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["deprecatedAPI:", "pass"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- $self._deprecatedAPI_("Use #pass.");
- return $self._pass();
- }, function($ctx1) {$ctx1.fill(self,"resignal",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signal",
- protocol: "signaling",
- args: [],
- source: "signal\x0a\x09self beUnhandled; context: thisContext; basicSignal",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["beUnhandled", "context:", "basicSignal"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- $self._beUnhandled();
- $self._context_($core.getThisContext());
- $self._basicSignal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"signal",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signal:",
- protocol: "signaling",
- args: ["aString"],
- source: "signal: aString\x0a\x09self messageText: aString; signal",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["messageText:", "signal"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- $self._messageText_(aString);
- $self._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signalerContext",
- protocol: "accessing",
- args: [],
- source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["signalerContextFrom:", "context"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return $self._signalerContextFrom_($self._context());
- }, function($ctx1) {$ctx1.fill(self,"signalerContext",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signalerContextFrom:",
- protocol: "accessing",
- args: ["aContext"],
- source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ one receiver == self class ]) not ]",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
- }, function ($methodClass){ return function (aContext){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- return $recv(aContext)._findContextSuchThat_((function(one){
- return $core.withContext(function($ctx2) {
- if($core.assert([$recv([$recv(one)._receiver()
- ,$ctx2.sendIdx["receiver"]=1
- ][0]).__eq_eq(self)
- ,$ctx2.sendIdx["=="]=1
- ][0])){
- $1=true;
- } else {
- $1=$recv($recv(one)._receiver()).__eq_eq($self._class());
- }
- return $recv($1)._not();
- }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
- }));
- }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "wasHandled",
- protocol: "testing",
- args: [],
- source: "wasHandled\x0a\x09^ amberHandled == true",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["=="]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return $recv($self.amberHandled).__eq_eq(true);
- }, function($ctx1) {$ctx1.fill(self,"wasHandled",{})});
- }; }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: "accessing",
- args: [],
- source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return "exception";
- }; }),
- $globals.Error.a$cls);
- $core.addMethod(
- $core.method({
- selector: "messageText:",
- protocol: "instance creation",
- args: ["aString"],
- source: "messageText: aString\x0a\x09^ self new\x0a\x09\x09messageText: aString;\x0a\x09\x09yourself",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["messageText:", "new", "yourself"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$self._new();
- $recv($1)._messageText_(aString);
- return $recv($1)._yourself();
- }, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString})});
- }; }),
- $globals.Error.a$cls);
- $core.addMethod(
- $core.method({
- selector: "signal",
- protocol: "instance creation",
- args: [],
- source: "signal\x0a\x09^ self new signal",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["signal", "new"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return $recv($self._new())._signal();
- }, function($ctx1) {$ctx1.fill(self,"signal",{})});
- }; }),
- $globals.Error.a$cls);
- $core.addMethod(
- $core.method({
- selector: "signal:",
- protocol: "instance creation",
- args: ["aString"],
- source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["signal:", "new"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return $recv($self._new())._signal_(aString);
- }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
- }; }),
- $globals.Error.a$cls);
- $core.addClass("Halt", $globals.Error, "Kernel-Exceptions");
- $globals.Halt.comment="I am provided to support `Object>>#halt`.";
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: "accessing",
- args: [],
- source: "messageText\x0a\x09^ 'Halt encountered'",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return "Halt encountered";
- }; }),
- $globals.Halt);
- $core.addMethod(
- $core.method({
- selector: "signalerContextFrom:",
- protocol: "accessing",
- args: ["aContext"],
- source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ (one receiver == self class) \x0a\x09\x09or: [ one method selector = #halt ]]) not ]",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
- }, function ($methodClass){ return function (aContext){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- return $recv(aContext)._findContextSuchThat_((function(one){
- return $core.withContext(function($ctx2) {
- if($core.assert([$recv([$recv(one)._receiver()
- ,$ctx2.sendIdx["receiver"]=1
- ][0]).__eq_eq(self)
- ,$ctx2.sendIdx["=="]=1
- ][0])){
- $1=true;
- } else {
- if($core.assert($recv($recv(one)._receiver()).__eq_eq($self._class()))){
- $1=true;
- } else {
- $1=$recv($recv($recv(one)._method())._selector()).__eq("halt");
- }
- }
- return $recv($1)._not();
- }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
- }));
- }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
- }; }),
- $globals.Halt);
- $core.addClass("JavaScriptException", $globals.Error, "Kernel-Exceptions");
- $core.setSlots($globals.JavaScriptException, ["exception"]);
- $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
- $core.addMethod(
- $core.method({
- selector: "exception",
- protocol: "accessing",
- args: [],
- source: "exception\x0a\x09^ exception",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.exception;
- }; }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "exception:",
- protocol: "accessing",
- args: ["anException"],
- source: "exception: anException\x0a\x09exception := anException",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anException){
- var self=this,$self=this;
- $self.exception=anException;
- return self;
- }; }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: "accessing",
- args: [],
- source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self.exception.toString()'>",
- referencedClasses: [],
- pragmas: [["inlineJS:", ["return \x22JavaScript exception: \x22 + $self.exception.toString()"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return "JavaScript exception: " + $self.exception.toString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
- }; }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: "instance creation",
- args: ["anException"],
- source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["exception:", "new", "yourself"]
- }, function ($methodClass){ return function (anException){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$self._new();
- $recv($1)._exception_(anException);
- return $recv($1)._yourself();
- }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException})});
- }; }),
- $globals.JavaScriptException.a$cls);
- $core.addMethod(
- $core.method({
- selector: "on:context:",
- protocol: "instance creation",
- args: ["anException", "aMethodContext"],
- source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["exception:", "new", "context:", "yourself"]
- }, function ($methodClass){ return function (anException,aMethodContext){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$self._new();
- $recv($1)._exception_(anException);
- $recv($1)._context_(aMethodContext);
- return $recv($1)._yourself();
- }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext})});
- }; }),
- $globals.JavaScriptException.a$cls);
- $core.addClass("MessageNotUnderstood", $globals.Error, "Kernel-Exceptions");
- $core.setSlots($globals.MessageNotUnderstood, ["smalltalkMessage", "receiver"]);
- $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
- $core.addMethod(
- $core.method({
- selector: "message",
- protocol: "accessing",
- args: [],
- source: "message\x0a\x09^ smalltalkMessage",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.smalltalkMessage;
- }; }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "message:",
- protocol: "accessing",
- args: ["aMessage"],
- source: "message: aMessage\x0a\x09smalltalkMessage := aMessage",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aMessage){
- var self=this,$self=this;
- $self.smalltalkMessage=aMessage;
- return self;
- }; }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: "accessing",
- args: [],
- source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
- referencedClasses: [],
- pragmas: [],
- messageSends: [",", "asString", "receiver", "selector", "message"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return [$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector())
- ,$ctx1.sendIdx[","]=1
- ][0];
- }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
- }; }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: "accessing",
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.receiver;
- }; }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: "accessing",
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.receiver=anObject;
- return self;
- }; }),
- $globals.MessageNotUnderstood);
- $core.addClass("NonBooleanReceiver", $globals.Error, "Kernel-Exceptions");
- $core.setSlots($globals.NonBooleanReceiver, ["object"]);
- $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
- $core.addMethod(
- $core.method({
- selector: "object",
- protocol: "accessing",
- args: [],
- source: "object\x0a\x09^ object",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.object;
- }; }),
- $globals.NonBooleanReceiver);
- $core.addMethod(
- $core.method({
- selector: "object:",
- protocol: "accessing",
- args: ["anObject"],
- source: "object: anObject\x0a\x09object := anObject",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.object=anObject;
- return self;
- }; }),
- $globals.NonBooleanReceiver);
- $core.addMethod(
- $core.method({
- selector: "signalOn:",
- protocol: "instance creation",
- args: ["anObject"],
- source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["object:", "new", "signal"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$self._new();
- $recv($1)._object_(anObject);
- return $recv($1)._signal();
- }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject})});
- }; }),
- $globals.NonBooleanReceiver.a$cls);
- $core.addClass("NonLifoReturn", $globals.Error, "Kernel-Exceptions");
- $core.setSlots($globals.NonLifoReturn, ["value"]);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: "accessing",
- args: [],
- source: "messageText\x0a\x09^ 'Non-LIFO return: ', self value asString",
- referencedClasses: [],
- pragmas: [],
- messageSends: [",", "asString", "value"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return "Non-LIFO return: ".__comma($recv($self._value())._asString());
- }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
- }; }),
- $globals.NonLifoReturn);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: "accessing",
- args: [],
- source: "value\x0a\x09^ value",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.value;
- }; }),
- $globals.NonLifoReturn);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: "accessing",
- args: ["anObject"],
- source: "value: anObject\x0a\x09value := anObject",
- referencedClasses: [],
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.value=anObject;
- return self;
- }; }),
- $globals.NonLifoReturn);
- $core.addMethod(
- $core.method({
- selector: "reifyIfFeasible:",
- protocol: "instance creation",
- args: ["anObject"],
- source: "reifyIfFeasible: anObject\x0a\x09\x22If anObject represents non-local return, reify it as my instance.\x0a\x09Otherwise, return anObject as-is.\x22\x0a\x09<inlineJS: '\x0a\x09\x09return Array.isArray(anObject) && anObject.length === 1 ?\x0a\x09\x09\x09$self._value_(anObject[0]) : anObject\x0a\x09'>",
- referencedClasses: [],
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Array.isArray(anObject) && anObject.length === 1 ?\x0a\x09\x09\x09$self._value_(anObject[0]) : anObject\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- return Array.isArray(anObject) && anObject.length === 1 ?
- $self._value_(anObject[0]) : anObject
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reifyIfFeasible:",{anObject:anObject})});
- }; }),
- $globals.NonLifoReturn.a$cls);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: "instance creation",
- args: ["anObject"],
- source: "value: anObject\x0a\x09^ super new\x0a\x09\x09value: anObject;\x0a\x09\x09yourself",
- referencedClasses: [],
- pragmas: [],
- messageSends: ["value:", "new", "yourself"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=[(
- $ctx1.supercall = true,
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
- ,$ctx1.supercall = false
- ][0];
- $recv($1)._value_(anObject);
- return $recv($1)._yourself();
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
- }; }),
- $globals.NonLifoReturn.a$cls);
- });
|