|
@@ -2550,35 +2550,14 @@ define('amber/kernel-runtime',['./junk-drawer'], function ($goodies) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- Runs worker function so that error handler is not set up
|
|
|
|
- if there isn't one. This is accomplished by unconditional
|
|
|
|
- wrapping inside a context of a simulated `nil seamlessDoIt` call,
|
|
|
|
- which then stops error handler setup (see st.withContext above).
|
|
|
|
- The effect is, $core.seamless(fn)'s exceptions are not
|
|
|
|
- handed into ST error handler and caller should process them.
|
|
|
|
- */
|
|
|
|
|
|
+ // TODO deprecated, remove
|
|
st.seamless = function (worker) {
|
|
st.seamless = function (worker) {
|
|
- var oldContext = thisContext;
|
|
|
|
- thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
|
|
|
|
- ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
|
|
|
|
- });
|
|
|
|
- var result = oldContext == null ? resultWithNoErrorHandling(worker) : worker(thisContext);
|
|
|
|
- thisContext = oldContext;
|
|
|
|
- return result;
|
|
|
|
|
|
+ return worker();
|
|
|
|
+ // return st.withContext(worker, new SmalltalkMethodContext(thisContext, function (ctx) {
|
|
|
|
+ // ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
|
|
|
|
+ // }));
|
|
};
|
|
};
|
|
|
|
|
|
- function resultWithErrorHandling (worker) {
|
|
|
|
- try {
|
|
|
|
- return worker(thisContext);
|
|
|
|
- } catch (error) {
|
|
|
|
- globals.ErrorHandler._handleError_(error);
|
|
|
|
- thisContext = null;
|
|
|
|
- // Rethrow the error in any case.
|
|
|
|
- throw error;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
Standard way to run within context.
|
|
Standard way to run within context.
|
|
Sets up error handler if entering first ST context in a stack.
|
|
Sets up error handler if entering first ST context in a stack.
|
|
@@ -2586,7 +2565,7 @@ define('amber/kernel-runtime',['./junk-drawer'], function ($goodies) {
|
|
st.withContext = function (worker, setup) {
|
|
st.withContext = function (worker, setup) {
|
|
var oldContext = thisContext;
|
|
var oldContext = thisContext;
|
|
thisContext = new SmalltalkMethodContext(thisContext, setup);
|
|
thisContext = new SmalltalkMethodContext(thisContext, setup);
|
|
- var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
|
|
|
|
|
|
+ var result = oldContext == null ? resultWithNoErrorHandling(worker) : worker(thisContext);
|
|
thisContext = oldContext;
|
|
thisContext = oldContext;
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
@@ -2595,9 +2574,7 @@ define('amber/kernel-runtime',['./junk-drawer'], function ($goodies) {
|
|
|
|
|
|
st.getThisContext = function () {
|
|
st.getThisContext = function () {
|
|
if (!thisContext) return null;
|
|
if (!thisContext) return null;
|
|
- for (var frame = thisContext; frame; frame = frame.outerContext || frame.homeContext) {
|
|
|
|
- frame.setup(frame);
|
|
|
|
- }
|
|
|
|
|
|
+ thisContext.setup(thisContext);
|
|
return thisContext;
|
|
return thisContext;
|
|
};
|
|
};
|
|
}
|
|
}
|
|
@@ -20990,14 +20967,41 @@ $core.method({
|
|
selector: "home",
|
|
selector: "home",
|
|
protocol: "accessing",
|
|
protocol: "accessing",
|
|
args: [],
|
|
args: [],
|
|
-source: "home\x0a\x09^ homeContext",
|
|
|
|
|
|
+source: "home\x0a\x09^ homeContext ifNotNil: [ :c | c hydrated ]",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
pragmas: [],
|
|
pragmas: [],
|
|
-messageSends: []
|
|
|
|
|
|
+messageSends: ["ifNotNil:", "hydrated"]
|
|
}, function ($methodClass){ return function (){
|
|
}, function ($methodClass){ return function (){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
-return $self.homeContext;
|
|
|
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
|
+var $1;
|
|
|
|
+$1=$self.homeContext;
|
|
|
|
+if($1 == null || $1.a$nil){
|
|
|
|
+return $1;
|
|
|
|
+} else {
|
|
|
|
+var c;
|
|
|
|
+c=$1;
|
|
|
|
+return $recv(c)._hydrated();
|
|
|
|
+}
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"home",{})});
|
|
|
|
+}; }),
|
|
|
|
+$globals.MethodContext);
|
|
|
|
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "hydrated",
|
|
|
|
+protocol: "accessing",
|
|
|
|
+args: [],
|
|
|
|
+source: "hydrated\x0a\x09<inlineJS: 'if (!$self.selector && !$self.outerContext) $self.setup(self); return self;'>",
|
|
|
|
+referencedClasses: [],
|
|
|
|
+pragmas: [["inlineJS:", ["if (!$self.selector && !$self.outerContext) $self.setup(self); return self;"]]],
|
|
|
|
+messageSends: []
|
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
|
+var self=this,$self=this;
|
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
|
+if (!$self.selector && !$self.outerContext) $self.setup(self); return self;;
|
|
|
|
+return self;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"hydrated",{})});
|
|
}; }),
|
|
}; }),
|
|
$globals.MethodContext);
|
|
$globals.MethodContext);
|
|
|
|
|
|
@@ -21045,10 +21049,10 @@ $core.method({
|
|
selector: "outerContext",
|
|
selector: "outerContext",
|
|
protocol: "accessing",
|
|
protocol: "accessing",
|
|
args: [],
|
|
args: [],
|
|
-source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ]",
|
|
|
|
|
|
+source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ] ifNotNil: [ :c | c hydrated ]",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
pragmas: [],
|
|
pragmas: [],
|
|
-messageSends: ["ifNil:", "home"]
|
|
|
|
|
|
+messageSends: ["ifNil:ifNotNil:", "home", "hydrated"]
|
|
}, function ($methodClass){ return function (){
|
|
}, function ($methodClass){ return function (){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
@@ -21057,7 +21061,9 @@ $1=$self.outerContext;
|
|
if($1 == null || $1.a$nil){
|
|
if($1 == null || $1.a$nil){
|
|
return $self._home();
|
|
return $self._home();
|
|
} else {
|
|
} else {
|
|
-return $1;
|
|
|
|
|
|
+var c;
|
|
|
|
+c=$1;
|
|
|
|
+return $recv(c)._hydrated();
|
|
}
|
|
}
|
|
}, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
|
|
}, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
|
|
}; }),
|
|
}; }),
|
|
@@ -22793,16 +22799,14 @@ $core.method({
|
|
selector: "catch:",
|
|
selector: "catch:",
|
|
protocol: "promises",
|
|
protocol: "promises",
|
|
args: ["aBlock"],
|
|
args: ["aBlock"],
|
|
-source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
|
|
|
|
|
|
+source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) { return aBlock._value_(err); })'>",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
-pragmas: [["inlineJS:", ["return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})"]]],
|
|
|
|
|
|
+pragmas: [["inlineJS:", ["return self.then(null, function (err) { return aBlock._value_(err); })"]]],
|
|
messageSends: []
|
|
messageSends: []
|
|
}, function ($methodClass){ return function (aBlock){
|
|
}, function ($methodClass){ return function (aBlock){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
-return self.then(null, function (err) {return $core.seamless(function () {
|
|
|
|
- return aBlock._value_(err);
|
|
|
|
-})});
|
|
|
|
|
|
+return self.then(null, function (err) { return aBlock._value_(err); });
|
|
return self;
|
|
return self;
|
|
}, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
|
|
}, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
|
|
}; }),
|
|
}; }),
|
|
@@ -22813,17 +22817,17 @@ $core.method({
|
|
selector: "on:do:",
|
|
selector: "on:do:",
|
|
protocol: "promises",
|
|
protocol: "promises",
|
|
args: ["aClass", "aBlock"],
|
|
args: ["aClass", "aBlock"],
|
|
-source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
|
|
|
|
|
|
+source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})'>",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
-pragmas: [["inlineJS:", ["return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})"]]],
|
|
|
|
|
|
+pragmas: [["inlineJS:", ["return self.then(null, function (err) {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})"]]],
|
|
messageSends: []
|
|
messageSends: []
|
|
}, function ($methodClass){ return function (aClass,aBlock){
|
|
}, function ($methodClass){ return function (aClass,aBlock){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
-return self.then(null, function (err) {return $core.seamless(function () {
|
|
|
|
|
|
+return self.then(null, function (err) {
|
|
if (err._isKindOf_(aClass)) return aBlock._value_(err);
|
|
if (err._isKindOf_(aClass)) return aBlock._value_(err);
|
|
else throw err;
|
|
else throw err;
|
|
-})});
|
|
|
|
|
|
+});
|
|
return self;
|
|
return self;
|
|
}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
|
|
}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
|
|
}; }),
|
|
}; }),
|
|
@@ -22851,9 +22855,9 @@ $core.method({
|
|
selector: "then:",
|
|
selector: "then:",
|
|
protocol: "promises",
|
|
protocol: "promises",
|
|
args: ["aBlockOrArray"],
|
|
args: ["aBlockOrArray"],
|
|
-source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
|
|
|
|
|
|
+source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a } :\x0a function (result) {\x0a return aBlock._value_(result);\x0a }\x0a );\x0a}, self)'>",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
-pragmas: [["inlineJS:", ["\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)"]]],
|
|
|
|
|
|
+pragmas: [["inlineJS:", ["\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a } :\x0a function (result) {\x0a return aBlock._value_(result);\x0a }\x0a );\x0a}, self)"]]],
|
|
messageSends: []
|
|
messageSends: []
|
|
}, function ($methodClass){ return function (aBlockOrArray){
|
|
}, function ($methodClass){ return function (aBlockOrArray){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
@@ -22862,16 +22866,16 @@ return $core.withContext(function($ctx1) {
|
|
var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
|
|
var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
|
|
return array.reduce(function (soFar, aBlock) {
|
|
return array.reduce(function (soFar, aBlock) {
|
|
return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
|
|
return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
|
|
- function (result) {return $core.seamless(function () {
|
|
|
|
|
|
+ function (result) {
|
|
if (Array.isArray(result)) {
|
|
if (Array.isArray(result)) {
|
|
return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
|
|
return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
|
|
} else {
|
|
} else {
|
|
return aBlock._value_(result);
|
|
return aBlock._value_(result);
|
|
}
|
|
}
|
|
- })} :
|
|
|
|
- function (result) {return $core.seamless(function () {
|
|
|
|
|
|
+ } :
|
|
|
|
+ function (result) {
|
|
return aBlock._value_(result);
|
|
return aBlock._value_(result);
|
|
- })}
|
|
|
|
|
|
+ }
|
|
);
|
|
);
|
|
}, self);
|
|
}, self);
|
|
return self;
|
|
return self;
|
|
@@ -25880,13 +25884,13 @@ $core.method({
|
|
selector: "version",
|
|
selector: "version",
|
|
protocol: "accessing",
|
|
protocol: "accessing",
|
|
args: [],
|
|
args: [],
|
|
-source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.25.4'",
|
|
|
|
|
|
+source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.26.0'",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
pragmas: [],
|
|
pragmas: [],
|
|
messageSends: []
|
|
messageSends: []
|
|
}, function ($methodClass){ return function (){
|
|
}, function ($methodClass){ return function (){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
-return "0.25.4";
|
|
|
|
|
|
+return "0.26.0";
|
|
|
|
|
|
}; }),
|
|
}; }),
|
|
$globals.SmalltalkImage);
|
|
$globals.SmalltalkImage);
|