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

View File

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

View File

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

View File

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

View File

@ -70,7 +70,7 @@
return !!(this.parent && this.parent.check(name)); return !!(this.parent && this.parent.check(name));
}; };
Scope.prototype.temporary = function(type, index) { 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) { Scope.prototype.freeVariable = function(type) {
var index, temp; var index, temp;