From 7285ccfd4eac501a349cadf31f1c9ab68d99bbf6 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Fri, 5 Jun 2015 15:33:35 -0700 Subject: [PATCH] Remove block around initialize code * In strict mode code, functions can only be declared at top level or immediately within another function. This means functions defined in the initializer would throw. --- lib/compiler/passes/generate-javascript.js | 2 +- lib/parser.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index eddf6fd..c38d4b8 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -1147,7 +1147,7 @@ function generateJavascript(ast, options) { } if (ast.initializer) { - parts.push(indent4("{" + ast.initializer.code + "}")); + parts.push(indent4(ast.initializer.code)); parts.push(''); } diff --git a/lib/parser.js b/lib/parser.js index 48078e6..d402a52 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -4893,7 +4893,7 @@ module.exports = (function() { return s0; } - { + var OPS_TO_PREFIXED_TYPES = { "$": "text", "&": "simple_and", @@ -4940,7 +4940,7 @@ module.exports = (function() { function buildList(first, rest, index) { return [first].concat(extractList(rest, index)); } - } + peg$result = peg$startRuleFunction();