コード例 #1
0
        public override string PrettyPrint()
        {
            if (isShorthand)
            {
                BinaryExpr binaryExpr = (BinaryExpr)expr;
                string     assignExpr = literal == null ? binaryExpr.Op : literal;
                string     opName     = binaryExpr.OpName;
                return(string.Format("{0} {1}= {2}", varNode.PrettyPrint(), opName, assignExpr));
            }
            else
            {
                string assignExpr = literal == null?expr.PrettyPrint() : literal;

                return(string.Format("{0} = {1}", varNode.PrettyPrint(), assignExpr));
            }
        }
コード例 #2
0
        public override string PrettyPrint()
        {
            string varKeyword = isDeclaration ? "var " : "";
            string result     = "";

            if (isShorthand)
            {
                BinaryExpr binaryExpr = (BinaryExpr)expr;
                string     assignExpr = literal == null ? binaryExpr.Op : literal;
                string     opName     = binaryExpr.OpName;
                result = string.Format("{0}{1} {2}= {3}", varKeyword, varName, opName, assignExpr);
            }
            else
            {
                string assignExpr = literal == null?expr.PrettyPrint() : literal;

                result = string.Format("{0}{1} = {2}", varKeyword, varName, assignExpr);
            }
            return(result);
        }