mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Re-compiling core with new changes. All tests pass.
This commit is contained in:
@@ -19,10 +19,10 @@
|
||||
return xhr.send(null);
|
||||
};
|
||||
processScripts = function() {
|
||||
var _a, _b, _c, script;
|
||||
_b = document.getElementsByTagName('script');
|
||||
for (_a = 0, _c = _b.length; _a < _c; _a++) {
|
||||
script = _b[_a];
|
||||
var _cache, _cache2, _index, script;
|
||||
_cache = document.getElementsByTagName('script');
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
script = _cache[_index];
|
||||
if (script.type === 'text/coffeescript') {
|
||||
if (script.src) {
|
||||
grindRemote(script.src);
|
||||
|
||||
34
lib/cake.js
34
lib/cake.js
@@ -11,11 +11,11 @@
|
||||
oparse = null;
|
||||
helpers.extend(global, {
|
||||
task: function(name, description, action) {
|
||||
var _a;
|
||||
var _cache;
|
||||
if (!(action)) {
|
||||
_a = [description, action];
|
||||
action = _a[0];
|
||||
description = _a[1];
|
||||
_cache = [description, action];
|
||||
action = _cache[0];
|
||||
description = _cache[1];
|
||||
}
|
||||
return (tasks[name] = {
|
||||
name: name,
|
||||
@@ -35,7 +35,7 @@
|
||||
});
|
||||
exports.run = function() {
|
||||
return path.exists('Cakefile', function(exists) {
|
||||
var _a, _b, _c, _d, arg, args;
|
||||
var _cache, _cache2, _index, _result, arg, args;
|
||||
if (!(exists)) {
|
||||
throw new Error("Cakefile not found in " + (process.cwd()));
|
||||
}
|
||||
@@ -48,27 +48,27 @@
|
||||
return printTasks();
|
||||
}
|
||||
options = oparse.parse(args);
|
||||
_a = []; _c = options.arguments;
|
||||
for (_b = 0, _d = _c.length; _b < _d; _b++) {
|
||||
arg = _c[_b];
|
||||
_a.push(invoke(arg));
|
||||
_result = []; _cache = options.arguments;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
arg = _cache[_index];
|
||||
_result.push(invoke(arg));
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
});
|
||||
};
|
||||
printTasks = function() {
|
||||
var _a, _b, desc, i, name, spaces, task;
|
||||
var _cache, _result, desc, i, name, spaces, task;
|
||||
puts('');
|
||||
_a = tasks;
|
||||
for (name in _a) {
|
||||
task = _a[name];
|
||||
_cache = tasks;
|
||||
for (name in _cache) {
|
||||
task = _cache[name];
|
||||
spaces = 20 - name.length;
|
||||
spaces = spaces > 0 ? (function() {
|
||||
_b = [];
|
||||
_result = [];
|
||||
for (i = 0; (0 <= spaces ? i <= spaces : i >= spaces); (0 <= spaces ? i += 1 : i -= 1)) {
|
||||
_b.push(' ');
|
||||
_result.push(' ');
|
||||
}
|
||||
return _b;
|
||||
return _result;
|
||||
})().join('') : '';
|
||||
desc = task.description ? ("# " + (task.description)) : '';
|
||||
puts("cake " + (name) + (spaces) + " " + (desc));
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
(function() {
|
||||
var BANNER, CoffeeScript, EventEmitter, SWITCHES, _a, _b, _c, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs;
|
||||
var BANNER, CoffeeScript, EventEmitter, SWITCHES, _cache, _cache2, _cache3, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs;
|
||||
fs = require('fs');
|
||||
path = require('path');
|
||||
optparse = require('./optparse');
|
||||
CoffeeScript = require('./coffee-script');
|
||||
_a = require('./helpers');
|
||||
helpers = _a.helpers;
|
||||
_b = require('child_process');
|
||||
spawn = _b.spawn;
|
||||
exec = _b.exec;
|
||||
_c = require('events');
|
||||
EventEmitter = _c.EventEmitter;
|
||||
_cache = require('./helpers');
|
||||
helpers = _cache.helpers;
|
||||
_cache2 = require('child_process');
|
||||
spawn = _cache2.spawn;
|
||||
exec = _cache2.exec;
|
||||
_cache3 = require('events');
|
||||
EventEmitter = _cache3.EventEmitter;
|
||||
helpers.extend(CoffeeScript, new EventEmitter());
|
||||
global.CoffeeScript = CoffeeScript;
|
||||
BANNER = 'coffee compiles CoffeeScript source files into JavaScript.\n\nUsage:\n coffee path/to/script.coffee';
|
||||
@@ -53,13 +53,13 @@
|
||||
return compileScripts();
|
||||
};
|
||||
compileScripts = function() {
|
||||
var _d, _e, _f, _g;
|
||||
_d = []; _f = sources;
|
||||
for (_e = 0, _g = _f.length; _e < _g; _e++) {
|
||||
var _cache4, _cache5, _index, _result;
|
||||
_result = []; _cache4 = sources;
|
||||
for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) {
|
||||
(function() {
|
||||
var base, compile;
|
||||
var source = _f[_e];
|
||||
return _d.push((function() {
|
||||
var source = _cache4[_index];
|
||||
return _result.push((function() {
|
||||
base = source;
|
||||
compile = function(source, topLevel) {
|
||||
return path.exists(source, function(exists) {
|
||||
@@ -69,13 +69,13 @@
|
||||
return fs.stat(source, function(err, stats) {
|
||||
if (stats.isDirectory()) {
|
||||
return fs.readdir(source, function(err, files) {
|
||||
var _h, _i, _j, _k, file;
|
||||
_h = []; _j = files;
|
||||
for (_i = 0, _k = _j.length; _i < _k; _i++) {
|
||||
file = _j[_i];
|
||||
_h.push(compile(path.join(source, file)));
|
||||
var _cache6, _cache7, _index2, _result2, file;
|
||||
_result2 = []; _cache6 = files;
|
||||
for (_index2 = 0, _cache7 = _cache6.length; _index2 < _cache7; _index2++) {
|
||||
file = _cache6[_index2];
|
||||
_result2.push(compile(path.join(source, file)));
|
||||
}
|
||||
return _h;
|
||||
return _result2;
|
||||
});
|
||||
} else if (topLevel || path.extname(source) === '.coffee') {
|
||||
fs.readFile(source, function(err, code) {
|
||||
@@ -92,16 +92,16 @@
|
||||
})());
|
||||
})();
|
||||
}
|
||||
return _d;
|
||||
return _result;
|
||||
};
|
||||
compileScript = function(file, input, base) {
|
||||
var _d, _e, _f, o, options, req, t, task;
|
||||
var _cache4, _cache5, _index, o, options, req, t, task;
|
||||
o = opts;
|
||||
options = compileOptions(file);
|
||||
if (o.require) {
|
||||
_e = o.require;
|
||||
for (_d = 0, _f = _e.length; _d < _f; _d++) {
|
||||
req = _e[_d];
|
||||
_cache4 = o.require;
|
||||
for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) {
|
||||
req = _cache4[_index];
|
||||
require(helpers.starts(req, '.') ? fs.realpathSync(req) : req);
|
||||
}
|
||||
}
|
||||
@@ -204,19 +204,19 @@
|
||||
return jsl.stdin.end();
|
||||
};
|
||||
printTokens = function(tokens) {
|
||||
var _d, _e, _f, _g, _h, strings, tag, token, value;
|
||||
var _cache4, _cache5, _cache6, _index, _result, strings, tag, token, value;
|
||||
strings = (function() {
|
||||
_d = []; _f = tokens;
|
||||
for (_e = 0, _g = _f.length; _e < _g; _e++) {
|
||||
token = _f[_e];
|
||||
_d.push((function() {
|
||||
_h = [token[0], token[1].toString().replace(/\n/, '\\n')];
|
||||
tag = _h[0];
|
||||
value = _h[1];
|
||||
_result = []; _cache4 = tokens;
|
||||
for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) {
|
||||
token = _cache4[_index];
|
||||
_result.push((function() {
|
||||
_cache6 = [token[0], token[1].toString().replace(/\n/, '\\n')];
|
||||
tag = _cache6[0];
|
||||
value = _cache6[1];
|
||||
return "[" + (tag) + " " + (value) + "]";
|
||||
})());
|
||||
}
|
||||
return _d;
|
||||
return _result;
|
||||
})();
|
||||
return puts(strings.join(' '));
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var Parser, _a, _b, _c, _d, _e, _f, _g, _h, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
|
||||
var Parser, _cache, _cache2, _cache3, _cache4, _cache5, _index, _index2, _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*\}/;
|
||||
@@ -612,18 +612,18 @@
|
||||
};
|
||||
operators = [["right", '?', 'NEW'], ["left", 'CALL_START', 'CALL_END'], ["nonassoc", '++', '--'], ["right", 'UNARY'], ["left", 'MATH'], ["left", '+', '-'], ["left", 'SHIFT'], ["left", 'COMPARE'], ["left", 'INSTANCEOF'], ["left", '==', '!='], ["left", 'LOGIC'], ["right", 'COMPOUND_ASSIGN'], ["left", '.'], ["nonassoc", 'INDENT', 'OUTDENT'], ["right", 'WHEN', 'LEADING_WHEN', 'IN', 'OF', 'BY', 'THROW'], ["right", 'IF', 'UNLESS', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'EXTENDS'], ["right", '=', ':', 'RETURN'], ["right", '->', '=>', 'UNLESS', 'POST_IF', 'POST_UNLESS']];
|
||||
tokens = [];
|
||||
_a = grammar;
|
||||
for (name in _a) {
|
||||
if (!__hasProp.call(_a, name)) continue;
|
||||
alternatives = _a[name];
|
||||
_cache = grammar;
|
||||
for (name in _cache) {
|
||||
if (!__hasProp.call(_cache, name)) continue;
|
||||
alternatives = _cache[name];
|
||||
grammar[name] = (function() {
|
||||
_b = []; _d = alternatives;
|
||||
for (_c = 0, _e = _d.length; _c < _e; _c++) {
|
||||
alt = _d[_c];
|
||||
_b.push((function() {
|
||||
_g = alt[0].split(' ');
|
||||
for (_f = 0, _h = _g.length; _f < _h; _f++) {
|
||||
token = _g[_f];
|
||||
_result = []; _cache2 = alternatives;
|
||||
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
|
||||
alt = _cache2[_index];
|
||||
_result.push((function() {
|
||||
_cache4 = alt[0].split(' ');
|
||||
for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) {
|
||||
token = _cache4[_index2];
|
||||
if (!(grammar[token])) {
|
||||
tokens.push(token);
|
||||
}
|
||||
@@ -634,7 +634,7 @@
|
||||
return alt;
|
||||
})());
|
||||
}
|
||||
return _b;
|
||||
return _result;
|
||||
})();
|
||||
}
|
||||
exports.parser = new Parser({
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
}
|
||||
helpers = (exports.helpers = {});
|
||||
helpers.indexOf = (indexOf = function(array, item, from) {
|
||||
var _a, _b, index, other;
|
||||
var _cache, _cache2, index, other;
|
||||
if (array.indexOf) {
|
||||
return array.indexOf(item, from);
|
||||
}
|
||||
_a = array;
|
||||
for (index = 0, _b = _a.length; index < _b; index++) {
|
||||
other = _a[index];
|
||||
_cache = array;
|
||||
for (index = 0, _cache2 = _cache.length; index < _cache2; index++) {
|
||||
other = _cache[index];
|
||||
if (other === item && (!from || (from <= index))) {
|
||||
return index;
|
||||
}
|
||||
@@ -30,15 +30,15 @@
|
||||
return string.substring(start, start + literal.length) === literal;
|
||||
});
|
||||
helpers.compact = (compact = function(array) {
|
||||
var _a, _b, _c, _d, item;
|
||||
_a = []; _c = array;
|
||||
for (_b = 0, _d = _c.length; _b < _d; _b++) {
|
||||
item = _c[_b];
|
||||
var _cache, _cache2, _index, _result, item;
|
||||
_result = []; _cache = array;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
item = _cache[_index];
|
||||
if (item) {
|
||||
_a.push(item);
|
||||
_result.push(item);
|
||||
}
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
});
|
||||
helpers.count = (count = function(string, letter) {
|
||||
var num, pos;
|
||||
@@ -51,37 +51,37 @@
|
||||
return num;
|
||||
});
|
||||
helpers.merge = (merge = function(options, overrides) {
|
||||
var _a, _b, fresh, key, val;
|
||||
var _cache, _cache2, fresh, key, val;
|
||||
fresh = {};
|
||||
_a = options;
|
||||
for (key in _a) {
|
||||
val = _a[key];
|
||||
_cache = options;
|
||||
for (key in _cache) {
|
||||
val = _cache[key];
|
||||
(fresh[key] = val);
|
||||
}
|
||||
if (overrides) {
|
||||
_b = overrides;
|
||||
for (key in _b) {
|
||||
val = _b[key];
|
||||
_cache2 = overrides;
|
||||
for (key in _cache2) {
|
||||
val = _cache2[key];
|
||||
(fresh[key] = val);
|
||||
}
|
||||
}
|
||||
return fresh;
|
||||
});
|
||||
helpers.extend = (extend = function(object, properties) {
|
||||
var _a, _b, key, val;
|
||||
_a = []; _b = properties;
|
||||
for (key in _b) {
|
||||
val = _b[key];
|
||||
_a.push(object[key] = val);
|
||||
var _cache, _result, key, val;
|
||||
_result = []; _cache = properties;
|
||||
for (key in _cache) {
|
||||
val = _cache[key];
|
||||
_result.push(object[key] = val);
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
});
|
||||
helpers.flatten = (flatten = function(array) {
|
||||
var _a, _b, _c, item, memo;
|
||||
var _cache, _cache2, _index, item, memo;
|
||||
memo = [];
|
||||
_b = array;
|
||||
for (_a = 0, _c = _b.length; _a < _c; _a++) {
|
||||
item = _b[_a];
|
||||
_cache = array;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
item = _cache[_index];
|
||||
if (item instanceof Array) {
|
||||
memo = memo.concat(item);
|
||||
} else {
|
||||
|
||||
10
lib/index.js
10
lib/index.js
@@ -1,10 +1,10 @@
|
||||
(function() {
|
||||
var _a, key, val;
|
||||
var _cache, key, val;
|
||||
var __hasProp = Object.prototype.hasOwnProperty;
|
||||
_a = require('./coffee-script');
|
||||
for (key in _a) {
|
||||
if (!__hasProp.call(_a, key)) continue;
|
||||
val = _a[key];
|
||||
_cache = require('./coffee-script');
|
||||
for (key in _cache) {
|
||||
if (!__hasProp.call(_cache, key)) continue;
|
||||
val = _cache[key];
|
||||
(exports[key] = val);
|
||||
}
|
||||
})();
|
||||
|
||||
72
lib/lexer.js
72
lib/lexer.js
@@ -1,21 +1,21 @@
|
||||
(function() {
|
||||
var ASSIGNED, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, CONVERSIONS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, SHIFT, UNARY, WHITESPACE, _a, _b, _c, compact, count, helpers, include, starts;
|
||||
var ASSIGNED, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, CONVERSIONS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, SHIFT, UNARY, WHITESPACE, _cache, _cache2, _cache3, compact, count, helpers, include, starts;
|
||||
var __slice = Array.prototype.slice;
|
||||
if (typeof process !== "undefined" && process !== null) {
|
||||
_a = require('./rewriter');
|
||||
Rewriter = _a.Rewriter;
|
||||
_b = require('./helpers');
|
||||
helpers = _b.helpers;
|
||||
_cache = require('./rewriter');
|
||||
Rewriter = _cache.Rewriter;
|
||||
_cache2 = require('./helpers');
|
||||
helpers = _cache2.helpers;
|
||||
} else {
|
||||
this.exports = this;
|
||||
Rewriter = this.Rewriter;
|
||||
helpers = this.helpers;
|
||||
}
|
||||
_c = helpers;
|
||||
include = _c.include;
|
||||
count = _c.count;
|
||||
starts = _c.starts;
|
||||
compact = _c.compact;
|
||||
_cache3 = helpers;
|
||||
include = _cache3.include;
|
||||
count = _cache3.count;
|
||||
starts = _cache3.starts;
|
||||
compact = _cache3.compact;
|
||||
exports.Lexer = (function() {
|
||||
Lexer = function() {};
|
||||
Lexer.prototype.tokenize = function(code, options) {
|
||||
@@ -192,11 +192,11 @@
|
||||
return true;
|
||||
};
|
||||
Lexer.prototype.regexToken = function() {
|
||||
var _d, end, first, flags, regex, str;
|
||||
var _cache4, end, first, flags, regex, str;
|
||||
if (!(first = this.chunk.match(REGEX_START))) {
|
||||
return false;
|
||||
}
|
||||
if (first[1] === ' ' && !('CALL_START' === (_d = this.tag()) || '=' === _d)) {
|
||||
if (first[1] === ' ' && !('CALL_START' === (_cache4 = this.tag()) || '=' === _cache4)) {
|
||||
return false;
|
||||
}
|
||||
if (include(NOT_REGEX, this.tag())) {
|
||||
@@ -320,7 +320,7 @@
|
||||
return true;
|
||||
};
|
||||
Lexer.prototype.literalToken = function() {
|
||||
var _d, match, prev, space, spaced, tag, value;
|
||||
var _cache4, match, prev, space, spaced, tag, value;
|
||||
match = this.chunk.match(OPERATOR);
|
||||
value = match && match[1];
|
||||
space = match && match[2];
|
||||
@@ -335,7 +335,7 @@
|
||||
if (include(JS_FORBIDDEN, this.value())) {
|
||||
this.assignmentError();
|
||||
}
|
||||
if (('or' === (_d = this.value()) || 'and' === _d)) {
|
||||
if (('or' === (_cache4 = this.value()) || 'and' === _cache4)) {
|
||||
this.tokens.splice(this.tokens.length - 1, 1, ['COMPOUND_ASSIGN', CONVERSIONS[this.value()] + '=', prev[2]]);
|
||||
return true;
|
||||
}
|
||||
@@ -395,14 +395,14 @@
|
||||
return accessor ? 'accessor' : false;
|
||||
};
|
||||
Lexer.prototype.sanitizeHeredoc = function(doc, options) {
|
||||
var _d, attempt, indent, match;
|
||||
var _cache4, attempt, indent, match;
|
||||
indent = options.indent;
|
||||
if (options.herecomment && !include(doc, '\n')) {
|
||||
return doc;
|
||||
}
|
||||
if (!(options.herecomment)) {
|
||||
while ((match = HEREDOC_INDENT.exec(doc)) !== null) {
|
||||
attempt = (typeof (_d = match[2]) !== "undefined" && _d !== null) ? match[2] : match[3];
|
||||
attempt = (typeof (_cache4 = match[2]) !== "undefined" && _cache4 !== null) ? match[2] : match[3];
|
||||
if (!(typeof indent !== "undefined" && indent !== null) || attempt.length < indent.length) {
|
||||
indent = attempt;
|
||||
}
|
||||
@@ -451,7 +451,7 @@
|
||||
throw new Error("SyntaxError: Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned");
|
||||
};
|
||||
Lexer.prototype.balancedString = function(str, delimited, options) {
|
||||
var _d, _e, _f, _g, close, i, levels, open, pair, slash;
|
||||
var _cache4, _cache5, _cache6, _index, close, i, levels, open, pair, slash;
|
||||
options || (options = {});
|
||||
slash = delimited[0][0] === '/';
|
||||
levels = [];
|
||||
@@ -460,12 +460,12 @@
|
||||
if (levels.length && starts(str, '\\', i)) {
|
||||
i += 1;
|
||||
} else {
|
||||
_e = delimited;
|
||||
for (_d = 0, _f = _e.length; _d < _f; _d++) {
|
||||
pair = _e[_d];
|
||||
_g = pair;
|
||||
open = _g[0];
|
||||
close = _g[1];
|
||||
_cache4 = delimited;
|
||||
for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) {
|
||||
pair = _cache4[_index];
|
||||
_cache6 = pair;
|
||||
open = _cache6[0];
|
||||
close = _cache6[1];
|
||||
if (levels.length && starts(str, close, i) && levels[levels.length - 1] === pair) {
|
||||
levels.pop();
|
||||
i += close.length - 1;
|
||||
@@ -494,7 +494,7 @@
|
||||
return !i ? false : str.substring(0, i);
|
||||
};
|
||||
Lexer.prototype.interpolateString = function(str, options) {
|
||||
var _d, _e, _f, _g, _h, _i, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value;
|
||||
var _cache4, _cache5, _cache6, _cache7, _cache8, _cache9, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value;
|
||||
options || (options = {});
|
||||
if (str.length < 3 || !starts(str, '"')) {
|
||||
return this.token('STRING', str);
|
||||
@@ -502,9 +502,9 @@
|
||||
lexer = new Lexer();
|
||||
tokens = [];
|
||||
quote = str.substring(0, 1);
|
||||
_d = [1, 1];
|
||||
i = _d[0];
|
||||
pi = _d[1];
|
||||
_cache4 = [1, 1];
|
||||
i = _cache4[0];
|
||||
pi = _cache4[1];
|
||||
while (i < str.length - 1) {
|
||||
if (starts(str, '\\', i)) {
|
||||
i += 1;
|
||||
@@ -520,9 +520,9 @@
|
||||
nested = lexer.tokenize("(" + (inner) + ")", {
|
||||
line: this.line
|
||||
});
|
||||
_e = nested;
|
||||
for (idx = 0, _f = _e.length; idx < _f; idx++) {
|
||||
tok = _e[idx];
|
||||
_cache5 = nested;
|
||||
for (idx = 0, _cache6 = _cache5.length; idx < _cache6; idx++) {
|
||||
tok = _cache5[idx];
|
||||
if (tok[0] === 'CALL_END') {
|
||||
(tok[0] = ')');
|
||||
}
|
||||
@@ -547,12 +547,12 @@
|
||||
if (interpolated) {
|
||||
this.token('(', '(');
|
||||
}
|
||||
_g = tokens;
|
||||
for (i = 0, _h = _g.length; i < _h; i++) {
|
||||
token = _g[i];
|
||||
_i = token;
|
||||
tag = _i[0];
|
||||
value = _i[1];
|
||||
_cache7 = tokens;
|
||||
for (i = 0, _cache8 = _cache7.length; i < _cache8; i++) {
|
||||
token = _cache7[i];
|
||||
_cache9 = token;
|
||||
tag = _cache9[0];
|
||||
value = _cache9[1];
|
||||
if (tag === 'TOKENS') {
|
||||
this.tokens = this.tokens.concat(value);
|
||||
} else if (tag === 'STRING' && options.escapeQuotes) {
|
||||
|
||||
618
lib/nodes.js
618
lib/nodes.js
File diff suppressed because it is too large
Load Diff
@@ -7,19 +7,19 @@
|
||||
return this;
|
||||
};
|
||||
OptionParser.prototype.parse = function(args) {
|
||||
var _a, _b, _c, _d, _e, arg, i, isOption, matchedRule, options, rule, value;
|
||||
var _cache, _cache2, _cache3, _cache4, _index, arg, i, isOption, matchedRule, options, rule, value;
|
||||
options = {
|
||||
arguments: []
|
||||
};
|
||||
args = normalizeArguments(args);
|
||||
_a = args;
|
||||
for (i = 0, _b = _a.length; i < _b; i++) {
|
||||
arg = _a[i];
|
||||
_cache = args;
|
||||
for (i = 0, _cache2 = _cache.length; i < _cache2; i++) {
|
||||
arg = _cache[i];
|
||||
isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG));
|
||||
matchedRule = false;
|
||||
_d = this.rules;
|
||||
for (_c = 0, _e = _d.length; _c < _e; _c++) {
|
||||
rule = _d[_c];
|
||||
_cache3 = this.rules;
|
||||
for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) {
|
||||
rule = _cache3[_index];
|
||||
if (rule.shortFlag === arg || rule.longFlag === arg) {
|
||||
value = rule.hasArgument ? args[i += 1] : true;
|
||||
options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value;
|
||||
@@ -38,21 +38,21 @@
|
||||
return options;
|
||||
};
|
||||
OptionParser.prototype.help = function() {
|
||||
var _a, _b, _c, _d, i, letPart, lines, rule, spaces;
|
||||
var _cache, _cache2, _index, _result, i, letPart, lines, rule, spaces;
|
||||
lines = ['Available options:'];
|
||||
if (this.banner) {
|
||||
lines.unshift("" + (this.banner) + "\n");
|
||||
}
|
||||
_b = this.rules;
|
||||
for (_a = 0, _c = _b.length; _a < _c; _a++) {
|
||||
rule = _b[_a];
|
||||
_cache = this.rules;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
rule = _cache[_index];
|
||||
spaces = 15 - rule.longFlag.length;
|
||||
spaces = spaces > 0 ? (function() {
|
||||
_d = [];
|
||||
_result = [];
|
||||
for (i = 0; (0 <= spaces ? i <= spaces : i >= spaces); (0 <= spaces ? i += 1 : i -= 1)) {
|
||||
_d.push(' ');
|
||||
_result.push(' ');
|
||||
}
|
||||
return _d;
|
||||
return _result;
|
||||
})().join('') : '';
|
||||
letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' ';
|
||||
lines.push(' ' + letPart + rule.longFlag + spaces + rule.description);
|
||||
@@ -66,18 +66,18 @@
|
||||
MULTI_FLAG = /^-(\w{2,})/;
|
||||
OPTIONAL = /\[(\w+(\*?))\]/;
|
||||
buildRules = function(rules) {
|
||||
var _a, _b, _c, _d, tuple;
|
||||
_a = []; _c = rules;
|
||||
for (_b = 0, _d = _c.length; _b < _d; _b++) {
|
||||
tuple = _c[_b];
|
||||
_a.push((function() {
|
||||
var _cache, _cache2, _index, _result, tuple;
|
||||
_result = []; _cache = rules;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
tuple = _cache[_index];
|
||||
_result.push((function() {
|
||||
if (tuple.length < 3) {
|
||||
tuple.unshift(null);
|
||||
}
|
||||
return buildRule.apply(this, tuple);
|
||||
})());
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
};
|
||||
buildRule = function(shortFlag, longFlag, description, options) {
|
||||
var match;
|
||||
@@ -94,16 +94,16 @@
|
||||
};
|
||||
};
|
||||
normalizeArguments = function(args) {
|
||||
var _a, _b, _c, _d, _e, _f, arg, l, match, result;
|
||||
var _cache, _cache2, _cache3, _cache4, _index, _index2, arg, l, match, result;
|
||||
args = args.slice(0);
|
||||
result = [];
|
||||
_b = args;
|
||||
for (_a = 0, _c = _b.length; _a < _c; _a++) {
|
||||
arg = _b[_a];
|
||||
_cache = args;
|
||||
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
|
||||
arg = _cache[_index];
|
||||
if (match = arg.match(MULTI_FLAG)) {
|
||||
_e = match[1].split('');
|
||||
for (_d = 0, _f = _e.length; _d < _f; _d++) {
|
||||
l = _e[_d];
|
||||
_cache3 = match[1].split('');
|
||||
for (_index2 = 0, _cache4 = _cache3.length; _index2 < _cache4; _index2++) {
|
||||
l = _cache3[_index2];
|
||||
result.push('-' + l);
|
||||
}
|
||||
} else {
|
||||
|
||||
140
lib/rewriter.js
140
lib/rewriter.js
@@ -1,15 +1,15 @@
|
||||
(function() {
|
||||
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, helpers, include, pair;
|
||||
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _cache, _cache2, _cache3, _cache4, _cache5, _cache6, _cache7, _cache8, _index, _index2, _index3, _result, _result2, helpers, include, pair;
|
||||
var __hasProp = Object.prototype.hasOwnProperty;
|
||||
if (typeof process !== "undefined" && process !== null) {
|
||||
_a = require('./helpers');
|
||||
helpers = _a.helpers;
|
||||
_cache = require('./helpers');
|
||||
helpers = _cache.helpers;
|
||||
} else {
|
||||
this.exports = this;
|
||||
helpers = this.helpers;
|
||||
}
|
||||
_b = helpers;
|
||||
include = _b.include;
|
||||
_cache2 = helpers;
|
||||
include = _cache2.include;
|
||||
exports.Rewriter = (function() {
|
||||
Rewriter = function() {};
|
||||
Rewriter.prototype.rewrite = function(tokens) {
|
||||
@@ -62,15 +62,15 @@
|
||||
};
|
||||
Rewriter.prototype.adjustComments = function() {
|
||||
return this.scanTokens(function(token, i) {
|
||||
var _c, _d, after, before, post, prev;
|
||||
var _cache3, _cache4, after, before, post, prev;
|
||||
if (token[0] !== 'HERECOMMENT') {
|
||||
return 1;
|
||||
}
|
||||
_c = [this.tokens[i - 2], this.tokens[i - 1], this.tokens[i + 1], this.tokens[i + 2]];
|
||||
before = _c[0];
|
||||
prev = _c[1];
|
||||
post = _c[2];
|
||||
after = _c[3];
|
||||
_cache3 = [this.tokens[i - 2], this.tokens[i - 1], this.tokens[i + 1], this.tokens[i + 2]];
|
||||
before = _cache3[0];
|
||||
prev = _cache3[1];
|
||||
post = _cache3[2];
|
||||
after = _cache3[3];
|
||||
if (after && after[0] === 'INDENT') {
|
||||
this.tokens.splice(i + 2, 1);
|
||||
if (before && before[0] === 'OUTDENT' && post && (prev[0] === post[0]) && (post[0] === 'TERMINATOR')) {
|
||||
@@ -78,7 +78,7 @@
|
||||
} else {
|
||||
this.tokens.splice(i, 0, after);
|
||||
}
|
||||
} else if (prev && !('TERMINATOR' === (_d = prev[0]) || 'INDENT' === _d || 'OUTDENT' === _d)) {
|
||||
} else if (prev && !('TERMINATOR' === (_cache4 = prev[0]) || 'INDENT' === _cache4 || 'OUTDENT' === _cache4)) {
|
||||
if (post && post[0] === 'TERMINATOR' && after && after[0] === 'OUTDENT') {
|
||||
this.tokens.splice.apply(this.tokens, [i + 2, 0].concat(this.tokens.splice(i, 2)));
|
||||
if (this.tokens[i + 2][0] !== 'TERMINATOR') {
|
||||
@@ -93,12 +93,12 @@
|
||||
});
|
||||
};
|
||||
Rewriter.prototype.removeLeadingNewlines = function() {
|
||||
var _c;
|
||||
_c = [];
|
||||
var _result;
|
||||
_result = [];
|
||||
while (this.tokens[0] && this.tokens[0][0] === 'TERMINATOR') {
|
||||
_c.push(this.tokens.shift());
|
||||
_result.push(this.tokens.shift());
|
||||
}
|
||||
return _c;
|
||||
return _result;
|
||||
};
|
||||
Rewriter.prototype.removeMidExpressionNewlines = function() {
|
||||
return this.scanTokens(function(token, i) {
|
||||
@@ -114,8 +114,8 @@
|
||||
var action, condition;
|
||||
if (token[0] === 'CALL_START') {
|
||||
condition = function(token, i) {
|
||||
var _c;
|
||||
return ((')' === (_c = token[0]) || 'CALL_END' === _c)) || (token[0] === 'OUTDENT' && this.tokens[i - 1][0] === ')');
|
||||
var _cache3;
|
||||
return ((')' === (_cache3 = token[0]) || 'CALL_END' === _cache3)) || (token[0] === 'OUTDENT' && this.tokens[i - 1][0] === ')');
|
||||
};
|
||||
action = function(token, i) {
|
||||
var idx;
|
||||
@@ -132,8 +132,8 @@
|
||||
var action, condition;
|
||||
if (token[0] === 'INDEX_START') {
|
||||
condition = function(token, i) {
|
||||
var _c;
|
||||
return (']' === (_c = token[0]) || 'INDEX_END' === _c);
|
||||
var _cache3;
|
||||
return (']' === (_cache3 = token[0]) || 'INDEX_END' === _cache3);
|
||||
};
|
||||
action = function(token, i) {
|
||||
return (token[0] = 'INDEX_END');
|
||||
@@ -162,15 +162,15 @@
|
||||
tok.generated = true;
|
||||
this.tokens.splice(idx, 0, tok);
|
||||
condition = function(token, i) {
|
||||
var _c, _d, _e, one, three, two;
|
||||
_c = this.tokens.slice(i + 1, i + 4);
|
||||
one = _c[0];
|
||||
two = _c[1];
|
||||
three = _c[2];
|
||||
var _cache3, _cache4, _cache5, one, three, two;
|
||||
_cache3 = this.tokens.slice(i + 1, i + 4);
|
||||
one = _cache3[0];
|
||||
two = _cache3[1];
|
||||
three = _cache3[2];
|
||||
if ((this.tag(i + 1) === 'HERECOMMENT' || this.tag(i - 1) === 'HERECOMMENT')) {
|
||||
return false;
|
||||
}
|
||||
return ((('TERMINATOR' === (_d = token[0]) || 'OUTDENT' === _d)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_e = one[0]) || 'STRING' === _e || '@' === _e || 'TERMINATOR' === _e || 'OUTDENT' === _e)));
|
||||
return ((('TERMINATOR' === (_cache4 = token[0]) || 'OUTDENT' === _cache4)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_cache5 = one[0]) || 'STRING' === _cache5 || '@' === _cache5 || 'TERMINATOR' === _cache5 || 'OUTDENT' === _cache5)));
|
||||
};
|
||||
action = function(token, i) {
|
||||
return this.tokens.splice(i, 0, ['}', '}', token[2]]);
|
||||
@@ -185,7 +185,7 @@
|
||||
var classLine;
|
||||
classLine = false;
|
||||
return this.scanTokens(function(token, i) {
|
||||
var _c, action, callObject, condition, idx, next, prev, seenSingle;
|
||||
var _cache3, action, callObject, condition, idx, next, prev, seenSingle;
|
||||
if (token[0] === 'CLASS') {
|
||||
classLine = true;
|
||||
}
|
||||
@@ -203,14 +203,14 @@
|
||||
if (prev && !prev.spaced && token[0] === '?') {
|
||||
token.call = true;
|
||||
}
|
||||
if (prev && (prev.spaced && (include(IMPLICIT_FUNC, prev[0]) || prev.call) && include(IMPLICIT_CALL, token[0]) && !(token[0] === 'UNARY' && (('IN' === (_c = this.tag(i + 1)) || 'OF' === _c || 'INSTANCEOF' === _c)))) || callObject) {
|
||||
if (prev && (prev.spaced && (include(IMPLICIT_FUNC, prev[0]) || prev.call) && include(IMPLICIT_CALL, token[0]) && !(token[0] === 'UNARY' && (('IN' === (_cache3 = this.tag(i + 1)) || 'OF' === _cache3 || 'INSTANCEOF' === _cache3)))) || callObject) {
|
||||
this.tokens.splice(i, 0, ['CALL_START', '(', token[2]]);
|
||||
condition = function(token, i) {
|
||||
var _c;
|
||||
var _cache3;
|
||||
if (!seenSingle && token.fromThen) {
|
||||
return true;
|
||||
}
|
||||
if (('IF' === (_c = token[0]) || 'ELSE' === _c || 'UNLESS' === _c || '->' === _c || '=>' === _c)) {
|
||||
if (('IF' === (_cache3 = token[0]) || 'ELSE' === _cache3 || 'UNLESS' === _cache3 || '->' === _cache3 || '=>' === _cache3)) {
|
||||
seenSingle = true;
|
||||
}
|
||||
return (!token.generated && this.tokens[i - 1][0] !== ',' && include(IMPLICIT_END, token[0]) && !(token[0] === 'INDENT' && (include(IMPLICIT_BLOCK, this.tag(i - 1)) || this.tag(i - 2) === 'CLASS' || this.tag(i + 1) === '{'))) || token[0] === 'PROPERTY_ACCESS' && this.tag(i - 1) === 'OUTDENT';
|
||||
@@ -230,7 +230,7 @@
|
||||
};
|
||||
Rewriter.prototype.addImplicitIndentation = function() {
|
||||
return this.scanTokens(function(token, i) {
|
||||
var _c, action, condition, indent, outdent, starter;
|
||||
var _cache3, action, condition, indent, outdent, starter;
|
||||
if (token[0] === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
|
||||
this.tokens.splice.apply(this.tokens, [i, 0].concat(this.indentation(token)));
|
||||
return 2;
|
||||
@@ -241,9 +241,9 @@
|
||||
}
|
||||
if (include(SINGLE_LINERS, token[0]) && this.tag(i + 1) !== 'INDENT' && !(token[0] === 'ELSE' && this.tag(i + 1) === 'IF')) {
|
||||
starter = token[0];
|
||||
_c = this.indentation(token);
|
||||
indent = _c[0];
|
||||
outdent = _c[1];
|
||||
_cache3 = this.indentation(token);
|
||||
indent = _cache3[0];
|
||||
outdent = _cache3[1];
|
||||
if (starter === 'THEN') {
|
||||
indent.fromThen = true;
|
||||
}
|
||||
@@ -268,12 +268,12 @@
|
||||
};
|
||||
Rewriter.prototype.tagPostfixConditionals = function() {
|
||||
return this.scanTokens(function(token, i) {
|
||||
var _c, action, condition, original;
|
||||
if (('IF' === (_c = token[0]) || 'UNLESS' === _c)) {
|
||||
var _cache3, action, condition, original;
|
||||
if (('IF' === (_cache3 = token[0]) || 'UNLESS' === _cache3)) {
|
||||
original = token;
|
||||
condition = function(token, i) {
|
||||
var _c;
|
||||
return ('TERMINATOR' === (_c = token[0]) || 'INDENT' === _c);
|
||||
var _cache3;
|
||||
return ('TERMINATOR' === (_cache3 = token[0]) || 'INDENT' === _cache3);
|
||||
};
|
||||
action = function(token, i) {
|
||||
if (token[0] !== 'INDENT') {
|
||||
@@ -287,17 +287,17 @@
|
||||
});
|
||||
};
|
||||
Rewriter.prototype.ensureBalance = function(pairs) {
|
||||
var _c, _d, key, levels, line, open, openLine, unclosed, value;
|
||||
var _cache3, _result, key, levels, line, open, openLine, unclosed, value;
|
||||
levels = {};
|
||||
openLine = {};
|
||||
this.scanTokens(function(token, i) {
|
||||
var _c, _d, _e, _f, close, open, pair;
|
||||
_d = pairs;
|
||||
for (_c = 0, _e = _d.length; _c < _e; _c++) {
|
||||
pair = _d[_c];
|
||||
_f = pair;
|
||||
open = _f[0];
|
||||
close = _f[1];
|
||||
var _cache3, _cache4, _cache5, _index, close, open, pair;
|
||||
_cache3 = pairs;
|
||||
for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) {
|
||||
pair = _cache3[_index];
|
||||
_cache5 = pair;
|
||||
open = _cache5[0];
|
||||
close = _cache5[1];
|
||||
levels[open] || (levels[open] = 0);
|
||||
if (token[0] === open) {
|
||||
if (levels[open] === 0) {
|
||||
@@ -315,15 +315,15 @@
|
||||
return 1;
|
||||
});
|
||||
unclosed = (function() {
|
||||
_c = []; _d = levels;
|
||||
for (key in _d) {
|
||||
if (!__hasProp.call(_d, key)) continue;
|
||||
value = _d[key];
|
||||
_result = []; _cache3 = levels;
|
||||
for (key in _cache3) {
|
||||
if (!__hasProp.call(_cache3, key)) continue;
|
||||
value = _cache3[key];
|
||||
if (value > 0) {
|
||||
_c.push(key);
|
||||
_result.push(key);
|
||||
}
|
||||
}
|
||||
return _c;
|
||||
return _result;
|
||||
})();
|
||||
if (unclosed.length) {
|
||||
open = unclosed[0];
|
||||
@@ -332,13 +332,13 @@
|
||||
}
|
||||
};
|
||||
Rewriter.prototype.rewriteClosingParens = function() {
|
||||
var _c, debt, key, stack, val;
|
||||
var _cache3, debt, key, stack, val;
|
||||
stack = [];
|
||||
debt = {};
|
||||
_c = INVERSES;
|
||||
for (key in _c) {
|
||||
if (!__hasProp.call(_c, key)) continue;
|
||||
val = _c[key];
|
||||
_cache3 = INVERSES;
|
||||
for (key in _cache3) {
|
||||
if (!__hasProp.call(_cache3, key)) continue;
|
||||
val = _cache3[key];
|
||||
(debt[key] = 0);
|
||||
}
|
||||
return this.scanTokens(function(token, i) {
|
||||
@@ -385,27 +385,27 @@
|
||||
})();
|
||||
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['PARAM_START', 'PARAM_END'], ['CALL_START', 'CALL_END'], ['INDEX_START', 'INDEX_END']];
|
||||
INVERSES = {};
|
||||
_d = BALANCED_PAIRS;
|
||||
for (_c = 0, _e = _d.length; _c < _e; _c++) {
|
||||
pair = _d[_c];
|
||||
_cache3 = BALANCED_PAIRS;
|
||||
for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) {
|
||||
pair = _cache3[_index];
|
||||
INVERSES[pair[0]] = pair[1];
|
||||
INVERSES[pair[1]] = pair[0];
|
||||
}
|
||||
EXPRESSION_START = (function() {
|
||||
_f = []; _h = BALANCED_PAIRS;
|
||||
for (_g = 0, _i = _h.length; _g < _i; _g++) {
|
||||
pair = _h[_g];
|
||||
_f.push(pair[0]);
|
||||
_result = []; _cache5 = BALANCED_PAIRS;
|
||||
for (_index2 = 0, _cache6 = _cache5.length; _index2 < _cache6; _index2++) {
|
||||
pair = _cache5[_index2];
|
||||
_result.push(pair[0]);
|
||||
}
|
||||
return _f;
|
||||
return _result;
|
||||
})();
|
||||
EXPRESSION_END = (function() {
|
||||
_j = []; _l = BALANCED_PAIRS;
|
||||
for (_k = 0, _m = _l.length; _k < _m; _k++) {
|
||||
pair = _l[_k];
|
||||
_j.push(pair[1]);
|
||||
_result2 = []; _cache7 = BALANCED_PAIRS;
|
||||
for (_index3 = 0, _cache8 = _cache7.length; _index3 < _cache8; _index3++) {
|
||||
pair = _cache7[_index3];
|
||||
_result2.push(pair[1]);
|
||||
}
|
||||
return _j;
|
||||
return _result2;
|
||||
})();
|
||||
EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
|
||||
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
|
||||
|
||||
56
lib/scope.js
56
lib/scope.js
@@ -6,20 +6,20 @@
|
||||
}
|
||||
exports.Scope = (function() {
|
||||
Scope = function(parent, expressions, method) {
|
||||
var _a, _b, k, val;
|
||||
_a = [parent, expressions, method];
|
||||
this.parent = _a[0];
|
||||
this.expressions = _a[1];
|
||||
this.method = _a[2];
|
||||
var _cache, _cache2, k, val;
|
||||
_cache = [parent, expressions, method];
|
||||
this.parent = _cache[0];
|
||||
this.expressions = _cache[1];
|
||||
this.method = _cache[2];
|
||||
this.variables = {};
|
||||
this.tempVars = {
|
||||
general: '_a'
|
||||
};
|
||||
if (this.parent) {
|
||||
_b = this.parent.tempVars;
|
||||
for (k in _b) {
|
||||
if (!__hasProp.call(_b, k)) continue;
|
||||
val = _b[k];
|
||||
_cache2 = this.parent.tempVars;
|
||||
for (k in _cache2) {
|
||||
if (!__hasProp.call(_cache2, k)) continue;
|
||||
val = _cache2[k];
|
||||
(this.tempVars[k] = val);
|
||||
}
|
||||
} else {
|
||||
@@ -36,11 +36,11 @@
|
||||
return false;
|
||||
};
|
||||
Scope.prototype.any = function(fn) {
|
||||
var _a, k, v;
|
||||
_a = this.variables;
|
||||
for (v in _a) {
|
||||
if (!__hasProp.call(_a, v)) continue;
|
||||
k = _a[v];
|
||||
var _cache, k, v;
|
||||
_cache = this.variables;
|
||||
for (v in _cache) {
|
||||
if (!__hasProp.call(_cache, v)) continue;
|
||||
k = _cache[v];
|
||||
if (fn(v, k)) {
|
||||
return true;
|
||||
}
|
||||
@@ -95,30 +95,30 @@
|
||||
});
|
||||
};
|
||||
Scope.prototype.declaredVariables = function() {
|
||||
var _a, _b, key, val;
|
||||
var _cache, _result, key, val;
|
||||
return (function() {
|
||||
_a = []; _b = this.variables;
|
||||
for (key in _b) {
|
||||
if (!__hasProp.call(_b, key)) continue;
|
||||
val = _b[key];
|
||||
_result = []; _cache = this.variables;
|
||||
for (key in _cache) {
|
||||
if (!__hasProp.call(_cache, key)) continue;
|
||||
val = _cache[key];
|
||||
if (val === 'var') {
|
||||
_a.push(key);
|
||||
_result.push(key);
|
||||
}
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
}).call(this).sort();
|
||||
};
|
||||
Scope.prototype.assignedVariables = function() {
|
||||
var _a, _b, key, val;
|
||||
_a = []; _b = this.variables;
|
||||
for (key in _b) {
|
||||
if (!__hasProp.call(_b, key)) continue;
|
||||
val = _b[key];
|
||||
var _cache, _result, key, val;
|
||||
_result = []; _cache = this.variables;
|
||||
for (key in _cache) {
|
||||
if (!__hasProp.call(_cache, key)) continue;
|
||||
val = _cache[key];
|
||||
if (val.assigned) {
|
||||
_a.push("" + (key) + " = " + (val.value));
|
||||
_result.push("" + (key) + " = " + (val.value));
|
||||
}
|
||||
}
|
||||
return _a;
|
||||
return _result;
|
||||
};
|
||||
Scope.prototype.compiledDeclarations = function() {
|
||||
return this.declaredVariables().join(', ');
|
||||
|
||||
Reference in New Issue
Block a user