decaffeinate-parser
Version:
A better AST for CoffeeScript, inspired by CoffeeScriptRedux.
16 lines (15 loc) • 575 B
JavaScript
import isPlusTokenBetweenRanges from './isPlusTokenBetweenRanges';
/**
* Determine if the operator is a fake + operator for string interpolation.
*/
export default function isImplicitPlusOp(op, context) {
if (op.operator !== '+' || !op.second) {
return false;
}
var firstRange = context.getRange(op.first);
var secondRange = context.getRange(op.second);
if (!firstRange || !secondRange) {
throw new Error('Expected valid location data on plus operation.');
}
return !isPlusTokenBetweenRanges(firstRange, secondRange, context);
}