Skip to content

Commit

Permalink
Refactor "simple_not" emitter function a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
dmajda committed Sep 24, 2011
1 parent 13ae52b commit 506d810
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/emitter.js
Expand Up @@ -698,11 +698,6 @@ PEG.compiler.emitter = function(ast) {
},

simple_not: function(node, context) {
var expressionContext = {
resultIndex: context.resultIndex,
posIndex: context.posIndex + 1
};

return formatCode(
'#{posVar} = pos;',
'reportFailures++;',
Expand All @@ -715,7 +710,10 @@ PEG.compiler.emitter = function(ast) {
' pos = #{posVar};',
'}',
{
expressionCode: emit(node.expression, expressionContext),
expressionCode: emit(node.expression, {
resultIndex: context.resultIndex,
posIndex: context.posIndex + 1
}),
posVar: posVar(context.posIndex),
resultVar: resultVar(context.resultIndex)
}
Expand Down

0 comments on commit 506d810

Please sign in to comment.