summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorJens Mönig <jens@moenig.org>2015-03-06 14:12:48 +0100
committerJens Mönig <jens@moenig.org>2015-03-06 14:12:48 +0100
commite906290f47face8f2f4cc318f5d11838fb8a3b0a (patch)
tree2c02cdeded255dfc79241b4446b9ab456ea685d3 /blocks.js
parent168c328836c01d69418621921a50be5d2eea3039 (diff)
downloadsnap-e906290f47face8f2f4cc318f5d11838fb8a3b0a.tar.gz
snap-e906290f47face8f2f4cc318f5d11838fb8a3b0a.zip
fixed #736
caching really *is* evil :-) (if it weren’t for performance…)
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/blocks.js b/blocks.js
index 5cdcc1c..c519703 100644
--- a/blocks.js
+++ b/blocks.js
@@ -9,7 +9,7 @@
written by Jens Mönig
jens@moenig.org
- Copyright (C) 2014 by Jens Mönig
+ Copyright (C) 2015 by Jens Mönig
This file is part of Snap!.
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2015-February-28';
+modules.blocks = '2015-March-06';
var SyntaxElementMorph;
@@ -382,9 +382,32 @@ SyntaxElementMorph.prototype.inputs = function () {
return part instanceof SyntaxElementMorph;
});
}
+ // this.debugCachedInputs();
return this.cachedInputs;
};
+SyntaxElementMorph.prototype.debugCachedInputs = function () {
+ // private - only used for manually debugging inputs caching
+ var realInputs, i;
+ if (!isNil(this.cachedInputs)) {
+ realInputs = this.parts().filter(function (part) {
+ return part instanceof SyntaxElementMorph;
+ });
+ }
+ if (this.cachedInputs.length !== realInputs.length) {
+ throw new Error('cached inputs size do not match: ' +
+ this.constructor.name);
+ }
+ for (i = 0; i < realInputs.length; i += 1) {
+ if (this.cachedInputs[i] !== realInputs[i]) {
+ throw new Error('cached input does not match ' +
+ this.constructor.name +
+ ' ' +
+ i);
+ }
+ }
+};
+
SyntaxElementMorph.prototype.allInputs = function () {
// answer arguments and nested reporters of all children
var myself = this;
@@ -4614,6 +4637,7 @@ RingMorph.uber = ReporterBlockMorph.prototype;
// RingMorph preferences settings:
+RingMorph.prototype.isCachingInputs = false;
// RingMorph.prototype.edge = 2;
// RingMorph.prototype.rounding = 9;
// RingMorph.prototype.alpha = 0.8;