From de939ab9391be79a6ac1dcf36f54635b8aec12ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 3 Jan 2014 18:31:07 +0100 Subject: [PATCH] Clean up code and comments. --- src/core/PaperScript.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index e87c8aef..42eebca3 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -109,13 +109,12 @@ var PaperScript = Base.exports.PaperScript = (function(root) { */ function compile(code) { // Use Acorn or Esprima to translate the code into an AST structure - // which is then walked and parsed for operators to overload. - // Instead of modifying the AST and converting back to code, we directly - // change the source code based on the parser's range information, so we - // can preserve line-numbers in syntax errors and remove the need for - // Escodegen. + // which is then walked and parsed for operators to overload. Instead of + // modifying the AST and translating it back to code, we directly change + // the source code based on the parser's range information, to preserve + // line-numbers in syntax errors and remove the need for Escodegen. - // Tracks code insertions so we can add their differences to the + // Track code insertions so their differences can be added to the // original offsets. var insertions = []; @@ -143,8 +142,8 @@ var PaperScript = Base.exports.PaperScript = (function(root) { // information up-to-date. function replaceCode(node, str) { var start = getOffset(node.range[0]), - end = getOffset(node.range[1]); - var insert = 0; + end = getOffset(node.range[1]), + insert = 0; // Sort insertions by their offset, so getOffest() can do its thing for (var i = insertions.length - 1; i >= 0; i--) { if (start > insertions[i][0]) {