Fixing erroneous whitespace fix in generated JS

This commit is contained in:
Jeremy Ashkenas 2013-03-18 17:47:55 +08:00
parent a3e8de338a
commit 566a7dabb2
14 changed files with 2 additions and 238 deletions

View File

@ -11,7 +11,6 @@
CoffeeScript["eval"] = function(code, options) {
var _ref;
if (options == null) {
options = {};
}
@ -36,7 +35,6 @@
if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null)) {
compile = function(code, options) {
var js, v3SourceMap, _ref;
if (options == null) {
options = {};
}
@ -49,7 +47,6 @@
CoffeeScript.load = function(url, callback, options) {
var xhr;
if (options == null) {
options = {};
}
@ -61,7 +58,6 @@
}
xhr.onreadystatechange = function() {
var _ref;
if (xhr.readyState === 4) {
if ((_ref = xhr.status) === 0 || _ref === 200) {
CoffeeScript.run(xhr.responseText, options);
@ -78,12 +74,10 @@
runScripts = function() {
var coffees, coffeetypes, execute, index, length, s, scripts;
scripts = document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var _i, _len, _ref, _results;
_results = [];
for (_i = 0, _len = scripts.length; _i < _len; _i++) {
s = scripts[_i];
@ -97,7 +91,6 @@
length = coffees.length;
(execute = function() {
var mediatype, options, script;
script = coffees[index++];
mediatype = script != null ? script.type : void 0;
if (__indexOf.call(coffeetypes, mediatype) >= 0) {

View File

@ -25,7 +25,6 @@
helpers.extend(global, {
task: function(name, description, action) {
var _ref;
if (!action) {
_ref = [description, action], action = _ref[0], description = _ref[1];
}
@ -48,7 +47,6 @@
exports.run = function() {
var arg, args, e, _i, _len, _ref, _results;
global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2);
@ -76,7 +74,6 @@
printTasks = function() {
var cakefilePath, desc, name, relative, spaces, task;
relative = path.relative || path.resolve;
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
console.log("" + cakefilePath + " defines the following tasks:\n");
@ -104,7 +101,6 @@
cakefileDirectory = function(dir) {
var parent;
if (existsSync(path.join(dir, 'Cakefile'))) {
return dir;
}

View File

@ -25,7 +25,6 @@
exports.compile = compile = function(code, options) {
var answer, currentColumn, currentLine, fragment, fragments, header, js, merge, newLines, sourceMap, _i, _len;
if (options == null) {
options = {};
}
@ -86,7 +85,6 @@
exports.run = function(code, options) {
var answer, mainModule, _ref;
if (options == null) {
options = {};
}
@ -109,7 +107,6 @@
exports["eval"] = function(code, options) {
var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref, _ref1, _require;
if (options == null) {
options = {};
}
@ -173,7 +170,6 @@
loadFile = function(module, filename) {
var raw, stripped;
raw = fs.readFileSync(filename, 'utf8');
stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;
return module._compile(compile(stripped, {
@ -194,7 +190,6 @@
fork = child_process.fork;
child_process.fork = function(path, args, options) {
var execPath;
if (args == null) {
args = [];
}
@ -216,7 +211,6 @@
parser.lexer = {
lex: function() {
var tag, token;
token = this.tokens[this.pos++];
if (token) {
tag = token[0], this.yytext = token[1], this.yylloc = token[2];
@ -239,7 +233,6 @@
parser.yy.parseError = function(message, _arg) {
var token;
token = _arg.token;
message = "unexpected " + (token === 1 ? 'end of input' : token);
return helpers.throwSyntaxError(message, parser.lexer.yylloc);
@ -249,7 +242,6 @@
patchStackTrace = function() {
var mainModule;
if (patched) {
return;
}
@ -258,11 +250,9 @@
mainModule._sourceMaps = {};
return Error.prepareStackTrace = function(err, stack) {
var frame, frames, getSourceMapping, sourceFiles, _ref1;
sourceFiles = {};
getSourceMapping = function(filename, line, column) {
var answer, sourceMap;
sourceMap = mainModule._sourceMaps[filename];
if (sourceMap) {
answer = sourceMap.getSourcePosition([line - 1, column - 1]);
@ -275,7 +265,6 @@
};
frames = (function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = stack.length; _j < _len1; _j++) {
frame = stack[_j];
@ -292,7 +281,6 @@
formatSourcePosition = function(frame, getSourceMapping) {
var as, column, fileLocation, fileName, functionName, isConstructor, isMethodCall, line, methodName, source, tp, typeName;
fileName = void 0;
fileLocation = '';
if (frame.isNative()) {

View File

@ -50,7 +50,6 @@
exports.run = function() {
var literals, source, _i, _len, _results;
parseOptions();
if (opts.nodejs) {
return forkNode();
@ -102,7 +101,6 @@
}
return fs.readdir(source, function(err, files) {
var file, index, _ref1, _ref2;
if (err && err.code !== 'ENOENT') {
throw err;
}
@ -115,7 +113,6 @@
});
[].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
@ -152,7 +149,6 @@
compileScript = function(file, input, base) {
var compiled, err, message, o, options, t, task, useColors;
if (base == null) {
base = null;
}
@ -212,7 +208,6 @@
compileStdio = function() {
var code, stdin;
code = '';
stdin = process.openStdin();
stdin.on('data', function(buffer) {
@ -243,7 +238,6 @@
watch = function(source, base) {
var compile, compileTimeout, e, prevStats, rewatch, watchErr, watcher;
prevStats = null;
compileTimeout = null;
watchErr = function(e) {
@ -300,7 +294,6 @@
watchDir = function(source, base) {
var e, readdirTimeout, watcher;
readdirTimeout = null;
try {
return watcher = fs.watch(source, function() {
@ -308,7 +301,6 @@
return readdirTimeout = wait(25, function() {
return fs.readdir(source, function(err, files) {
var file, _i, _len, _results;
if (err) {
if (err.code !== 'ENOENT') {
throw err;
@ -346,11 +338,9 @@
unwatchDir = function(source, base) {
var file, prevSources, toRemove, _i, _len;
prevSources = sources.slice(0);
toRemove = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = sources.length; _i < _len; _i++) {
file = sources[_i];
@ -374,7 +364,6 @@
removeSource = function(source, base, removeJs) {
var index, jsPath;
index = sources.indexOf(source);
sources.splice(index, 1);
sourceCode.splice(index, 1);
@ -395,7 +384,6 @@
outputPath = function(source, base, extension) {
var baseDir, basename, dir, srcDir;
if (extension == null) {
extension = ".js";
}
@ -408,7 +396,6 @@
writeJs = function(base, sourcePath, js, jsPath, generatedSourceMap) {
var compile, jsDir, sourceMapPath;
if (generatedSourceMap == null) {
generatedSourceMap = null;
}
@ -457,7 +444,6 @@
lint = function(file, js) {
var conf, jsl, printIt;
printIt = function(buffer) {
return printLine(file + ':\t' + buffer.toString().trim());
};
@ -471,10 +457,8 @@
printTokens = function(tokens) {
var strings, tag, token, value;
strings = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
token = tokens[_i];
@ -489,7 +473,6 @@
parseOptions = function() {
var i, o, source, _i, _len;
optionParser = new optparse.OptionParser(SWITCHES, BANNER);
o = opts = optionParser.parse(process.argv.slice(2));
o.compile || (o.compile = !!o.output);
@ -504,7 +487,6 @@
compileOptions = function(filename, base) {
var answer, cwd, jsDir, jsPath;
answer = {
filename: filename,
literate: helpers.isLiterate(filename),
@ -536,7 +518,6 @@
forkNode = function() {
var args, nodeArgs;
nodeArgs = opts.nodejs.split(/\s+/);
args = process.argv.slice(1);
args.splice(args.indexOf('--nodejs'), 2);

View File

@ -8,7 +8,6 @@
o = function(patternString, action, options) {
var addLocationDataFn, match, patternCount;
patternString = patternString.replace(/\s{2,}/g, ' ');
patternCount = patternString.split(' ').length;
if (!action) {
@ -595,7 +594,6 @@
alternatives = grammar[name];
grammar[name] = (function() {
var _i, _j, _len, _len1, _ref, _results;
_results = [];
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
alt = alternatives[_i];

View File

@ -8,14 +8,12 @@
exports.ends = function(string, literal, back) {
var len;
len = literal.length;
return literal === string.substr(string.length - len - (back || 0), len);
};
exports.repeat = repeat = function(str, n) {
var res;
res = '';
while (n > 0) {
if (n & 1) {
@ -29,7 +27,6 @@
exports.compact = function(array) {
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
@ -42,7 +39,6 @@
exports.count = function(string, substr) {
var num, pos;
num = pos = 0;
if (!substr.length) {
return 1 / 0;
@ -59,7 +55,6 @@
extend = exports.extend = function(object, properties) {
var key, val;
for (key in properties) {
val = properties[key];
object[key] = val;
@ -69,7 +64,6 @@
exports.flatten = flatten = function(array) {
var element, flattened, _i, _len;
flattened = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
element = array[_i];
@ -84,7 +78,6 @@
exports.del = function(obj, key) {
var val;
val = obj[key];
delete obj[key];
return val;
@ -96,7 +89,6 @@
exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
var e, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) {
e = this[_i];
if (fn(e)) {
@ -108,11 +100,9 @@
exports.invertLiterate = function(code) {
var line, lines, maybe_code;
maybe_code = true;
lines = (function() {
var _i, _len, _ref1, _results;
_ref1 = code.split('\n');
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
@ -154,7 +144,6 @@
exports.locationDataToString = function(obj) {
var locationData;
if (("2" in obj) && ("first_line" in obj[2])) {
locationData = obj[2];
} else if ("first_line" in obj) {
@ -169,7 +158,6 @@
exports.baseFileName = function(file, stripExt, pathSep) {
var parts;
if (stripExt == null) {
stripExt = false;
}
@ -199,7 +187,6 @@
exports.throwSyntaxError = function(message, location) {
var error, _ref1, _ref2;
if ((_ref1 = location.last_line) == null) {
location.last_line = location.first_line;
}
@ -213,7 +200,6 @@
exports.prettyErrorMessage = function(error, fileName, code, useColors) {
var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1;
if (!error.location) {
return error.stack || ("" + error);
}

View File

@ -12,7 +12,6 @@
Lexer.prototype.tokenize = function(code, opts) {
var consumed, i, tag, _ref2;
if (opts == null) {
opts = {};
}
@ -59,7 +58,6 @@
Lexer.prototype.identifierToken = function() {
var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4;
if (!(match = IDENTIFIER.exec(this.chunk))) {
return 0;
}
@ -142,7 +140,6 @@
Lexer.prototype.numberToken = function() {
var binaryLiteral, lexedLength, match, number, octalLiteral;
if (!(match = NUMBER.exec(this.chunk))) {
return 0;
}
@ -169,7 +166,6 @@
Lexer.prototype.stringToken = function() {
var match, octalEsc, string;
switch (this.chunk.charAt(0)) {
case "'":
if (!(match = SIMPLESTR.exec(this.chunk))) {
@ -202,7 +198,6 @@
Lexer.prototype.heredocToken = function() {
var doc, heredoc, match, quote;
if (!(match = HEREDOC.exec(this.chunk))) {
return 0;
}
@ -226,7 +221,6 @@
Lexer.prototype.commentToken = function() {
var comment, here, match;
if (!(match = this.chunk.match(COMMENT))) {
return 0;
}
@ -242,7 +236,6 @@
Lexer.prototype.jsToken = function() {
var match, script;
if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) {
return 0;
}
@ -252,7 +245,6 @@
Lexer.prototype.regexToken = function() {
var flags, length, match, prev, regex, _ref2, _ref3;
if (this.chunk.charAt(0) !== '/') {
return 0;
}
@ -280,7 +272,6 @@
Lexer.prototype.heregexToken = function(match) {
var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
heregex = match[0], body = match[1], flags = match[2];
if (0 > body.indexOf('#{')) {
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
@ -334,7 +325,6 @@
Lexer.prototype.lineToken = function() {
var diff, indent, match, noNewlines, size;
if (!(match = MULTI_DENT.exec(this.chunk))) {
return 0;
}
@ -371,7 +361,6 @@
Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) {
var dent, len;
while (moveOut > 0) {
len = this.indents.length - 1;
if (this.indents[len] === void 0) {
@ -404,7 +393,6 @@
Lexer.prototype.whitespaceToken = function() {
var match, nline, prev;
if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) {
return 0;
}
@ -438,7 +426,6 @@
Lexer.prototype.literalToken = function() {
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
if (match = OPERATOR.exec(this.chunk)) {
value = match[0];
if (CODE.test(value)) {
@ -505,7 +492,6 @@
Lexer.prototype.sanitizeHeredoc = function(doc, options) {
var attempt, herecomment, indent, match, _ref2;
indent = options.indent, herecomment = options.herecomment;
if (herecomment) {
if (HEREDOC_ILLEGAL.test(doc)) {
@ -533,7 +519,6 @@
Lexer.prototype.tagParameters = function() {
var i, stack, tok, tokens;
if (this.tag() !== ')') {
return this;
}
@ -567,7 +552,6 @@
Lexer.prototype.balancedString = function(str, end) {
var continueCount, i, letter, match, prev, stack, _i, _ref2;
continueCount = 0;
stack = [end];
for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) {
@ -603,7 +587,6 @@
Lexer.prototype.interpolateString = function(str, options) {
var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
if (options == null) {
options = {};
}
@ -702,7 +685,6 @@
Lexer.prototype.pair = function(tag) {
var size, wanted;
if (tag !== (wanted = last(this.ends))) {
if ('OUTDENT' !== wanted) {
this.error("unmatched " + tag);
@ -716,7 +698,6 @@
Lexer.prototype.getLineAndColumnFromChunk = function(offset) {
var column, lineCount, lines, string;
if (offset === 0) {
return [this.chunkLine, this.chunkColumn];
}
@ -738,7 +719,6 @@
Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) {
var lastCharacter, locationData, token, _ref2, _ref3;
if (offsetInChunk == null) {
offsetInChunk = 0;
}
@ -755,7 +735,6 @@
Lexer.prototype.token = function(tag, value, offsetInChunk, length) {
var token;
token = this.makeToken(tag, value, offsetInChunk, length);
this.tokens.push(token);
return token;
@ -763,19 +742,16 @@
Lexer.prototype.tag = function(index, tag) {
var tok;
return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]);
};
Lexer.prototype.value = function(index, val) {
var tok;
return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]);
};
Lexer.prototype.unfinished = function() {
var _ref2;
return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
};
@ -827,7 +803,6 @@
COFFEE_ALIASES = (function() {
var _results;
_results = [];
for (key in COFFEE_ALIAS_MAP) {
_results.push(key);

View File

@ -38,7 +38,6 @@
exports.CodeFragment = CodeFragment = (function() {
function CodeFragment(parent, code) {
var _ref2;
this.code = "" + code;
this.locationData = parent != null ? parent.locationData : void 0;
this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown';
@ -54,10 +53,8 @@
fragmentsToText = function(fragments) {
var fragment;
return ((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = fragments.length; _i < _len; _i++) {
fragment = fragments[_i];
@ -76,7 +73,6 @@
Base.prototype.compileToFragments = function(o, lvl) {
var node;
o = extend({}, o);
if (lvl) {
o.level = lvl;
@ -92,7 +88,6 @@
Base.prototype.compileClosure = function(o) {
var jumpNode;
if (jumpNode = this.jumps()) {
jumpNode.error('cannot use a pure statement in an expression');
}
@ -102,7 +97,6 @@
Base.prototype.cache = function(o, level, reused) {
var ref, sub;
if (!this.isComplex()) {
ref = level ? this.compileToFragments(o, level) : this;
return [ref, ref];
@ -123,7 +117,6 @@
Base.prototype.makeReturn = function(res) {
var me;
me = this.unwrapAll();
if (res) {
return new Call(new Literal("" + res + ".push"), [me]);
@ -134,7 +127,6 @@
Base.prototype.contains = function(pred) {
var node;
node = void 0;
this.traverseChildren(false, function(n) {
if (pred(n)) {
@ -147,7 +139,6 @@
Base.prototype.lastNonComment = function(list) {
var i;
i = list.length;
while (i--) {
if (!(list[i] instanceof Comment)) {
@ -159,7 +150,6 @@
Base.prototype.toString = function(idt, name) {
var tree;
if (idt == null) {
idt = '';
}
@ -178,7 +168,6 @@
Base.prototype.eachChild = function(func) {
var attr, child, _i, _j, _len, _len1, _ref2, _ref3;
if (!this.children) {
return this;
}
@ -213,7 +202,6 @@
Base.prototype.unwrapAll = function() {
var node;
node = this;
while (node !== (node = node.unwrap())) {
continue;
@ -260,7 +248,6 @@
Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) {
var answer, fragments, i, _i, _len;
answer = [];
for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) {
fragments = fragmentsList[i];
@ -313,7 +300,6 @@
Block.prototype.isStatement = function(o) {
var exp, _i, _len, _ref2;
_ref2 = this.expressions;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
exp = _ref2[_i];
@ -326,7 +312,6 @@
Block.prototype.jumps = function(o) {
var exp, _i, _len, _ref2;
_ref2 = this.expressions;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
exp = _ref2[_i];
@ -338,7 +323,6 @@
Block.prototype.makeReturn = function(res) {
var expr, len;
len = this.expressions.length;
while (len--) {
expr = this.expressions[len];
@ -366,7 +350,6 @@
Block.prototype.compileNode = function(o) {
var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2;
this.tab = o.indent;
top = o.level === LEVEL_TOP;
compiledNodes = [];
@ -410,7 +393,6 @@
Block.prototype.compileRoot = function(o) {
var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2;
o.indent = o.bare ? '' : TAB;
o.level = LEVEL_TOP;
this.spaced = true;
@ -424,7 +406,6 @@
if (!o.bare) {
preludeExps = (function() {
var _j, _len1, _ref3, _results;
_ref3 = this.expressions;
_results = [];
for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) {
@ -455,7 +436,6 @@
Block.prototype.compileWithDeclarations = function(o) {
var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4;
fragments = [];
post = [];
_ref2 = this.expressions;
@ -494,7 +474,7 @@
}
fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
}
fragments.push(this.makeCode(';\n\n'));
fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
}
}
return fragments.concat(post);
@ -532,7 +512,6 @@
Literal.prototype.isStatement = function() {
var _ref2;
return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger';
};
@ -553,7 +532,6 @@
Literal.prototype.compileNode = function(o) {
var answer, code, _ref2;
code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value;
answer = this.isStatement() ? "" + this.tab + code + ";" : code;
return [this.makeCode(answer)];
@ -645,7 +623,6 @@
Return.prototype.compileToFragments = function(o, level) {
var expr, _ref4;
expr = (_ref4 = this.expression) != null ? _ref4.makeReturn() : void 0;
if (expr && !(expr instanceof Return)) {
return expr.compileToFragments(o, level);
@ -656,7 +633,6 @@
Return.prototype.compileNode = function(o) {
var answer;
answer = [];
answer.push(this.makeCode(this.tab + ("return" + [this.expression ? " " : void 0])));
if (this.expression) {
@ -718,7 +694,6 @@
Value.prototype.isAtomic = function() {
var node, _i, _len, _ref4;
_ref4 = this.properties.concat(this.base);
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
node = _ref4[_i];
@ -762,7 +737,6 @@
Value.prototype.cacheReference = function(o) {
var base, bref, name, nref;
name = last(this.properties);
if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) {
return [this, this];
@ -785,7 +759,6 @@
Value.prototype.compileNode = function(o) {
var fragments, prop, props, _i, _len;
this.base.front = this.front;
props = this.properties;
fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null));
@ -802,10 +775,8 @@
Value.prototype.unfoldSoak = function(o) {
var _ref4,
_this = this;
return (_ref4 = this.unfoldedSoak) != null ? _ref4 : this.unfoldedSoak = (function() {
var fst, i, ifn, prop, ref, snd, _i, _len, _ref5, _ref6;
if (ifn = _this.base.unfoldSoak(o)) {
(_ref5 = ifn.body.properties).push.apply(_ref5, _this.properties);
return ifn;
@ -849,7 +820,6 @@
Comment.prototype.compileNode = function(o, level) {
var code;
code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/\n");
if ((level || o.level) === LEVEL_TOP) {
code = o.indent + code;
@ -876,7 +846,6 @@
Call.prototype.newInstance = function() {
var base, _ref4;
base = ((_ref4 = this.variable) != null ? _ref4.base : void 0) || this.variable;
if (base instanceof Call && !base.isNew) {
base.newInstance();
@ -888,7 +857,6 @@
Call.prototype.superReference = function(o) {
var accesses, method;
method = o.scope.namedMethod();
if (method != null ? method.klass : void 0) {
accesses = [new Access(new Literal('__super__'))];
@ -906,14 +874,12 @@
Call.prototype.superThis = function(o) {
var method;
method = o.scope.method;
return (method && !method.klass && method.context) || "this";
};
Call.prototype.unfoldSoak = function(o) {
var call, ifn, left, list, rite, _i, _len, _ref4, _ref5;
if (this.soak) {
if (this.variable) {
if (ifn = unfoldSoak(o, this, 'variable')) {
@ -964,7 +930,6 @@
Call.prototype.compileNode = function(o) {
var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref4, _ref5;
if ((_ref4 = this.variable) != null) {
_ref4.front = this.front;
}
@ -1002,7 +967,6 @@
Call.prototype.compileSplat = function(o, splatArgs) {
var answer, base, fun, idt, name, ref;
if (this.isSuper) {
return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")"));
}
@ -1066,7 +1030,6 @@
Access.prototype.compileToFragments = function(o) {
var name;
name = this.name.compileToFragments(o);
if (IDENTIFIER.test(fragmentsToText(name))) {
name.unshift(this.makeCode("."));
@ -1118,7 +1081,6 @@
Range.prototype.compileVariables = function(o) {
var step, _ref4, _ref5, _ref6, _ref7;
o = merge(o, {
top: true
});
@ -1135,7 +1097,6 @@
Range.prototype.compileNode = function(o) {
var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref4, _ref5;
if (!this.fromVar) {
this.compileVariables(o);
}
@ -1167,7 +1128,6 @@
Range.prototype.compileArray = function(o) {
var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref4, _ref5, _results;
if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) {
range = (function() {
_results = [];
@ -1219,7 +1179,6 @@
Slice.prototype.compileNode = function(o) {
var compiled, compiledText, from, fromCompiled, to, toStr, _ref4;
_ref4 = this.range, to = _ref4.to, from = _ref4.from;
fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')];
if (to) {
@ -1248,7 +1207,6 @@
Obj.prototype.compileNode = function(o) {
var answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1;
props = this.properties;
if (!props.length) {
return [this.makeCode(this.front ? '({})' : '{}')];
@ -1299,7 +1257,6 @@
Obj.prototype.assigns = function(name) {
var prop, _i, _len, _ref4;
_ref4 = this.properties;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
prop = _ref4[_i];
@ -1325,7 +1282,6 @@
Arr.prototype.compileNode = function(o) {
var answer, compiledObjs, fragments, index, obj, _i, _len;
if (!this.objects.length) {
return [this.makeCode('[]')];
}
@ -1337,7 +1293,6 @@
answer = [];
compiledObjs = (function() {
var _i, _len, _ref4, _results;
_ref4 = this.objects;
_results = [];
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
@ -1365,7 +1320,6 @@
Arr.prototype.assigns = function(name) {
var obj, _i, _len, _ref4;
_ref4 = this.objects;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
obj = _ref4[_i];
@ -1395,7 +1349,6 @@
Class.prototype.determineName = function() {
var decl, tail;
if (!this.variable) {
return null;
}
@ -1424,7 +1377,6 @@
Class.prototype.addBoundFunctions = function(o) {
var bvar, lhs, _i, _len, _ref4;
_ref4 = this.boundFuncs;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
bvar = _ref4[_i];
@ -1435,11 +1387,9 @@
Class.prototype.addProperties = function(node, name, o) {
var assign, base, exprs, func, props;
props = node.base.properties.slice(0);
exprs = (function() {
var _results;
_results = [];
while (assign = props.shift()) {
if (assign instanceof Assign) {
@ -1483,10 +1433,8 @@
Class.prototype.walkBody = function(name, o) {
var _this = this;
return this.traverseChildren(false, function(child) {
var cont, exps, i, node, _i, _len, _ref4;
cont = true;
if (child instanceof Class) {
return false;
@ -1508,7 +1456,6 @@
Class.prototype.hoistDirectivePrologue = function() {
var expressions, index, node;
index = 0;
expressions = this.body.expressions;
while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) {
@ -1519,7 +1466,6 @@
Class.prototype.ensureConstructor = function(name, o) {
var missing, ref, superCall;
missing = !this.ctor;
this.ctor || (this.ctor = new Code);
this.ctor.ctor = this.ctor.name = name;
@ -1549,7 +1495,6 @@
Class.prototype.compileNode = function(o) {
var call, decl, klass, lname, name, params, _ref4;
decl = this.determineName();
name = decl || '_Class';
if (name.reserved) {
@ -1590,7 +1535,6 @@
function Assign(variable, value, context, options) {
var forbidden, name, _ref4;
this.variable = variable;
this.value = value;
this.context = context;
@ -1618,7 +1562,6 @@
Assign.prototype.compileNode = function(o) {
var answer, compiledName, isValue, match, name, val, varBase, _ref4, _ref5, _ref6, _ref7;
if (isValue = this.variable instanceof Value) {
if (this.variable.isArray() || this.variable.isObject()) {
return this.compilePatternMatch(o);
@ -1665,7 +1608,6 @@
Assign.prototype.compilePatternMatch = function(o) {
var acc, assigns, code, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, vvarText, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
top = o.level === LEVEL_TOP;
value = this.value;
objects = this.variable.base.objects;
@ -1763,7 +1705,6 @@
Assign.prototype.compileConditional = function(o) {
var left, right, _ref4;
_ref4 = this.variable.cacheReference(o), left = _ref4[0], right = _ref4[1];
if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) {
this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before");
@ -1776,7 +1717,6 @@
Assign.prototype.compileSplice = function(o) {
var answer, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref4, _ref5, _ref6;
_ref4 = this.variable.properties.pop().range, from = _ref4.from, to = _ref4.to, exclusive = _ref4.exclusive;
name = this.variable.compile(o);
if (from) {
@ -1834,7 +1774,6 @@
Code.prototype.compileNode = function(o) {
var answer, code, exprs, i, idt, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref4, _ref5, _ref6, _ref7, _ref8;
o.scope = new Scope(o.scope, this.body, this);
o.scope.shared = del(o, 'sharedScope');
o.indent += TAB;
@ -1865,7 +1804,6 @@
}
splats = new Assign(new Value(new Arr((function() {
var _k, _len2, _ref6, _results;
_ref6 = this.params;
_results = [];
for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) {
@ -1959,7 +1897,6 @@
Code.prototype.eachParamName = function(iterator) {
var param, _i, _len, _ref4, _results;
_ref4 = this.params;
_results = [];
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
@ -1984,7 +1921,6 @@
function Param(name, value, splat) {
var _ref4;
this.name = name;
this.value = value;
this.splat = splat;
@ -2001,7 +1937,6 @@
Param.prototype.asReference = function(o) {
var node;
if (this.reference) {
return this.reference;
}
@ -2027,13 +1962,11 @@
Param.prototype.eachName = function(iterator, name) {
var atParam, node, obj, _i, _len, _ref4;
if (name == null) {
name = this.name;
}
atParam = function(obj) {
var node;
node = obj.properties[0].name;
if (!node.value.reserved) {
return iterator(node.value, node);
@ -2096,7 +2029,6 @@
Splat.compileSplattedArray = function(o, list, apply) {
var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len;
index = -1;
while ((node = list[++index]) && !(node instanceof Splat)) {
continue;
@ -2125,7 +2057,6 @@
}
base = (function() {
var _j, _len1, _ref4, _results;
_ref4 = list.slice(0, index);
_results = [];
for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
@ -2173,7 +2104,6 @@
While.prototype.jumps = function() {
var expressions, node, _i, _len;
expressions = this.body.expressions;
if (!expressions.length) {
return false;
@ -2191,7 +2121,6 @@
While.prototype.compileNode = function(o) {
var answer, body, rvar, set;
o.indent += TAB;
set = '';
body = this.body;
@ -2272,19 +2201,16 @@
Op.prototype.isComplex = function() {
var _ref4;
return !(this.isUnary() && ((_ref4 = this.operator) === '+' || _ref4 === '-')) || this.first.isComplex();
};
Op.prototype.isChainable = function() {
var _ref4;
return (_ref4 = this.operator) === '<' || _ref4 === '>' || _ref4 === '>=' || _ref4 === '<=' || _ref4 === '===' || _ref4 === '!==';
};
Op.prototype.invert = function() {
var allInvertable, curr, fst, op, _ref4;
if (this.isChainable() && this.first.isChainable()) {
allInvertable = true;
curr = this;
@ -2319,13 +2245,11 @@
Op.prototype.unfoldSoak = function(o) {
var _ref4;
return ((_ref4 = this.operator) === '++' || _ref4 === '--' || _ref4 === 'delete') && unfoldSoak(o, this, 'first');
};
Op.prototype.generateDo = function(exp) {
var call, func, param, passedParams, ref, _i, _len, _ref4;
passedParams = [];
func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp;
_ref4 = func.params || [];
@ -2345,7 +2269,6 @@
Op.prototype.compileNode = function(o) {
var answer, isChain, _ref4, _ref5;
isChain = this.isChainable() && this.first.isChainable();
if (!isChain) {
this.first.front = this.front;
@ -2375,7 +2298,6 @@
Op.prototype.compileChain = function(o) {
var fragments, fst, shared, _ref4;
_ref4 = this.first.second.cache(o), this.first.second = _ref4[0], shared = _ref4[1];
fst = this.first.compileToFragments(o, LEVEL_OP);
fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP));
@ -2384,7 +2306,6 @@
Op.prototype.compileExistence = function(o) {
var fst, ref;
if (this.first.isComplex()) {
ref = new Literal(o.scope.freeVariable('ref'));
fst = new Parens(new Assign(ref, this.first));
@ -2399,7 +2320,6 @@
Op.prototype.compileUnary = function(o) {
var op, parts, plusMinus;
parts = [];
op = this.operator;
parts.push([this.makeCode(op)]);
@ -2446,7 +2366,6 @@
In.prototype.compileNode = function(o) {
var hasSplat, obj, _i, _len, _ref4;
if (this.array instanceof Value && this.array.isArray()) {
_ref4 = this.array.base.objects;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
@ -2466,7 +2385,6 @@
In.prototype.compileOrTest = function(o) {
var cmp, cnj, i, item, ref, sub, tests, _i, _len, _ref4, _ref5, _ref6;
if (this.array.base.objects.length === 0) {
return [this.makeCode("" + (!!this.negated))];
}
@ -2490,7 +2408,6 @@
In.prototype.compileLoopTest = function(o) {
var fragments, ref, sub, _ref4;
_ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
if ((fragmentsToText(sub)) === (fragmentsToText(ref))) {
@ -2528,7 +2445,6 @@
Try.prototype.jumps = function(o) {
var _ref4;
return this.attempt.jumps(o) || ((_ref4 = this.recovery) != null ? _ref4.jumps(o) : void 0);
};
@ -2544,7 +2460,6 @@
Try.prototype.compileNode = function(o) {
var catchPart, ensurePart, placeholder, tryPart, _ref4;
o.indent += TAB;
tryPart = this.attempt.compileToFragments(o, LEVEL_TOP);
catchPart = this.recovery ? (placeholder = new Literal('_error'), this.recovery.unshift(new Assign(this.errorVariable, placeholder)), this.errorVariable = placeholder, (_ref4 = this.errorVariable.value, __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0) ? this.errorVariable.error("catch variable may not be \"" + this.errorVariable.value + "\"") : void 0, [].concat(this.makeCode(" catch ("), this.errorVariable.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : [];
@ -2592,7 +2507,6 @@
Existence.prototype.compileNode = function(o) {
var cmp, cnj, code, _ref4;
this.expression.front = this.front;
code = this.expression.compile(o, LEVEL_OP);
if (IDENTIFIER.test(code) && !o.scope.check(code)) {
@ -2627,7 +2541,6 @@
Parens.prototype.compileNode = function(o) {
var bare, expr, fragments;
expr = this.body.unwrap();
if (expr instanceof Value && expr.isAtomic()) {
expr.front = this.front;
@ -2651,7 +2564,6 @@
function For(body, source) {
var _ref4;
this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
this.body = Block.wrap([body]);
this.own = !!source.own;
@ -2677,7 +2589,6 @@
For.prototype.compileNode = function(o) {
var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref4, _ref5;
body = Block.wrap([this.body]);
lastJumps = (_ref4 = last(body.expressions)) != null ? _ref4.jumps() : void 0;
if (lastJumps && lastJumps instanceof Return) {
@ -2791,7 +2702,6 @@
For.prototype.pluckDirectCall = function(o, body) {
var base, defs, expr, fn, idx, ref, val, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
defs = [];
_ref4 = body.expressions;
for (idx = _i = 0, _len = _ref4.length; _i < _len; idx = ++_i) {
@ -2835,7 +2745,6 @@
Switch.prototype.jumps = function(o) {
var block, conds, _i, _len, _ref4, _ref5, _ref6;
if (o == null) {
o = {
block: true
@ -2853,7 +2762,6 @@
Switch.prototype.makeReturn = function(res) {
var pair, _i, _len, _ref4, _ref5;
_ref4 = this.cases;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
pair = _ref4[_i];
@ -2870,7 +2778,6 @@
Switch.prototype.compileNode = function(o) {
var block, body, cond, conditions, expr, fragments, i, idt1, idt2, _i, _j, _len, _len1, _ref4, _ref5, _ref6;
idt1 = o.indent + TAB;
idt2 = o.indent = idt1 + TAB;
fragments = [].concat(this.makeCode(this.tab + "switch ("), (this.subject ? this.subject.compileToFragments(o, LEVEL_PAREN) : this.makeCode("false")), this.makeCode(") {\n"));
@ -2926,13 +2833,11 @@
If.prototype.bodyNode = function() {
var _ref4;
return (_ref4 = this.body) != null ? _ref4.unwrap() : void 0;
};
If.prototype.elseBodyNode = function() {
var _ref4;
return (_ref4 = this.elseBody) != null ? _ref4.unwrap() : void 0;
};
@ -2948,13 +2853,11 @@
If.prototype.isStatement = function(o) {
var _ref4;
return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref4 = this.elseBodyNode()) != null ? _ref4.isStatement(o) : void 0);
};
If.prototype.jumps = function(o) {
var _ref4;
return this.body.jumps(o) || ((_ref4 = this.elseBody) != null ? _ref4.jumps(o) : void 0);
};
@ -2985,7 +2888,6 @@
If.prototype.compileStatement = function(o) {
var answer, body, child, cond, exeq, ifPart, indent;
child = del(o, 'chainChild');
exeq = del(o, 'isExistentialEquals');
if (exeq) {
@ -3019,7 +2921,6 @@
If.prototype.compileExpression = function(o) {
var alt, body, cond, fragments;
cond = this.condition.compileToFragments(o, LEVEL_COND);
body = this.bodyNode().compileToFragments(o, LEVEL_LIST);
alt = this.elseBodyNode() ? this.elseBodyNode().compileToFragments(o, LEVEL_LIST) : [this.makeCode('void 0')];
@ -3042,7 +2943,6 @@
Closure = {
wrap: function(expressions, statement, noReturn) {
var args, argumentsNode, call, func, meth;
if (expressions.jumps()) {
return expressions;
}
@ -3078,7 +2978,6 @@
unfoldSoak = function(o, parent, name) {
var ifn;
if (!(ifn = parent[name].unfoldSoak(o))) {
return;
}
@ -3131,7 +3030,6 @@
utility = function(name) {
var ref;
ref = "__" + name;
Scope.root.assign(ref, UTILITIES[name]());
return ref;

View File

@ -10,7 +10,6 @@
OptionParser.prototype.parse = function(args) {
var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref;
options = {
"arguments": []
};
@ -59,7 +58,6 @@
OptionParser.prototype.help = function() {
var letPart, lines, rule, spaces, _i, _len, _ref;
lines = [];
if (this.banner) {
lines.unshift("" + this.banner + "\n");
@ -89,7 +87,6 @@
buildRules = function(rules) {
var tuple, _i, _len, _results;
_results = [];
for (_i = 0, _len = rules.length; _i < _len; _i++) {
tuple = rules[_i];
@ -103,7 +100,6 @@
buildRule = function(shortFlag, longFlag, description, options) {
var match;
if (options == null) {
options = {};
}
@ -121,7 +117,6 @@
normalizeArguments = function(args) {
var arg, l, match, result, _i, _j, _len, _len1, _ref;
args = args.slice(0);
result = [];
for (_i = 0, _len = args.length; _i < _len; _i++) {

View File

@ -14,7 +14,6 @@
prompt: 'coffee> ',
"eval": function(input, context, filename, cb) {
var Assign, Block, Literal, Value, ast, err, js, _ref1;
input = input.replace(/\uFF00/g, '\n');
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
_ref1 = require('./nodes'), Block = _ref1.Block, Assign = _ref1.Assign, Value = _ref1.Value, Literal = _ref1.Literal;
@ -35,7 +34,6 @@
addMultilineHandler = function(repl) {
var inputStream, multiline, nodeLineListener, outputStream, rli;
rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream;
multiline = {
enabled: false,
@ -91,7 +89,6 @@
module.exports = {
start: function(opts) {
var build, major, minor, repl, _ref1;
if (opts == null) {
opts = {};
}

View File

@ -6,7 +6,6 @@
generate = function(tag, value) {
var tok;
tok = [tag, value];
tok.generated = true;
return tok;
@ -30,7 +29,6 @@
Rewriter.prototype.scanTokens = function(block) {
var i, token, tokens;
tokens = this.tokens;
i = 0;
while (token = tokens[i]) {
@ -41,7 +39,6 @@
Rewriter.prototype.detectEnd = function(i, condition, action) {
var levels, token, tokens, _ref, _ref1;
tokens = this.tokens;
levels = 0;
while (token = tokens[i]) {
@ -63,7 +60,6 @@
Rewriter.prototype.removeLeadingNewlines = function() {
var i, tag, _i, _len, _ref;
_ref = this.tokens;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
tag = _ref[i][0];
@ -79,7 +75,6 @@
Rewriter.prototype.removeMidExpressionNewlines = function() {
return this.scanTokens(function(token, i, tokens) {
var _ref;
if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
return 1;
}
@ -90,10 +85,8 @@
Rewriter.prototype.closeOpenCalls = function() {
var action, condition;
condition = function(token, i) {
var _ref;
return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
};
action = function(token, i) {
@ -109,10 +102,8 @@
Rewriter.prototype.closeOpenIndexes = function() {
var action, condition;
condition = function(token, i) {
var _ref;
return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
};
action = function(token, i) {
@ -128,7 +119,6 @@
Rewriter.prototype.matchTags = function() {
var fuzz, i, j, pattern, _i, _ref, _ref1;
i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
fuzz = 0;
for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) {
@ -154,7 +144,6 @@
Rewriter.prototype.findTagsBackwards = function(i, tags) {
var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
backStack = [];
while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) {
if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) {
@ -170,11 +159,9 @@
Rewriter.prototype.addImplicitBracesAndParens = function() {
var stack;
stack = [];
return this.scanTokens(function(token, i, tokens) {
var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
tag = token[0];
prevTag = (i > 0 ? tokens[i - 1] : [])[0];
nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
@ -187,27 +174,22 @@
};
inImplicit = function() {
var _ref, _ref1;
return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0;
};
inImplicitCall = function() {
var _ref;
return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '(';
};
inImplicitObject = function() {
var _ref;
return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{';
};
inImplicitControl = function() {
var _ref;
return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL';
};
startImplicitCall = function(j) {
var idx;
idx = j != null ? j : i;
stack.push([
'(', idx, {
@ -226,7 +208,6 @@
};
startImplicitObject = function(j, startsLine) {
var idx;
if (startsLine == null) {
startsLine = true;
}
@ -350,7 +331,6 @@
Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
return this.scanTokens(function(token, i, tokens) {
var column, line, nextLocation, prevLocation, _ref, _ref1;
if (token[2]) {
return 1;
}
@ -376,11 +356,9 @@
Rewriter.prototype.addImplicitIndentation = function() {
var action, condition, indent, outdent, starter;
starter = indent = outdent = null;
condition = function(token, i) {
var _ref;
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
};
action = function(token, i) {
@ -388,7 +366,6 @@
};
return this.scanTokens(function(token, i, tokens) {
var tag, _ref, _ref1;
tag = token[0];
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
tokens.splice(i, 1);
@ -421,11 +398,9 @@
Rewriter.prototype.tagPostfixConditionals = function() {
var action, condition, original;
original = null;
condition = function(token, i) {
var prevTag, tag;
tag = token[0];
prevTag = this.tokens[i - 1][0];
return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0);
@ -447,7 +422,6 @@
Rewriter.prototype.indentation = function(implicit) {
var indent, outdent;
if (implicit == null) {
implicit = false;
}
@ -466,7 +440,6 @@
Rewriter.prototype.tag = function(i) {
var _ref;
return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
};

View File

@ -39,7 +39,6 @@
Scope.prototype.namedMethod = function() {
var _ref1;
if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) {
return this.method;
}
@ -63,7 +62,6 @@
Scope.prototype.check = function(name) {
var _ref1;
return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0));
};
@ -77,7 +75,6 @@
Scope.prototype.type = function(name) {
var v, _i, _len, _ref1;
_ref1 = this.variables;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
v = _ref1[_i];
@ -90,7 +87,6 @@
Scope.prototype.freeVariable = function(name, reserve) {
var index, temp;
if (reserve == null) {
reserve = true;
}
@ -118,7 +114,6 @@
Scope.prototype.declaredVariables = function() {
var realVars, tempVars, v, _i, _len, _ref1;
realVars = [];
tempVars = [];
_ref1 = this.variables;
@ -133,7 +128,6 @@
Scope.prototype.assignedVariables = function() {
var v, _i, _len, _ref1, _results;
_ref1 = this.variables;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {

View File

@ -11,7 +11,6 @@
LineMapping.prototype.addMapping = function(generatedColumn, _arg, options) {
var sourceColumn, sourceLine;
sourceLine = _arg[0], sourceColumn = _arg[1];
if (options == null) {
options = {};
@ -33,7 +32,6 @@
LineMapping.prototype.getSourcePosition = function(generatedColumn) {
var answer, columnMapping, lastColumnMapping, _i, _len, _ref;
answer = null;
lastColumnMapping = null;
_ref = this.columnMappings;
@ -61,7 +59,6 @@
SourceMap.prototype.addMapping = function(sourceLocation, generatedLocation, options) {
var generatedColumn, generatedLine, lineMapping;
if (options == null) {
options = {};
}
@ -75,7 +72,6 @@
SourceMap.prototype.getSourcePosition = function(_arg) {
var answer, generatedColumn, generatedLine, lineMapping;
generatedLine = _arg[0], generatedColumn = _arg[1];
answer = null;
lineMapping = this.generatedLines[generatedLine];
@ -89,7 +85,6 @@
SourceMap.prototype.forEachMapping = function(fn) {
var columnMapping, generatedLineNumber, lineMapping, _i, _len, _ref, _results;
_ref = this.generatedLines;
_results = [];
for (generatedLineNumber = _i = 0, _len = _ref.length; _i < _len; generatedLineNumber = ++_i) {
@ -97,7 +92,6 @@
if (lineMapping) {
_results.push((function() {
var _j, _len1, _ref1, _results1;
_ref1 = lineMapping.columnMappings;
_results1 = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
@ -119,7 +113,6 @@
exports.generateV3SourceMap = function(sourceMap, options, code) {
var answer, generatedFile, lastGeneratedColumnWritten, lastSourceColumnWritten, lastSourceLineWritten, mappings, needComma, sourceFiles, sourceRoot, writingGeneratedLine;
if (options == null) {
options = {};
}
@ -185,7 +178,6 @@
decodeBase64Char = function(char) {
var value;
value = BASE64_CHARS.indexOf(char);
if (value === -1) {
throw new Error("Invalid Base 64 character: " + char);
@ -201,7 +193,6 @@
exports.vlqEncodeValue = function(value) {
var answer, nextVlqChunk, signBit, valueToEncode;
signBit = value < 0 ? 1 : 0;
valueToEncode = (Math.abs(value) << 1) + signBit;
answer = "";
@ -218,7 +209,6 @@
exports.vlqDecodeValue = function(str, offset) {
var consumed, continuationShift, done, nextChunkValue, nextVlqChunk, position, signBit, value;
if (offset == null) {
offset = 0;
}

View File

@ -351,7 +351,7 @@ exports.Block = class Block extends Base
if assigns
fragments.push @makeCode ",\n#{@tab + TAB}" if declars
fragments.push @makeCode (scope.assignedVariables().join ",\n#{@tab + TAB}")
fragments.push @makeCode ';\n\n'
fragments.push @makeCode ";\n#{if @spaced then '\n' else ''}"
fragments.concat post
# Wrap up the given nodes as a **Block**, unless it already happens