added support to the OF reporter for binding a ring to another one, e.g. THIS SCRIPT

snap8
Jens Mönig 2022-07-11 17:34:37 +02:00
rodzic 9f0cd85530
commit 7a2c5fe05c
3 zmienionych plików z 21 dodań i 4 usunięć

Wyświetl plik

@ -21,6 +21,7 @@
* new "define block" primitive, experimental * new "define block" primitive, experimental
* new "delete block" primitive, experimental * new "delete block" primitive, experimental
* new "this script" primitive, experimental * new "this script" primitive, experimental
* added support to the OF reporter for binding a ring to another one, e.g. THIS SCRIPT, to access its local variables
* new localization extension primitives in the "ide" category, hyperized * new localization extension primitives in the "ide" category, hyperized
* new extension primitive for importing a costume from a url * new extension primitive for importing a costume from a url
* new extension primitive for querying all variable names accessible from a specified scope (global, sprite, script) * new extension primitive for querying all variable names accessible from a specified scope (global, sprite, script)
@ -58,7 +59,7 @@
### 2022-07-11 ### 2022-07-11
* extensions: fixed #3065 * extensions: fixed #3065
* threads: added support to the OF reporter for binding a ring to another one, e.g. THIS SCRIPT to access its local variables
### 2022-07-04 ### 2022-07-04
* blocks, gui: directly import embedded blocks from a smart pic if the pic is dragged and dropped onto a scripting area or palette - otherwise import the pic as costume (with embedded blocks) * blocks, gui: directly import embedded blocks from a smart pic if the pic is dragged and dropped onto a scripting area or palette - otherwise import the pic as costume (with embedded blocks)
* gui: import smart pic as costume via "Import..." item in the project menu * gui: import smart pic as costume via "Import..." item in the project menu

Wyświetl plik

@ -17,7 +17,7 @@
<script src="src/symbols.js?version=2021-03-03"></script> <script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-09"></script> <script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2022-07-04"></script> <script src="src/blocks.js?version=2022-07-04"></script>
<script src="src/threads.js?version=2022-06-29"></script> <script src="src/threads.js?version=2022-07-11"></script>
<script src="src/objects.js?version=2022-06-28"></script> <script src="src/objects.js?version=2022-06-28"></script>
<script src="src/scenes.js?version=2022-03-03"></script> <script src="src/scenes.js?version=2022-03-03"></script>
<script src="src/gui.js?version=2022-07-04"></script> <script src="src/gui.js?version=2022-07-04"></script>

Wyświetl plik

@ -1553,11 +1553,17 @@ Process.prototype.initializeFor = function (context, args) {
Process.prototype.reportThisContext = function () { Process.prototype.reportThisContext = function () {
var sym = Symbol.for('self'), var sym = Symbol.for('self'),
frame = this.context.variables.silentFind(sym); frame = this.context.variables.silentFind(sym),
ctx;
if (frame) { if (frame) {
return frame.vars[sym].value; return frame.vars[sym].value;
} }
return this.topBlock.reify(); ctx = this.topBlock.reify();
ctx.outerContext = this.context.outerContext;
if (ctx.outerContext) {
ctx.variables.parentFrame = ctx.outerContext.variables;
}
return ctx;
}; };
// Process stopping blocks primitives // Process stopping blocks primitives
@ -5616,6 +5622,9 @@ Process.prototype.reportBasicAttributeOf = function (attribute, name) {
thatObj, thatObj,
stage; stage;
if (name instanceof Context && attribute instanceof Context) {
return this.reportContextFor(attribute, name);
}
if (thisObj) { if (thisObj) {
this.assertAlive(thisObj); this.assertAlive(thisObj);
stage = thisObj.parentThatIsA(StageMorph); stage = thisObj.parentThatIsA(StageMorph);
@ -6009,6 +6018,13 @@ Process.prototype.reportContextFor = function (context, otherObj) {
receiverVars, receiverVars,
rootVars; rootVars;
if (otherObj instanceof Context) {
result.outerContext = otherObj.outerContext;
result.variables.parentFrame = otherObj.outerContext.variables;
result.receiver = otherObj.receiver;
return result;
}
result.receiver = otherObj; result.receiver = otherObj;
if (!result.outerContext) { if (!result.outerContext) {
result.outerContext = new Context(); result.outerContext = new Context();