utils/Changeset: use jshint

This commit is contained in:
booo 2011-12-22 13:36:01 +01:00
parent 6985b93013
commit c26c45309a

View file

@ -66,7 +66,7 @@ exports.newLen = function (cs) {
exports.opIterator = function (opsStr, optStartIndex) {
//print(opsStr);
var regex = /((?:\*[0-9a-z]+)*)(?:\|([0-9a-z]+))?([-+=])([0-9a-z]+)|\?|/g;
var regex = /((?:\*[0-9a-z]+)*)(?:\|([0-9a-z]+))?([\-+=])([0-9a-z]+)|\?|/g;
var startIndex = (optStartIndex || 0);
var curIndex = startIndex;
var prevIndex = curIndex;
@ -195,13 +195,11 @@ exports.checkRep = function (cs) {
exports.assert(oldPos < oldLen, oldPos, " >= ", oldLen, " in ", cs);
break;
case '+':
{
calcNewLen += o.chars;
numInserted += o.chars;
exports.assert(calcNewLen < newLen, calcNewLen, " >= ", newLen, " in ", cs);
break;
}
}
assem.append(o);
}
@ -216,7 +214,7 @@ exports.checkRep = function (cs) {
exports.assert(normalized == cs, normalized, ' != ', cs);
return cs;
}
};
exports.smartOpAssembler = function () {
// Like opAssembler but able to produce conforming exportss
@ -387,7 +385,7 @@ if (_opt) {
bufOp.chars += bufOpAdditionalCharsAfterNewline + op.chars;
bufOp.lines += op.lines;
bufOpAdditionalCharsAfterNewline = 0;
} else if (bufOp.lines == 0) {
} else if (bufOp.lines === 0) {
// both bufOp and op are in-line
bufOp.chars += op.chars;
} else {
@ -667,13 +665,13 @@ exports.textLinesMutator = function (lines) {
enterSplice();
}
function nextKLinesText(k) {
var nextKLinesText = function nextKLinesText(k) {
var m = curSplice[0] + curSplice[1];
return lines_slice(m, m + k).join('');
}
};
if (isCurLineInSplice()) {
//print(curCol);
if (curCol == 0) {
if (curCol === 0) {
removed = curSplice[curSplice.length - 1];
// print("FOO"); // case foo
curSplice.length--;
@ -719,6 +717,7 @@ exports.textLinesMutator = function (lines) {
if (!inSplice) {
enterSplice();
}
var sline;
if (L) {
var newLines = exports.splitTextLines(text);
if (isCurLineInSplice()) {
@ -729,7 +728,7 @@ exports.textLinesMutator = function (lines) {
//curLine += newLines.length;
//}
//else {
var sline = curSplice.length - 1;
sline = curSplice.length - 1;
var theLine = curSplice[sline];
var lineCol = curCol;
curSplice[sline] = theLine.substring(0, lineCol) + newLines[0];
@ -745,7 +744,7 @@ exports.textLinesMutator = function (lines) {
curLine += newLines.length;
}
} else {
var sline = putCurLineInSplice();
sline = putCurLineInSplice();
curSplice[sline] = curSplice[sline].substring(0, curCol) + text + curSplice[sline].substring(curCol);
curCol += text.length;
}
@ -949,7 +948,6 @@ exports._slicerZipperFunc = function (attOp, csOp, opOut, pool) {
} else {
switch (csOp.opcode) {
case '-':
{
if (csOp.chars <= attOp.chars) {
// delete or delete part
if (attOp.opcode == '=') {
@ -977,16 +975,12 @@ exports._slicerZipperFunc = function (attOp, csOp, opOut, pool) {
attOp.opcode = '';
}
break;
}
case '+':
{
// insert
exports.copyOp(csOp, opOut);
csOp.opcode = '';
break;
}
case '=':
{
if (csOp.chars <= attOp.chars) {
// keep or keep part
opOut.opcode = attOp.opcode;
@ -1010,15 +1004,12 @@ exports._slicerZipperFunc = function (attOp, csOp, opOut, pool) {
csOp.lines -= attOp.lines;
}
break;
}
case '':
{
exports.copyOp(attOp, opOut);
attOp.opcode = '';
break;
}
}
}
};
exports.applyToAttribution = function (cs, astr, pool) {
@ -1470,7 +1461,7 @@ exports.appendATextToAssembler = function (atext, assem) {
};
exports.prepareForWire = function (cs, pool) {
var newPool = AttributePoolFactory.createAttributePool();;
var newPool = AttributePoolFactory.createAttributePool();
var newCs = exports.moveOpsToNewPool(cs, pool, newPool);
return {
translated: newCs,
@ -1480,7 +1471,7 @@ exports.prepareForWire = function (cs, pool) {
exports.isIdentity = function (cs) {
var unpacked = exports.unpack(cs);
return unpacked.ops == "" && unpacked.oldLen == unpacked.newLen;
return unpacked.ops === "" && unpacked.oldLen == unpacked.newLen;
};
exports.opAttributeValue = function (op, key, pool) {