Socket
Socket
Sign inDemoInstall

coffeescript

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeescript - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

51

lib/coffeescript/browser.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -80,3 +80,3 @@ // This **Browser** compatibility layer extends core CoffeeScript functions

runScripts = function() {
var coffees, coffeetypes, execute, fn, i, index, j, len, s, script, scripts;
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');

@@ -105,28 +105,27 @@ coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];

};
fn = function(script, i) {
var options, source;
options = {
literate: script.type === coffeetypes[1]
};
source = script.src || script.getAttribute('data-src');
if (source) {
options.filename = source;
return CoffeeScript.load(source, function(param) {
coffees[i] = param;
return execute();
}, options, true);
} else {
// `options.filename` defines the filename the source map appears as
// in Developer Tools. If a script tag has an `id`, use that as the
// filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
// leaving the first one unnumbered for the common case that there’s
// only one CoffeeScript script block to parse.
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
options.sourceFiles = ['embedded'];
return coffees[i] = [script.innerHTML, options];
}
};
for (i = j = 0, len = coffees.length; j < len; i = ++j) {
script = coffees[i];
fn(script, i);
(function(script, i) {
var options, source;
options = {
literate: script.type === coffeetypes[1]
};
source = script.src || script.getAttribute('data-src');
if (source) {
options.filename = source;
return CoffeeScript.load(source, function(param) {
coffees[i] = param;
return execute();
}, options, true);
} else {
// `options.filename` defines the filename the source map appears as
// in Developer Tools. If a script tag has an `id`, use that as the
// filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
// leaving the first one unnumbered for the common case that there’s
// only one CoffeeScript script block to parse.
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
options.sourceFiles = ['embedded'];
return coffees[i] = [script.innerHTML, options];
}
})(script, i);
}

@@ -133,0 +132,0 @@ return execute();

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // `cake` is a simplified version of [Make](http://www.gnu.org/software/make/)

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // CoffeeScript can be used both on the server, as a command-line compiler based

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // The `coffee` utility. Handles command-line compilation of CoffeeScript

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -100,3 +100,3 @@ // The CoffeeScript parser is generated by [Jison](https://github.com/zaach/jison)

// grammar.
Line: [o('Expression'), o('Statement'), o('FuncDirective')],
Line: [o('Expression'), o('ExpressionLine'), o('Statement'), o('FuncDirective')],
FuncDirective: [o('YieldReturn'), o('AwaitReturn')],

@@ -118,2 +118,6 @@ // Pure statements which cannot be expressions.

Expression: [o('Value'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw'), o('Yield')],
// Expressions which are written in single line and would otherwise require being
// wrapped in braces: E.g `a = b if do -> f a is 1`, `if f (a) -> a*2 then ...`,
// `for x in do (obj) -> f obj when x > 8 then f x`
ExpressionLine: [o('CodeLine'), o('IfLine'), o('OperationLine')],
Yield: [

@@ -412,2 +416,18 @@ o('YIELD',

],
// The Codeline is the **Code** node with **Line** instead of indented **Block**.
CodeLine: [
o('PARAM_START ParamList PARAM_END FuncGlyph Line',
function() {
return new Code($2,
LOC(5)(Block.wrap([$5])),
$4,
LOC(1)(new Literal($1)));
}),
o('FuncGlyph Line',
function() {
return new Code([],
LOC(2)(Block.wrap([$2])),
$1);
})
],
// CoffeeScript has two different symbols for functions. `->` is for ordinary

@@ -996,2 +1016,8 @@ // functions, and `=>` is for functions bound to the current value of *this*.

$3);
}),
o('[ ExpressionLine RangeDots Expression ]',
function() {
return new Range($2,
$4,
$3);
})

