Re-compiling core with new temporary variable names, all tests pass.

This commit is contained in:
Stan Angeloff 2010-09-21 07:55:08 +03:00
parent 921ab3ce68
commit 992f4192bf
5 changed files with 16 additions and 16 deletions

View File

@ -69,10 +69,10 @@
return fs.stat(source, function(err, stats) {
if (stats.isDirectory()) {
return fs.readdir(source, function(err, files) {
var _i2, _len2, _ref3, _result2, file;
var _j, _len2, _ref3, _result2, file;
_result2 = []; _ref3 = files;
for (_i2 = 0, _len2 = _ref3.length; _i2 < _len2; _i2++) {
file = _ref3[_i2];
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
file = _ref3[_j];
_result2.push(compile(path.join(source, file)));
}
return _result2;

View File

@ -1,5 +1,5 @@
(function() {
var Parser, _i, _i2, _len, _len2, _ref, _ref2, _ref3, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
var Parser, _i, _j, _len, _len2, _ref, _ref2, _ref3, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
var __hasProp = Object.prototype.hasOwnProperty;
Parser = require('jison').Parser;
unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
@ -622,8 +622,8 @@
alt = _ref2[_i];
_result.push((function() {
_ref3 = alt[0].split(' ');
for (_i2 = 0, _len2 = _ref3.length; _i2 < _len2; _i2++) {
token = _ref3[_i2];
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
token = _ref3[_j];
if (!(grammar[token])) {
tokens.push(token);
}

View File

@ -122,7 +122,7 @@
return '\n' + idt + (override || this["class"]) + children;
};
BaseNode.prototype.eachChild = function(func) {
var _i, _i2, _len, _len2, _ref2, _ref3, _result, attr, child;
var _i, _j, _len, _len2, _ref2, _ref3, _result, attr, child;
if (!(this.children)) {
return null;
}
@ -131,8 +131,8 @@
attr = _ref2[_i];
if (this[attr]) {
_ref3 = flatten([this[attr]]);
for (_i2 = 0, _len2 = _ref3.length; _i2 < _len2; _i2++) {
child = _ref3[_i2];
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
child = _ref3[_j];
if (func(child) === false) {
return null;
}
@ -1774,7 +1774,7 @@
return this;
};
SwitchNode.prototype.compileNode = function(o) {
var _i, _i2, _len, _len2, _ref2, _ref3, block, code, condition, conditions, exprs, idt, pair;
var _i, _j, _len, _len2, _ref2, _ref3, block, code, condition, conditions, exprs, idt, pair;
idt = (o.indent = this.idt(1));
o.top = true;
code = ("" + (this.tab) + "switch (" + (this.subject.compile(o)) + ") {");
@ -1786,8 +1786,8 @@
block = _ref3[1];
exprs = block.expressions;
_ref3 = flatten([conditions]);
for (_i2 = 0, _len2 = _ref3.length; _i2 < _len2; _i2++) {
condition = _ref3[_i2];
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
condition = _ref3[_j];
if (this.tags.subjectless) {
condition = new OpNode('!!', new ParentheticalNode(condition));
}

View File

@ -94,7 +94,7 @@
};
};
normalizeArguments = function(args) {
var _i, _i2, _len, _len2, _ref, _ref2, arg, l, match, result;
var _i, _j, _len, _len2, _ref, _ref2, arg, l, match, result;
args = args.slice(0);
result = [];
_ref = args;
@ -102,8 +102,8 @@
arg = _ref[_i];
if (match = arg.match(MULTI_FLAG)) {
_ref2 = match[1].split('');
for (_i2 = 0, _len2 = _ref2.length; _i2 < _len2; _i2++) {
l = _ref2[_i2];
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
l = _ref2[_j];
result.push('-' + l);
}
} else {

View File

@ -70,7 +70,7 @@
return !!(this.parent && this.parent.check(name));
};
Scope.prototype.temporary = function(type, index) {
return '_' + type + (index > 1 ? index : '');
return type.length > 1 ? '_' + type + (index > 1 ? index : '') : '_' + (index + parseInt(type, 36)).toString(36).replace(/\d/g, 'a');
};
Scope.prototype.freeVariable = function(type) {
var index, temp;