aboutsummaryrefslogtreecommitdiff
path: root/src/framework.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2011-02-19 15:45:17 -0800
committerAlon Zakai <azakai@mozilla.com>2011-02-19 15:45:17 -0800
commitf81feaff967ffdd8212ffe2da8579c4734fc7cbb (patch)
treea92d47ad3cad7146c704745426ed661714682a89 /src/framework.js
parentf4a934a2adec69bc82c42342c7924fdf259f64cc (diff)
line-specific CORRECT_OVERFLOWS and CORRECT_SIGNS
Diffstat (limited to 'src/framework.js')
-rw-r--r--src/framework.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/framework.js b/src/framework.js
index e9ff592e..959d73fd 100644
--- a/src/framework.js
+++ b/src/framework.js
@@ -140,6 +140,12 @@ Substrate.prototype = {
}
};
+// Global access to the currently-being processed item.
+// Note that if you overload process in Actor, this will need to be set if you rely on it.
+var Framework = {
+ currItem: null
+};
+
Actor = function() { };
Actor.prototype = {
process: function(items) {
@@ -147,7 +153,9 @@ Actor.prototype = {
for (var i = 0; i < items.length; i++) {
var item = items[i];
try {
+ Framework.currItem = item;
var outputs = this.processItem(item);
+ Framework.currItem = null; // Do not keep an unneeded reference. Note that we don't care about this if an exception is thrown
if (outputs) {
ret = ret.concat(outputs);
}
@@ -157,18 +165,6 @@ Actor.prototype = {
}
}
return ret;
- },
- processPairs: function(items, func) {
- var ret = [];
- for (var i = 0; i < items.length; i += 2) {
- try {
- ret = ret.concat(func(items[i], items[i+1]));
- } catch (e) {
- print("Exception in processPairs(), current items are: " + dump(items[i]) + ' :::: ' + dump(items[i+1]));
- throw e;
- }
- }
- return ret;
}
};