@@ -1013,2 +1039,14 @@ ],

}),
o('ExpressionLine RangeDots Expression',
function() {
return new Range($1,
$3,
$2);
}),
o('ExpressionLine RangeDots',
function() {
return new Range($1,
null,
$2);
}),
o('RangeDots Expression',

@@ -1054,2 +1092,3 @@ function() {

o('Expression'),
o('ExpressionLine'),
o('Splat'),

@@ -1126,2 +1165,3 @@ o('...',

o('Expression'),
o('ExpressionLine'),
o('SimpleArgs , Expression',

@@ -1131,2 +1171,7 @@ function() {

$3);
}),
o('SimpleArgs , ExpressionLine',
function() {
return [].concat($1,
$3);
})

@@ -1205,2 +1250,30 @@ ],

// The condition portion of a while loop.
WhileLineSource: [
o('WHILE ExpressionLine',
function() {
return new While($2);
}),
o('WHILE ExpressionLine WHEN ExpressionLine',
function() {
return new While($2,
{
guard: $4
});
}),
o('UNTIL ExpressionLine',
function() {
return new While($2,
{
invert: true
});
}),
o('UNTIL ExpressionLine WHEN ExpressionLine',
function() {
return new While($2,
{
invert: true,
guard: $4
});
})
],
WhileSource: [

@@ -1218,2 +1291,9 @@ o('WHILE Expression',

}),
o('WHILE ExpressionLine WHEN Expression',
function() {
return new While($2,
{
guard: $4
});
}),
o('UNTIL Expression',

@@ -1233,2 +1313,10 @@ function() {

});
}),
o('UNTIL ExpressionLine WHEN Expression',
function() {
return new While($2,
{
invert: true,
guard: $4
});
})

@@ -1243,2 +1331,6 @@ ],

}),
o('WhileLineSource Block',
function() {
return $1.addBody($2);
}),
o('Statement WhileSource',

@@ -1285,2 +1377,7 @@ function() {

$1);
}),
o('ForLineBody Block',
function() {
return new For($2,
$1);
})

@@ -1311,2 +1408,19 @@ ],

],
ForLineBody: [
o('FOR Range BY ExpressionLine',
function() {
return {
source: LOC(2)(new Value($2)),
step: $4
};
}),
o('ForStart ForLineSource',
function() {
$2.own = $1.own;
$2.ownTag = $1.ownTag;
$2.name = $1[0];
$2.index = $1[1];
return $2;
})
],
ForStart: [

@@ -1376,2 +1490,9 @@ o('FOR ForVariables',

}),
o('FORIN ExpressionLine WHEN Expression',
function() {
return {
source: $2,
guard: $4
};
}),
o('FOROF Expression WHEN Expression',

@@ -1385,2 +1506,10 @@ function() {

}),
o('FOROF ExpressionLine WHEN Expression',
function() {
return {
source: $2,
guard: $4,
object: true
};
}),
o('FORIN Expression BY Expression',

@@ -1393,2 +1522,9 @@ function() {

}),
o('FORIN ExpressionLine BY Expression',
function() {
return {
source: $2,
step: $4
};
}),
o('FORIN Expression WHEN Expression BY Expression',

@@ -1402,2 +1538,26 @@ function() {

}),
o('FORIN ExpressionLine WHEN Expression BY Expression',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN Expression WHEN ExpressionLine BY Expression',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN ExpressionLine WHEN ExpressionLine BY Expression',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN Expression BY Expression WHEN Expression',

@@ -1411,2 +1571,26 @@ function() {

}),
o('FORIN ExpressionLine BY Expression WHEN Expression',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORIN Expression BY ExpressionLine WHEN Expression',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORIN ExpressionLine BY ExpressionLine WHEN Expression',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORFROM Expression',

@@ -1426,4 +1610,158 @@ function() {

};
}),
o('FORFROM ExpressionLine WHEN Expression',
function() {
return {
source: $2,
guard: $4,
from: true
};
})
],
ForLineSource: [
o('FORIN ExpressionLine',
function() {
return {
source: $2
};
}),
o('FOROF ExpressionLine',
function() {
return {
source: $2,
object: true
};
}),
o('FORIN Expression WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4
};
}),
o('FORIN ExpressionLine WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4
};
}),
o('FOROF Expression WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4,
object: true
};
}),
o('FOROF ExpressionLine WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4,
object: true
};
}),
o('FORIN Expression BY ExpressionLine',
function() {
return {
source: $2,
step: $4
};
}),
o('FORIN ExpressionLine BY ExpressionLine',
function() {
return {
source: $2,
step: $4
};
}),
o('FORIN Expression WHEN Expression BY ExpressionLine',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN ExpressionLine WHEN Expression BY ExpressionLine',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN Expression WHEN ExpressionLine BY ExpressionLine',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN ExpressionLine WHEN ExpressionLine BY ExpressionLine',
function() {
return {
source: $2,
guard: $4,
step: $6
};
}),
o('FORIN Expression BY Expression WHEN ExpressionLine',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORIN ExpressionLine BY Expression WHEN ExpressionLine',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORIN Expression BY ExpressionLine WHEN ExpressionLine',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORIN ExpressionLine BY ExpressionLine WHEN ExpressionLine',
function() {
return {
source: $2,
step: $4,
guard: $6
};
}),
o('FORFROM ExpressionLine',
function() {
return {
source: $2,
from: true
};
}),
o('FORFROM Expression WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4,
from: true
};
}),
o('FORFROM ExpressionLine WHEN ExpressionLine',
function() {
return {
source: $2,
guard: $4,
from: true
};
})
],
Switch: [

@@ -1435,2 +1773,7 @@ o('SWITCH Expression INDENT Whens OUTDENT',

}),
o('SWITCH ExpressionLine INDENT Whens OUTDENT',
function() {
return new Switch($2,
$4);
}),
o('SWITCH Expression INDENT Whens ELSE Block OUTDENT',

@@ -1442,2 +1785,8 @@ function() {

}),
o('SWITCH ExpressionLine INDENT Whens ELSE Block OUTDENT',
function() {
return new Switch($2,
$4,
$6);
}),
o('SWITCH INDENT Whens OUTDENT',

@@ -1524,2 +1873,46 @@ function() {

],
IfBlockLine: [
o('IF ExpressionLine Block',
function() {
return new If($2,
$3,
{
type: $1
});
}),
o('IfBlockLine ELSE IF ExpressionLine Block',
function() {
return $1.addElse(LOC(3,
5)(new If($4,
$5,
{
type: $3
})));
})
],
IfLine: [
o('IfBlockLine'),
o('IfBlockLine ELSE Block',
function() {
return $1.addElse($3);
}),
o('Statement POST_IF ExpressionLine',
function() {
return new If($3,
LOC(1)(Block.wrap([$1])),
{
type: $2,
statement: true
});
}),
o('Expression POST_IF ExpressionLine',
function() {
return new If($3,
LOC(1)(Block.wrap([$1])),
{
type: $2,
statement: true
});
})
],
// Arithmetic and logical operators, working on one or more operands.

@@ -1531,2 +1924,9 @@ // Here they are grouped by order of precedence. The actual precedence rules

// rules are necessary.
OperationLine: [
o('UNARY ExpressionLine',
function() {
return new Op($1,
$2);
})
],
Operation: [

@@ -1533,0 +1933,0 @@ o('UNARY Expression',

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // This file contains the common helper functions that we'd like to share among

@@ -1,5 +0,5 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {
// Node.js Implementation
var CoffeeScript, ext, fn, fs, helpers, i, len, path, ref, universalCompile, vm,
var CoffeeScript, ext, fs, helpers, i, len, path, ref, universalCompile, vm,
hasProp = {}.hasOwnProperty;

@@ -140,11 +140,10 @@

ref = CoffeeScript.FILE_EXTENSIONS;
fn = function(ext) {
var base;
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);
};
};
for (i = 0, len = ref.length; i < len; i++) {
ext = ref[i];
fn(ext);
(function(ext) {
var base;
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);
};
})(ext);
}

