Browse Source

Removed unused properties in StateBlock

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
ee42a637c4
  1. 2
      lib/helpers.js
  2. 2
      lib/rules_block/htmlblock.js
  3. 8
      lib/rules_block/state_block.js

2
lib/helpers.js

@ -66,7 +66,7 @@ function getLines(state, begin, end, indent, keepLastLF) {
first = state.bMarks[line] + Math.min(state.tShift[line], indent);
if (line + 1 < end || keepLastLF) {
// TODO: boundary check?
// No need for bounds check because we have fake entry on tail.
last = state.eMarks[line] + 1;
} else {
last = state.eMarks[line];

2
lib/rules_block/htmlblock.js

@ -28,7 +28,7 @@ module.exports = function htmlblock(state, startLine, endLine, silent) {
if (!state.options.html) { return false; }
if (shift > 3 || pos + 2 >= max || state.blkLevel > 0) { return false; }
if (shift > 3 || pos + 2 >= max) { return false; }
if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }

8
lib/rules_block/state_block.js

@ -31,11 +31,7 @@ function State(src, parser, tokens, options, env) {
this.tShift = []; // indent for each line
this.bqMarks = []; // lines shifts in blockquotes (calculated on bq enter)
// inline parser variables
this.pos = 0; // char index in src
// block parser variables
this.blkLevel = 0;
this.blkIndent = 0;
this.line = 0; // line index in src
this.lineMax = 0; // lines count
@ -83,7 +79,7 @@ function State(src, parser, tokens, options, env) {
if (ch !== 0x0D || ch !== 0x0A) {
this.bMarks.push(start);
this.eMarks.push(len);
this.tShift.push(indent);
if (!indent_found) { this.tShift.push(indent); }
}
// Push fake entry to simplify cache bounds checks
@ -93,7 +89,7 @@ function State(src, parser, tokens, options, env) {
this.lineMax = this.bMarks.length - 1; // don't count last fake line
for (start = 0; start < this.bMarks.length; start++) {
for (start = this.bMarks.length; start > 0; start--) {
this.bqMarks.push(0);
}
}

Loading…
Cancel
Save