kopia lustrzana https://github.com/backface/turtlestitch
fixed #2227 - capture argument reporter's lexical environment in JIT-compiler
rodzic
21a79226e7
commit
3a7f26497a
|
@ -1,7 +1,11 @@
|
||||||
# Snap<em>!</em> (BYOB) History
|
# Snap<em>!</em> (BYOB) History
|
||||||
|
|
||||||
## v4.2.2.1
|
## Development Version
|
||||||
|
|
||||||
|
### 2018-10-19
|
||||||
|
* Threads: fixed #2227 - capture argument reporter's lexical environment in JIT-compiler
|
||||||
|
|
||||||
|
## v4.2.2.1
|
||||||
### 2018-10-16
|
### 2018-10-16
|
||||||
* New translation for Ukrainian, thanks, Serhiy Kryzhanovsky, for the contribution!
|
* New translation for Ukrainian, thanks, Serhiy Kryzhanovsky, for the contribution!
|
||||||
* added timed FOR-loop to Animation library
|
* added timed FOR-loop to Animation library
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<script type="text/javascript" src="src/morphic.js?version=2018-10-02"></script>
|
<script type="text/javascript" src="src/morphic.js?version=2018-10-02"></script>
|
||||||
<script type="text/javascript" src="src/widgets.js?version=2018-10-02"></script>
|
<script type="text/javascript" src="src/widgets.js?version=2018-10-02"></script>
|
||||||
<script type="text/javascript" src="src/blocks.js?version=2018-10-02"></script>
|
<script type="text/javascript" src="src/blocks.js?version=2018-10-02"></script>
|
||||||
<script type="text/javascript" src="src/threads.js?version=2018-10-03"></script>
|
<script type="text/javascript" src="src/threads.js?version=2018-10-19"></script>
|
||||||
<script type="text/javascript" src="src/objects.js?version=2018-10-05"></script>
|
<script type="text/javascript" src="src/objects.js?version=2018-10-05"></script>
|
||||||
<script type="text/javascript" src="src/gui.js?version=2018-10-16"></script>
|
<script type="text/javascript" src="src/gui.js?version=2018-10-16"></script>
|
||||||
<script type="text/javascript" src="src/paint.js?version=2018-10-02"></script>
|
<script type="text/javascript" src="src/paint.js?version=2018-10-02"></script>
|
||||||
|
|
|
@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
|
||||||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
|
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
|
||||||
TableFrameMorph, ColorSlotMorph, isSnapObject*/
|
TableFrameMorph, ColorSlotMorph, isSnapObject*/
|
||||||
|
|
||||||
modules.threads = '2018-October-03';
|
modules.threads = '2018-October-19';
|
||||||
|
|
||||||
var ThreadManager;
|
var ThreadManager;
|
||||||
var Process;
|
var Process;
|
||||||
|
@ -3803,6 +3803,22 @@ Process.prototype.reportCompiled = function (context, implicitParamCount) {
|
||||||
return new JSCompiler(this).compileFunction(context, implicitParamCount);
|
return new JSCompiler(this).compileFunction(context, implicitParamCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Process.prototype.capture = function (aContext) {
|
||||||
|
// private - answer a new process on a full copy of the given context
|
||||||
|
// while retaining the lexical variable scope
|
||||||
|
var proc = new Process(this.topBlock, this.receiver);
|
||||||
|
var clos = new Context(
|
||||||
|
aContext.parentContext,
|
||||||
|
aContext.expression,
|
||||||
|
aContext.outerContext,
|
||||||
|
aContext.receiver
|
||||||
|
);
|
||||||
|
clos.variables = aContext.variables.fullCopy();
|
||||||
|
clos.variables.root().parentFrame = proc.variables;
|
||||||
|
proc.context = clos;
|
||||||
|
return proc;
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.getVarNamed = function (name) {
|
Process.prototype.getVarNamed = function (name) {
|
||||||
// private - special form for compiled expressions
|
// private - special form for compiled expressions
|
||||||
// DO NOT use except in compiled methods!
|
// DO NOT use except in compiled methods!
|
||||||
|
@ -3867,6 +3883,7 @@ Process.prototype.reportAtomicMap = function (reporter, list) {
|
||||||
|
|
||||||
// iterate over the data in a single frame:
|
// iterate over the data in a single frame:
|
||||||
// to do: Insert some kind of user escape mechanism
|
// to do: Insert some kind of user escape mechanism
|
||||||
|
|
||||||
for (i = 0; i < len; i += 1) {
|
for (i = 0; i < len; i += 1) {
|
||||||
result.push(
|
result.push(
|
||||||
invoke(
|
invoke(
|
||||||
|
@ -3876,7 +3893,7 @@ Process.prototype.reportAtomicMap = function (reporter, list) {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
this // process
|
this.capture(reporter) // process
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3911,7 +3928,7 @@ Process.prototype.reportAtomicKeep = function (reporter, list) {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
this // process
|
this.capture(reporter) // process
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
result.push(src[i]);
|
result.push(src[i]);
|
||||||
|
@ -3952,7 +3969,7 @@ Process.prototype.reportAtomicCombine = function (reporter, list) {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
this // process
|
this.capture(reporter) // process
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -3983,7 +4000,7 @@ Process.prototype.reportAtomicSort = function (list, reporter) {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
myself // process
|
myself.capture(reporter) // process
|
||||||
) ? -1 : 1;
|
) ? -1 : 1;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -4249,18 +4266,25 @@ VariableFrame.prototype.copy = function () {
|
||||||
return frame;
|
return frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
VariableFrame.prototype.deepCopy = function () {
|
VariableFrame.prototype.fullCopy = function () {
|
||||||
// currently unused
|
// experimental - for compiling to JS
|
||||||
var frame;
|
var frame;
|
||||||
if (this.parentFrame) {
|
if (this.parentFrame) {
|
||||||
frame = new VariableFrame(this.parentFrame.deepCopy());
|
frame = new VariableFrame(this.parentFrame.fullCopy());
|
||||||
} else {
|
} else {
|
||||||
frame = new VariableFrame(this.parentFrame);
|
frame = new VariableFrame();
|
||||||
}
|
}
|
||||||
frame.vars = copy(this.vars);
|
frame.vars = copy(this.vars);
|
||||||
return frame;
|
return frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VariableFrame.prototype.root = function () {
|
||||||
|
if (this.parentFrame) {
|
||||||
|
return this.parentFrame.root();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
VariableFrame.prototype.find = function (name) {
|
VariableFrame.prototype.find = function (name) {
|
||||||
/*
|
/*
|
||||||
answer the closest variable frame containing
|
answer the closest variable frame containing
|
||||||
|
|
Ładowanie…
Reference in New Issue