Browse Source

Use endl instead of "\n".

cl-refactor
Christian 10 years ago
parent
commit
c5698b7341
  1. 4
      libsolidity/ASTPrinter.cpp
  2. 10
      libsolidity/SourceReferenceFormatter.cpp

4
libsolidity/ASTPrinter.cpp

@ -406,7 +406,7 @@ void ASTPrinter::printSourcePart(ASTNode const& _node)
{ {
Location const& location(_node.getLocation()); Location const& location(_node.getLocation());
*m_ostream << getIndentation() << " Source: |" *m_ostream << getIndentation() << " Source: |"
<< m_source.substr(location.start, location.end - location.start) << "|\n"; << m_source.substr(location.start, location.end - location.start) << "|" << std::endl;
} }
} }
@ -417,7 +417,7 @@ std::string ASTPrinter::getIndentation() const
void ASTPrinter::writeLine(std::string const& _line) void ASTPrinter::writeLine(std::string const& _line)
{ {
*m_ostream << getIndentation() << _line << '\n'; *m_ostream << getIndentation() << _line << std::endl;
} }
} }

10
libsolidity/SourceReferenceFormatter.cpp

@ -42,16 +42,16 @@ void SourceReferenceFormatter::printSourceLocation(std::ostream& _stream,
std::tie(endLine, endColumn) = _scanner.translatePositionToLineColumn(_location.end); std::tie(endLine, endColumn) = _scanner.translatePositionToLineColumn(_location.end);
if (startLine == endLine) if (startLine == endLine)
{ {
_stream << _scanner.getLineAtPosition(_location.start) << "\n" _stream << _scanner.getLineAtPosition(_location.start) << std::endl
<< std::string(startColumn, ' ') << "^"; << std::string(startColumn, ' ') << "^";
if (endColumn > startColumn + 2) if (endColumn > startColumn + 2)
_stream << std::string(endColumn - startColumn - 2, '-'); _stream << std::string(endColumn - startColumn - 2, '-');
if (endColumn > startColumn + 1) if (endColumn > startColumn + 1)
_stream << "^"; _stream << "^";
_stream << "\n"; _stream << std::endl;
} }
else else
_stream << _scanner.getLineAtPosition(_location.start) << "\n" _stream << _scanner.getLineAtPosition(_location.start) << std::endl
<< std::string(startColumn, ' ') << "^\n" << std::string(startColumn, ' ') << "^\n"
<< "Spanning multiple lines.\n"; << "Spanning multiple lines.\n";
} }
@ -63,8 +63,8 @@ void SourceReferenceFormatter::printSourcePosition(std::ostream& _stream,
int line; int line;
int column; int column;
std::tie(line, column) = _scanner.translatePositionToLineColumn(_position); std::tie(line, column) = _scanner.translatePositionToLineColumn(_position);
_stream << "at line " << (line + 1) << ", column " << (column + 1) << "\n" _stream << "at line " << (line + 1) << ", column " << (column + 1) << std::endl
<< _scanner.getLineAtPosition(_position) << "\n" << _scanner.getLineAtPosition(_position) << std::endl
<< std::string(column, ' ') << "^" << std::endl; << std::string(column, ' ') << "^" << std::endl;
} }

Loading…
Cancel
Save