| Paste number 65774: | Patch to make printing remove whitespace |
| Pasted by: | cpst |
| When: | 10 months, 1 week ago |
| Share: | Tweet this! | http://paste.lisp.org/+1ER2 |
| Channel: | #webkit |
| Paste contents: |
Index: kjs/nodes2string.cpp
===================================================================
--- kjs/nodes2string.cpp (revision 35900)
+++ kjs/nodes2string.cpp (working copy)
@@ -224,8 +224,8 @@ SourceStream& SourceStream::operator<<(E
{
m_numberNeedsParens = false;
m_atStartOfStatement = true;
- m_string.append('\n');
- m_string.append(m_spacesForIndentation);
+ // m_string.append('\n');
+ // m_string.append(m_spacesForIndentation);
return *this;
}
@@ -261,7 +261,7 @@ static void streamLeftAssociativeBinaryO
const char* operatorString, const Node* left, const Node* right)
{
s << precedence << left
- << ' ' << operatorString << ' '
+ << operatorString
<< static_cast<Precedence>(precedence - 1) << right;
}
@@ -353,16 +353,16 @@ void ArrayNode::streamTo(SourceStream& s
void ObjectLiteralNode::streamTo(SourceStream& s) const
{
if (m_list)
- s << "{ " << m_list << " }";
+ s << "{" << m_list << "}";
else
- s << "{ }";
+ s << "{}";
}
void PropertyListNode::streamTo(SourceStream& s) const
{
s << m_node;
for (const PropertyListNode* n = m_next.get(); n; n = n->m_next.get())
- s << ", " << n->m_node;
+ s << "," << n->m_node;
}
void PropertyNode::streamTo(SourceStream& s) const
@@ -405,7 +405,7 @@ void ArgumentListNode::streamTo(SourceSt
{
s << PrecAssignment << m_expr;
for (ArgumentListNode* n = m_next.get(); n; n = n->m_next.get())
- s << ", " << PrecAssignment << n->m_expr;
+ s << "," << PrecAssignment << n->m_expr;
}
void ArgumentsNode::streamTo(SourceStream& s) const
@@ -535,12 +535,12 @@ void PrefixErrorNode::streamTo(SourceStr
void UnaryPlusNode::streamTo(SourceStream& s) const
{
- s << "+ " << PrecUnary << m_expr;
+ s << "+" << PrecUnary << m_expr;
}
void NegateNode::streamTo(SourceStream& s) const
{
- s << "- " << PrecUnary << m_expr;
+ s << "-" << PrecUnary << m_expr;
}
void BitwiseNotNode::streamTo(SourceStream& s) const
@@ -666,64 +666,64 @@ void LogicalOpNode::streamTo(SourceStrea
void ConditionalNode::streamTo(SourceStream& s) const
{
s << PrecLogicalOr << m_logical
- << " ? " << PrecAssignment << m_expr1
- << " : " << PrecAssignment << m_expr2;
+ << "?" << PrecAssignment << m_expr1
+ << ":" << PrecAssignment << m_expr2;
}
void ReadModifyResolveNode::streamTo(SourceStream& s) const
{
- s << m_ident << ' ' << operatorString(m_operator) << ' ' << PrecAssignment << m_right;
+ s << m_ident << operatorString(m_operator) << PrecAssignment << m_right;
}
void AssignResolveNode::streamTo(SourceStream& s) const
{
- s << m_ident << " = " << PrecAssignment << m_right;
+ s << m_ident << "=" << PrecAssignment << m_right;
}
void ReadModifyBracketNode::streamTo(SourceStream& s) const
{
bracketNodeStreamTo(s, m_base, m_subscript);
- s << ' ' << operatorString(m_operator) << ' ' << PrecAssignment << m_right;
+ s << operatorString(m_operator) << PrecAssignment << m_right;
}
void AssignBracketNode::streamTo(SourceStream& s) const
{
bracketNodeStreamTo(s, m_base, m_subscript);
- s << " = " << PrecAssignment << m_right;
+ s << "=" << PrecAssignment << m_right;
}
void ReadModifyDotNode::streamTo(SourceStream& s) const
{
dotNodeStreamTo(s, m_base, m_ident);
- s << ' ' << operatorString(m_operator) << ' ' << PrecAssignment << m_right;
+ s << operatorString(m_operator) << PrecAssignment << m_right;
}
void AssignDotNode::streamTo(SourceStream& s) const
{
dotNodeStreamTo(s, m_base, m_ident);
- s << " = " << PrecAssignment << m_right;
+ s << "=" << PrecAssignment << m_right;
}
void AssignErrorNode::streamTo(SourceStream& s) const
{
- s << PrecLeftHandSide << m_left << ' '
- << operatorString(m_operator) << ' ' << PrecAssignment << m_right;
+ s << PrecLeftHandSide << m_left
+ << operatorString(m_operator) << PrecAssignment << m_right;
}
void CommaNode::streamTo(SourceStream& s) const
{
- s << PrecAssignment << m_expr1 << ", " << PrecAssignment << m_expr2;
+ s << PrecAssignment << m_expr1 << "," << PrecAssignment << m_expr2;
}
void ConstDeclNode::streamTo(SourceStream& s) const
{
s << m_ident;
if (m_init)
- s << " = " << PrecAssignment << m_init;
+ s << "=" << PrecAssignment << m_init;
for (ConstDeclNode* n = m_next.get(); n; n = n->m_next.get()) {
- s << ", " << n->m_ident;
+ s << "," << n->m_ident;
if (n->m_init)
- s << " = " << PrecAssignment << n->m_init;
+ s << "=" << PrecAssignment << n->m_init;
}
}
@@ -756,7 +756,7 @@ void ScopeNode::streamTo(SourceStream& s
s << Endl << "var ";
printedVar = true;
} else
- s << ", ";
+ s << ",";
s << m_varStack[i].first;
}
}
@@ -789,7 +789,7 @@ void VarStatementNode::streamTo(SourceSt
void IfNode::streamTo(SourceStream& s) const
{
- s << Endl << "if (" << m_condition << ')' << Indent << m_ifBlock << Unindent;
+ s << Endl << "if(" << m_condition << ')' << Indent << m_ifBlock << Unindent;
}
void IfElseNode::streamTo(SourceStream& s) const
@@ -801,27 +801,27 @@ void IfElseNode::streamTo(SourceStream&
void DoWhileNode::streamTo(SourceStream& s) const
{
s << Endl << "do " << Indent << m_statement << Unindent << Endl
- << "while (" << m_expr << ");";
+ << "while(" << m_expr << ");";
}
void WhileNode::streamTo(SourceStream& s) const
{
- s << Endl << "while (" << m_expr << ')' << Indent << m_statement << Unindent;
+ s << Endl << "while(" << m_expr << ')' << Indent << m_statement << Unindent;
}
void ForNode::streamTo(SourceStream& s) const
{
- s << Endl << "for ("
+ s << Endl << "for("
<< (m_expr1WasVarDecl ? "var " : "")
<< m_expr1
- << "; " << m_expr2
- << "; " << m_expr3
+ << ";" << m_expr2
+ << ";" << m_expr3
<< ')' << Indent << m_statement << Unindent;
}
void ForInNode::streamTo(SourceStream& s) const
{
- s << Endl << "for (";
+ s << Endl << "for(";
if (m_identIsVarDecl) {
s << "var ";
if (m_init)
@@ -838,7 +838,7 @@ void ContinueNode::streamTo(SourceStream
{
s << Endl << "continue";
if (!m_ident.isNull())
- s << ' ' << m_ident;
+ s << m_ident;
s << ';';
}
@@ -846,7 +846,7 @@ void BreakNode::streamTo(SourceStream& s
{
s << Endl << "break";
if (!m_ident.isNull())
- s << ' ' << m_ident;
+ s << m_ident;
s << ';';
}
@@ -854,13 +854,13 @@ void ReturnNode::streamTo(SourceStream&
{
s << Endl << "return";
if (m_value)
- s << ' ' << m_value;
+ s << m_value;
s << ';';
}
void WithNode::streamTo(SourceStream& s) const
{
- s << Endl << "with (" << m_expr << ") " << m_statement;
+ s << Endl << "with(" << m_expr << ")" << m_statement;
}
void CaseClauseNode::streamTo(SourceStream& s) const
@@ -892,7 +892,7 @@ void CaseBlockNode::streamTo(SourceStrea
void SwitchNode::streamTo(SourceStream& s) const
{
- s << Endl << "switch (" << m_expr << ") {"
+ s << Endl << "switch(" << m_expr << "){"
<< Indent << m_block << Unindent
<< Endl << "}";
}
@@ -911,7 +911,7 @@ void TryNode::streamTo(SourceStream& s)
{
s << Endl << "try " << m_tryBlock;
if (m_catchBlock)
- s << Endl << "catch (" << m_exceptionIdent << ')' << m_catchBlock;
+ s << Endl << "catch(" << m_exceptionIdent << ')' << m_catchBlock;
if (m_finallyBlock)
s << Endl << "finally " << m_finallyBlock;
}
@@ -920,7 +920,7 @@ void ParameterNode::streamTo(SourceStrea
{
s << m_ident;
for (ParameterNode* n = m_next.get(); n; n = n->m_next.get())
- s << ", " << n->m_ident;
+ s << "," << n->m_ident;
}
void FuncDeclNode::streamTo(SourceStream& s) const
This paste has no annotations.