Skip to content

Commit

Permalink
Cleanup escodegen.js part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Constellation committed Oct 9, 2012
1 parent a37ac03 commit 27ca619
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions escodegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

/*jslint bitwise:true */
/*global escodegen:true, exports:true, generateStatement: true*/
/*global escodegen:true, exports:true, generateStatement:true, process:true, require:true, define:true*/

(function (factory, global) {
'use strict';
Expand Down Expand Up @@ -512,6 +512,20 @@
((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch));
}

function toSourceNode(generated, node) {
if (node == null) {
if (generated instanceof SourceNode) {
return generated;
} else {
node = {};
}
}
if (node.loc == null) {
return new SourceNode(null, null, sourceMap, generated);
}
return new SourceNode(node.loc.start.line, node.loc.start.column, (sourceMap === true ? node.loc.source || null : sourceMap), generated);
}

function join(left, right) {
var leftSource = toSourceNode(left).toString(),
rightSource = toSourceNode(right).toString(),
Expand Down Expand Up @@ -549,20 +563,6 @@
return (str.length - 1) - i;
}

function toSourceNode(generated, node) {
if (node == null) {
if (generated instanceof SourceNode) {
return generated;
} else {
node = {};
}
}
if (node.loc == null) {
return new SourceNode(null, null, sourceMap, generated);
}
return new SourceNode(node.loc.start.line, node.loc.start.column, (sourceMap === true ? node.loc.source || null : sourceMap), generated);
}

function adjustMultilineComment(value, specialBase) {
var array, i, len, line, j, ch, spaces, previousBase;

Expand Down

0 comments on commit 27ca619

Please sign in to comment.