@@ -151,0 +150,0 @@ }

@@ -1,5 +0,5 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat,
slice = [].slice;
splice = [].splice;

@@ -47,4 +47,4 @@ ({repeat} = require('./helpers'));

options = {};
// The `argument` field is added to the rule instance non-destructively by
// `normalizeArguments`.
// The `argument` field is added to the rule instance non-destructively by
// `normalizeArguments`.
for (i = 0, len = rules.length; i < len; i++) {

@@ -161,3 +161,3 @@ ({hasArgument, argument, isList, name} = rules[i]);

normalizeArguments = function(args, flagDict) {
var arg, argIndex, flag, i, innerOpts, j, k, lastOpt, len, len1, multiFlags, multiOpts, needsArgOpt, positional, ref, rule, rules, singleRule, withArg;
var arg, argIndex, flag, i, innerOpts, j, lastOpt, len, len1, multiFlags, multiOpts, needsArgOpt, positional, ref, rule, rules, singleRule, withArg;
rules = [];

@@ -192,5 +192,5 @@ positional = [];

// Only the last flag in a multi-flag may have an argument.
innerOpts = 2 <= multiOpts.length ? slice.call(multiOpts, 0, j = multiOpts.length - 1) : (j = 0, []), lastOpt = multiOpts[j++];
for (k = 0, len1 = innerOpts.length; k < len1; k++) {
({rule, flag} = innerOpts[k]);
[...innerOpts] = multiOpts, [lastOpt] = splice.call(innerOpts, -1);
for (j = 0, len1 = innerOpts.length; j < len1; j++) {
({rule, flag} = innerOpts[j]);
if (rule.hasArgument) {

@@ -197,0 +197,0 @@ throw new Error(`cannot use option ${flag} in multi-flag ${arg} except as the last option, because it needs an argument`);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, getRootModule, helpers, i, len, loadFile, path, ref;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, runInContext, sawSIGINT, transpile, updateSyntaxError, vm;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -221,3 +221,3 @@ // The CoffeeScript language has a good deal of optional syntax, implicit syntax,

fuzz = 0;
for (j = k = 0, ref = pattern.length; 0 <= ref ? k < ref : k > ref; j = 0 <= ref ? ++k : --k) {
for (j = k = 0, ref = pattern.length; undefined !== 0 && (0 <= ref ? 0 <= k && k < ref : 0 >= k && k > ref); j = 0 <= ref ? ++k : --k) {
if (pattern[j] == null) {

@@ -285,3 +285,3 @@ continue;

return this.scanTokens(function(token, i, tokens) {
var endImplicitCall, endImplicitObject, forward, implicitObjectContinues, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, nextToken, offset, prevTag, prevToken, ref, ref1, ref2, s, sameLine, stackIdx, stackItem, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag;
var endImplicitCall, endImplicitObject, forward, implicitObjectContinues, inControlFlow, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, nextToken, offset, prevTag, prevToken, ref, ref1, ref2, s, sameLine, stackIdx, stackItem, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag;
[tag] = token;

@@ -425,6 +425,27 @@ [prevTag] = prevToken = i > 0 ? tokens[i - 1] : [];

}
inControlFlow = () => {
var controlFlow, isFunc, seenFor, tagCurrentLine;
seenFor = this.findTagsBackwards(i, ['FOR']) && this.findTagsBackwards(i, ['FORIN', 'FOROF', 'FORFROM']);
controlFlow = seenFor || this.findTagsBackwards(i, ['WHILE', 'UNTIL', 'LOOP', 'LEADING_WHEN']);
if (!controlFlow) {
return false;
}
isFunc = false;
tagCurrentLine = token[2].first_line;
this.detectEnd(i, function(token, i) {
var ref;
return ref = token[0], indexOf.call(LINEBREAKS, ref) >= 0;
}, function(token, i) {
var first_line;
[prevTag, , {first_line}] = tokens[i - 1] || [];
return isFunc = tagCurrentLine === first_line && (prevTag === '->' || prevTag === '=>');
}, {
returnOnNegativeLevel: true
});
return isFunc;
};
// Recognize standard implicit calls like
// f a, f() b, f? c, h[0] d etc.
// Added support for spread dots on the left side: f ...a
if ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || (nextTag === '...' && (ref = this.tag(i + 2), indexOf.call(IMPLICIT_CALL, ref) >= 0) && !this.findTagsBackwards(i, ['INDEX_START', '['])) || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !nextToken.spaced && !nextToken.newLine)) {
if ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || (nextTag === '...' && (ref = this.tag(i + 2), indexOf.call(IMPLICIT_CALL, ref) >= 0) && !this.findTagsBackwards(i, ['INDEX_START', '['])) || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !nextToken.spaced && !nextToken.newLine) && !inControlFlow()) {
if (tag === '?') {

@@ -512,7 +533,7 @@ tag = token[0] = 'FUNC_EXIST';

newLine = prevTag === 'OUTDENT' || prevToken.newLine;
if (indexOf.call(IMPLICIT_END, tag) >= 0 || indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) {
if (indexOf.call(IMPLICIT_END, tag) >= 0 || (indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) || ((tag === '..' || tag === '...') && this.findTagsBackwards(i, ["INDEX_START"]))) {
while (inImplicit()) {
[stackTag, stackIdx, {sameLine, startsLine}] = stackTop();
// Close implicit calls when reached end of argument list
if (inImplicitCall() && prevTag !== ',') {
if (inImplicitCall() && prevTag !== ',' || (prevTag === ',' && tag === 'TERMINATOR' && (nextTag == null))) {
endImplicitCall();

@@ -788,14 +809,47 @@ // Close implicit objects such as:

normalizeLines() {
var action, condition, indent, outdent, starter;
var action, closeElseTag, condition, ifThens, indent, leading_if_then, leading_switch_when, outdent, starter;
starter = indent = outdent = null;
leading_switch_when = null;
leading_if_then = null;
// Count `THEN` tags
ifThens = [];
condition = function(token, i) {
var ref, ref1, ref2, ref3;
return token[1] !== ';' && (ref = token[0], indexOf.call(SINGLE_CLOSERS, ref) >= 0) && !(token[0] === 'TERMINATOR' && (ref1 = this.tag(i + 1), indexOf.call(EXPRESSION_CLOSE, ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((ref2 = token[0]) === 'CATCH' || ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (ref3 = token[0], indexOf.call(CALL_CLOSERS, ref3) >= 0) && (this.tokens[i - 1].newLine || this.tokens[i - 1][0] === 'OUTDENT');
return token[1] !== ';' && (ref = token[0], indexOf.call(SINGLE_CLOSERS, ref) >= 0) && !(token[0] === 'TERMINATOR' && (ref1 = this.tag(i + 1), indexOf.call(EXPRESSION_CLOSE, ref1) >= 0)) && !(token[0] === 'ELSE' && (starter !== 'THEN' || (leading_if_then || leading_switch_when))) && !(((ref2 = token[0]) === 'CATCH' || ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (ref3 = token[0], indexOf.call(CALL_CLOSERS, ref3) >= 0) && (this.tokens[i - 1].newLine || this.tokens[i - 1][0] === 'OUTDENT');
};
action = function(token, i) {
if (token[0] === 'ELSE' && starter === 'THEN') {
ifThens.pop();
}
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
};
closeElseTag = (tokens, i) => {
var lastThen, outdentElse, tlen;
tlen = ifThens.length;
if (!(tlen > 0)) {
return i;
}
lastThen = ifThens.pop();
[, outdentElse] = this.indentation(tokens[lastThen]);
// Insert `OUTDENT` to close inner `IF`.
outdentElse[1] = tlen * 2;
tokens.splice(i, 0, outdentElse);
// Insert `OUTDENT` to close outer `IF`.
outdentElse[1] = 2;
tokens.splice(i + 1, 0, outdentElse);
// Remove outdents from the end.
this.detectEnd(i + 2, function(token, i) {
var ref;
return (ref = token[0]) === 'OUTDENT' || ref === 'TERMINATOR';
}, function(token, i) {
if (this.tag(i) === 'OUTDENT' && this.tag(i + 1) === 'OUTDENT') {
return tokens.splice(i, 2);
}
});
return i + 2;
};
return this.scanTokens(function(token, i, tokens) {
var j, k, ref, ref1, tag;
var conditionTag, j, k, ref, ref1, tag;
[tag] = token;
conditionTag = (tag === '->' || tag === '=>') && this.findTagsBackwards(i, ['IF', 'WHILE', 'FOR', 'UNTIL', 'SWITCH', 'WHEN', 'LEADING_WHEN', '[', 'INDEX_START']) && !(this.findTagsBackwards(i, ['THEN', '..', '...']));
if (tag === 'TERMINATOR') {

@@ -825,3 +879,3 @@ if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {

}
if (indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
if (indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF') && !conditionTag) {
starter = tag;

@@ -832,2 +886,13 @@ [indent, outdent] = this.indentation(tokens[i]);

}
if (tag === 'THEN') {
leading_switch_when = this.findTagsBackwards(i, ['LEADING_WHEN']) && this.tag(i + 1) === 'IF';
leading_if_then = this.findTagsBackwards(i, ['IF']) && this.tag(i + 1) === 'IF';
}
if (tag === 'THEN' && this.findTagsBackwards(i, ['IF'])) {
ifThens.push(i);
}
// `ELSE` tag is not closed.
if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
i = closeElseTag(tokens, i);
}
tokens.splice(i + 1, 0, indent);

@@ -834,0 +899,0 @@ this.detectEnd(i + 2, condition, action);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // The **Scope** class regulates lexical scoping within CoffeeScript. As you

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.1.1
// Generated by CoffeeScript 2.2.0
(function() {

@@ -3,0 +3,0 @@ // Source maps allow JavaScript runtimes to match running JavaScript back to

@@ -11,3 +11,3 @@ {

"author": "Jeremy Ashkenas",
"version": "2.1.1",
"version": "2.2.0",
"license": "MIT",

@@ -46,5 +46,5 @@ "engines": {

"babel-preset-env": "~1.6.1",
"babel-preset-minify": "^0.2.0",
"babel-preset-minify": "^0.3.0",
"codemirror": "^5.32.0",
"docco": "~0.7.0",
"docco": "~0.8.0",
"highlight.js": "~9.12.0",

@@ -51,0 +51,0 @@ "jison": ">=0.4.18",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc