mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added interface function for SourceLocation/ position convertation to compilerstack
This commit is contained in:
parent
5d2c36603f
commit
83c504ec89
@ -257,6 +257,15 @@ bytes CompilerStack::staticCompile(std::string const& _sourceCode, bool _optimiz
|
|||||||
return stack.compile(_sourceCode, _optimize);
|
return stack.compile(_sourceCode, _optimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pair<int, int> CompilerStack::positionFromSourceLocation(SourceLocation const& _sourceLocation) const
|
||||||
|
{
|
||||||
|
int initLine;
|
||||||
|
int initColumn;
|
||||||
|
tie(initLine, initColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start);
|
||||||
|
|
||||||
|
return make_pair(++initLine, ++initColumn);
|
||||||
|
}
|
||||||
|
|
||||||
void CompilerStack::reset(bool _keepSources)
|
void CompilerStack::reset(bool _keepSources)
|
||||||
{
|
{
|
||||||
m_parseSuccessful = false;
|
m_parseSuccessful = false;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include <libdevcore/Common.h>
|
#include <libdevcore/Common.h>
|
||||||
#include <libdevcore/FixedHash.h>
|
#include <libdevcore/FixedHash.h>
|
||||||
|
#include <libevmasm/SourceLocation.h>
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
@ -131,6 +132,9 @@ public:
|
|||||||
/// scanning the source code - this is useful for printing exception information.
|
/// scanning the source code - this is useful for printing exception information.
|
||||||
static bytes staticCompile(std::string const& _sourceCode, bool _optimize = false);
|
static bytes staticCompile(std::string const& _sourceCode, bool _optimize = false);
|
||||||
|
|
||||||
|
/// helper function for printing logs. Do only use in error cases, it's quite expensive.
|
||||||
|
std::pair<int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Information pertaining to one source unit, filled gradually during parsing and compilation.
|
* Information pertaining to one source unit, filled gradually during parsing and compilation.
|
||||||
|
Loading…
Reference in New Issue
Block a user