public ExpressionContext(JScriptBuilder builder)
 {
     _builder = builder;
     _previous = _current.Value;
     _current.Value = this;
 }
        private void EmitBlockStatement(BlockStatement block)
        {
            EnterBlock();

            using (var ex = new ExpressionContext(this, block))
            {

                foreach (var s in block.Body)
                {
                    Emit(s);
                }
            }

            LeaveBlock();
        }
        private void EmitFunctionDeclaration(FunctionDeclaration fdecl)
        {
            WriteSeparator();
            TranslateFunctionHeader(fdecl, fdecl.Parameters);

            using (var ec = new ExpressionContext(this, OperatorInfo.Body))
            {
                Emit(fdecl.Body);
            }
        }
        private void EmitExpressionStatement(ExpressionStatement s)
        {
            using (var ec = new ExpressionContext(this, OperatorInfo.Body))
            {
                if (s.Expression is CallExpression)
                {
                    var call = s.Expression as CallExpression;
                    if (call.Callee is FunctionExpression)
                    {
                        // group around function expression (function(){}());
                        ec.BeginGroup();
                    }
                }

                Emit(s.Expression);
            }

            Write(";");
        }
 private void EmitAssignmentExpression(AssignmentExpression e)
 {
     using (var ec = new ExpressionContext(this, e))
     {
         Emit(e.Left);
         Write(" " + TranslateAssignmentOperator(e.Operator) + " ");
         Emit(e.Right);
     }
 }
 private void EmitLogicalExpression(LogicalExpression e)
 {
     using (var ec = new ExpressionContext(this, e))
     {
         Emit(e.Left);
         Write(" " + ec.Token + " ");
         Emit(e.Right);
     }
 }
 private void EmitUpdateExpression(UpdateExpression e)
 {
     using (var ec = new ExpressionContext(this, e))
     {
         if (e.Prefix)
         {
             Write(ec.Token);
             Emit(e.Argument);
         }
         else
         {
             Emit(e.Argument);
             Write(ec.Token);
         }
     }
 }
 private void EmitUnaryExpression(UnaryExpression e)
 {
     if (e.Prefix)
     {
         using (var ec = new Wpf2Html5.Builder.ExpressionContext(this, e))
         {
             Write(ec.Token);
             Emit(e.Argument);
         }
     }
     else
     {
         using (var ec = new Wpf2Html5.Builder.ExpressionContext(this, e))
         {
             Emit(e.Argument);
             Write(ec.Token);
         }
     }
 }