Skip to content

Commit

Permalink
compiler: do not touch shared i-bem ast
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Apr 18, 2013
1 parent 08b6eaf commit 05b017f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/bemhtml/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ Compiler.prototype.translate = function translate(ast) {
// Lazily parse i-bem
if (!ibemAst) {
ibemAst = esprima.parse('function ibem() {' + bemhtml.ibem + '\n}');
ibemAst = ibemAst.body[0].body.body;
ibemAst = JSON.stringify(ibemAst.body[0].body.body);
}

var ibem = JSON.parse(ibemAst);

// Add i-bem block to the AST
assert.equal(ast.type, 'Program');
ast = {
type: 'Program',
body: ibemAst.concat(ast.body)
body: ibem.concat(ast.body)
};

// Ok, I admit it. Translation process is a bit fucked.
Expand Down

0 comments on commit 05b017f

Please sign in to comment.