mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Performance: Replace string by special single-copy YulString class.
This commit is contained in:
@@ -271,16 +271,16 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
||||
ErrorReporter errorsIgnored(errors);
|
||||
yul::ExternalIdentifierAccess::Resolver resolver =
|
||||
[&](assembly::Identifier const& _identifier, yul::IdentifierContext, bool _crossesFunctionBoundary) {
|
||||
auto declarations = m_resolver.nameFromCurrentScope(_identifier.name);
|
||||
bool isSlot = boost::algorithm::ends_with(_identifier.name, "_slot");
|
||||
bool isOffset = boost::algorithm::ends_with(_identifier.name, "_offset");
|
||||
auto declarations = m_resolver.nameFromCurrentScope(_identifier.name.str());
|
||||
bool isSlot = boost::algorithm::ends_with(_identifier.name.str(), "_slot");
|
||||
bool isOffset = boost::algorithm::ends_with(_identifier.name.str(), "_offset");
|
||||
if (isSlot || isOffset)
|
||||
{
|
||||
// special mode to access storage variables
|
||||
if (!declarations.empty())
|
||||
// the special identifier exists itself, we should not allow that.
|
||||
return size_t(-1);
|
||||
string realName = _identifier.name.substr(0, _identifier.name.size() - (
|
||||
string realName = _identifier.name.str().substr(0, _identifier.name.str().size() - (
|
||||
isSlot ?
|
||||
string("_slot").size() :
|
||||
string("_offset").size()
|
||||
|
||||
@@ -459,7 +459,7 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node)
|
||||
if (it.first)
|
||||
{
|
||||
Json::Value tuple(Json::objectValue);
|
||||
tuple[it.first->name] = inlineAssemblyIdentifierToJson(it);
|
||||
tuple[it.first->name.str()] = inlineAssemblyIdentifierToJson(it);
|
||||
externalReferences.append(tuple);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <libsolidity/inlineasm/AsmCodeGen.h>
|
||||
#include <libsolidity/inlineasm/AsmAnalysis.h>
|
||||
#include <libsolidity/inlineasm/AsmAnalysisInfo.h>
|
||||
#include <libyul/YulString.h>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
@@ -326,7 +327,7 @@ void CompilerContext::appendInlineAssembly(
|
||||
bool
|
||||
)
|
||||
{
|
||||
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name);
|
||||
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str());
|
||||
return it == _localVariables.end() ? size_t(-1) : 1;
|
||||
};
|
||||
identifierAccess.generateCode = [&](
|
||||
@@ -335,7 +336,7 @@ void CompilerContext::appendInlineAssembly(
|
||||
yul::AbstractAssembly& _assembly
|
||||
)
|
||||
{
|
||||
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name);
|
||||
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str());
|
||||
solAssert(it != _localVariables.end(), "");
|
||||
int stackDepth = _localVariables.end() - it;
|
||||
int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth;
|
||||
|
||||
@@ -79,17 +79,17 @@ bool AsmAnalyzer::operator()(assembly::Instruction const& _instruction)
|
||||
|
||||
bool AsmAnalyzer::operator()(assembly::Literal const& _literal)
|
||||
{
|
||||
expectValidType(_literal.type, _literal.location);
|
||||
expectValidType(_literal.type.str(), _literal.location);
|
||||
++m_stackHeight;
|
||||
if (_literal.kind == assembly::LiteralKind::String && _literal.value.size() > 32)
|
||||
if (_literal.kind == assembly::LiteralKind::String && _literal.value.str().size() > 32)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_literal.location,
|
||||
"String literal too long (" + to_string(_literal.value.size()) + " > 32)"
|
||||
"String literal too long (" + to_string(_literal.value.str().size()) + " > 32)"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
else if (_literal.kind == assembly::LiteralKind::Number && bigint(_literal.value) > u256(-1))
|
||||
else if (_literal.kind == assembly::LiteralKind::Number && bigint(_literal.value.str()) > u256(-1))
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_literal.location,
|
||||
@@ -100,7 +100,7 @@ bool AsmAnalyzer::operator()(assembly::Literal const& _literal)
|
||||
else if (_literal.kind == assembly::LiteralKind::Boolean)
|
||||
{
|
||||
solAssert(m_flavour == AsmFlavour::Yul, "");
|
||||
solAssert(_literal.value == "true" || _literal.value == "false", "");
|
||||
solAssert(_literal.value == YulString{string("true")} || _literal.value == YulString{string("false")}, "");
|
||||
}
|
||||
m_info.stackHeightInfo[&_literal] = m_stackHeight;
|
||||
return true;
|
||||
@@ -118,7 +118,7 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
_identifier.location,
|
||||
"Variable " + _identifier.name + " used before it was declared."
|
||||
"Variable " + _identifier.name.str() + " used before it was declared."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_identifier.location,
|
||||
"Function " + _identifier.name + " used without being called."
|
||||
"Function " + _identifier.name.str() + " used without being called."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ bool AsmAnalyzer::operator()(assembly::VariableDeclaration const& _varDecl)
|
||||
|
||||
for (auto const& variable: _varDecl.variables)
|
||||
{
|
||||
expectValidType(variable.type, variable.location);
|
||||
expectValidType(variable.type.str(), variable.location);
|
||||
m_activeVariables.insert(&boost::get<Scope::Variable>(m_currentScope->identifiers.at(variable.name)));
|
||||
}
|
||||
m_info.stackHeightInfo[&_varDecl] = m_stackHeight;
|
||||
@@ -268,7 +268,7 @@ bool AsmAnalyzer::operator()(assembly::FunctionDefinition const& _funDef)
|
||||
Scope& varScope = scope(virtualBlock);
|
||||
for (auto const& var: _funDef.parameters + _funDef.returnVariables)
|
||||
{
|
||||
expectValidType(var.type, var.location);
|
||||
expectValidType(var.type.str(), var.location);
|
||||
m_activeVariables.insert(&boost::get<Scope::Variable>(varScope.identifiers.at(var.name)));
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ bool AsmAnalyzer::operator()(Switch const& _switch)
|
||||
if (!expectExpression(*_switch.expression))
|
||||
success = false;
|
||||
|
||||
set<tuple<LiteralKind, string>> cases;
|
||||
set<tuple<LiteralKind, YulString>> cases;
|
||||
for (auto const& _case: _switch.cases)
|
||||
{
|
||||
if (_case.value)
|
||||
@@ -503,7 +503,7 @@ bool AsmAnalyzer::checkAssignment(assembly::Identifier const& _variable, size_t
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
_variable.location,
|
||||
"Variable " + _variable.name + " used before it was declared."
|
||||
"Variable " + _variable.name.str() + " used before it was declared."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,13 @@
|
||||
#include <libevmasm/Instruction.h>
|
||||
#include <libevmasm/SourceLocation.h>
|
||||
|
||||
#include <libyul/YulString.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
@@ -36,20 +42,21 @@ namespace solidity
|
||||
namespace assembly
|
||||
{
|
||||
|
||||
using Type = std::string;
|
||||
using YulString = dev::yul::YulString;
|
||||
using Type = YulString;
|
||||
|
||||
struct TypedName { SourceLocation location; std::string name; Type type; };
|
||||
struct TypedName { SourceLocation location; YulString name; Type type; };
|
||||
using TypedNameList = std::vector<TypedName>;
|
||||
|
||||
/// Direct EVM instruction (except PUSHi and JUMPDEST)
|
||||
struct Instruction { SourceLocation location; solidity::Instruction instruction; };
|
||||
/// Literal number or string (up to 32 bytes)
|
||||
enum class LiteralKind { Number, Boolean, String };
|
||||
struct Literal { SourceLocation location; LiteralKind kind; std::string value; Type type; };
|
||||
struct Literal { SourceLocation location; LiteralKind kind; YulString value; Type type; };
|
||||
/// External / internal identifier or label reference
|
||||
struct Identifier { SourceLocation location; std::string name; };
|
||||
struct Identifier { SourceLocation location; YulString name; };
|
||||
/// Jump label ("name:")
|
||||
struct Label { SourceLocation location; std::string name; };
|
||||
struct Label { SourceLocation location; YulString name; };
|
||||
/// Assignment from stack (":= x", moves stack top into x, potentially multiple slots)
|
||||
struct StackAssignment { SourceLocation location; Identifier variableName; };
|
||||
/// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand
|
||||
@@ -69,7 +76,7 @@ struct VariableDeclaration { SourceLocation location; TypedNameList variables; s
|
||||
/// Block that creates a scope (frees declared stack variables)
|
||||
struct Block { SourceLocation location; std::vector<Statement> statements; };
|
||||
/// Function definition ("function f(a, b) -> (d, e) { ... }")
|
||||
struct FunctionDefinition { SourceLocation location; std::string name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
|
||||
struct FunctionDefinition { SourceLocation location; YulString name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
|
||||
/// Conditional execution without "else" part.
|
||||
struct If { SourceLocation location; std::shared_ptr<Expression> condition; Block body; };
|
||||
/// Switch case or default case
|
||||
|
||||
@@ -112,8 +112,8 @@ assembly::Statement Parser::parseStatement()
|
||||
advance();
|
||||
expectToken(Token::Colon);
|
||||
assignment.variableName.location = location();
|
||||
assignment.variableName.name = currentLiteral();
|
||||
if (instructions().count(assignment.variableName.name))
|
||||
assignment.variableName.name = YulString(currentLiteral());
|
||||
if (instructions().count(assignment.variableName.name.str()))
|
||||
fatalParserError("Identifier expected, got instruction name.");
|
||||
assignment.location.end = endPosition();
|
||||
expectToken(Token::Identifier);
|
||||
@@ -173,7 +173,7 @@ assembly::Statement Parser::parseStatement()
|
||||
if (currentToken() == Token::Assign && peekNextToken() != Token::Colon)
|
||||
{
|
||||
assembly::Assignment assignment = createWithLocation<assembly::Assignment>(identifier.location);
|
||||
if (m_flavour != AsmFlavour::Yul && instructions().count(identifier.name))
|
||||
if (m_flavour != AsmFlavour::Yul && instructions().count(identifier.name.str()))
|
||||
fatalParserError("Cannot use instruction names for identifier names.");
|
||||
advance();
|
||||
assignment.variableNames.emplace_back(identifier);
|
||||
@@ -363,7 +363,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
|
||||
ret = Instruction{location(), instr};
|
||||
}
|
||||
else
|
||||
ret = Identifier{location(), literal};
|
||||
ret = Identifier{location(), YulString{literal}};
|
||||
advance();
|
||||
break;
|
||||
}
|
||||
@@ -394,15 +394,15 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
|
||||
Literal literal{
|
||||
location(),
|
||||
kind,
|
||||
currentLiteral(),
|
||||
""
|
||||
YulString{currentLiteral()},
|
||||
{}
|
||||
};
|
||||
advance();
|
||||
if (m_flavour == AsmFlavour::Yul)
|
||||
{
|
||||
expectToken(Token::Colon);
|
||||
literal.location.end = endPosition();
|
||||
literal.type = expectAsmIdentifier();
|
||||
literal.type = YulString{expectAsmIdentifier()};
|
||||
}
|
||||
else if (kind == LiteralKind::Boolean)
|
||||
fatalParserError("True and false are not valid literals.");
|
||||
@@ -449,7 +449,7 @@ assembly::FunctionDefinition Parser::parseFunctionDefinition()
|
||||
RecursionGuard recursionGuard(*this);
|
||||
FunctionDefinition funDef = createWithLocation<FunctionDefinition>();
|
||||
expectToken(Token::Function);
|
||||
funDef.name = expectAsmIdentifier();
|
||||
funDef.name = YulString{expectAsmIdentifier()};
|
||||
expectToken(Token::LParen);
|
||||
while (currentToken() != Token::RParen)
|
||||
{
|
||||
@@ -564,12 +564,12 @@ TypedName Parser::parseTypedName()
|
||||
{
|
||||
RecursionGuard recursionGuard(*this);
|
||||
TypedName typedName = createWithLocation<TypedName>();
|
||||
typedName.name = expectAsmIdentifier();
|
||||
typedName.name = YulString{expectAsmIdentifier()};
|
||||
if (m_flavour == AsmFlavour::Yul)
|
||||
{
|
||||
expectToken(Token::Colon);
|
||||
typedName.location.end = endPosition();
|
||||
typedName.type = expectAsmIdentifier();
|
||||
typedName.type = YulString{expectAsmIdentifier()};
|
||||
}
|
||||
return typedName;
|
||||
}
|
||||
|
||||
@@ -52,17 +52,17 @@ string AsmPrinter::operator()(assembly::Literal const& _literal)
|
||||
switch (_literal.kind)
|
||||
{
|
||||
case LiteralKind::Number:
|
||||
solAssert(isValidDecimal(_literal.value) || isValidHex(_literal.value), "Invalid number literal");
|
||||
return _literal.value + appendTypeName(_literal.type);
|
||||
solAssert(isValidDecimal(_literal.value.str()) || isValidHex(_literal.value.str()), "Invalid number literal");
|
||||
return _literal.value.str() + appendTypeName(_literal.type);
|
||||
case LiteralKind::Boolean:
|
||||
solAssert(_literal.value == "true" || _literal.value == "false", "Invalid bool literal.");
|
||||
return ((_literal.value == "true") ? "true" : "false") + appendTypeName(_literal.type);
|
||||
solAssert(_literal.value.str() == "true" || _literal.value.str() == "false", "Invalid bool literal.");
|
||||
return ((_literal.value.str() == "true") ? "true" : "false") + appendTypeName(_literal.type);
|
||||
case LiteralKind::String:
|
||||
break;
|
||||
}
|
||||
|
||||
string out;
|
||||
for (char c: _literal.value)
|
||||
for (char c: _literal.value.str())
|
||||
if (c == '\\')
|
||||
out += "\\\\";
|
||||
else if (c == '"')
|
||||
@@ -93,7 +93,7 @@ string AsmPrinter::operator()(assembly::Literal const& _literal)
|
||||
string AsmPrinter::operator()(assembly::Identifier const& _identifier)
|
||||
{
|
||||
solAssert(!_identifier.name.empty(), "Invalid identifier.");
|
||||
return _identifier.name;
|
||||
return _identifier.name.str();
|
||||
}
|
||||
|
||||
string AsmPrinter::operator()(assembly::FunctionalInstruction const& _functionalInstruction)
|
||||
@@ -118,7 +118,7 @@ string AsmPrinter::operator()(assembly::Label const& _label)
|
||||
{
|
||||
solAssert(!m_yul, "");
|
||||
solAssert(!_label.name.empty(), "Invalid label.");
|
||||
return _label.name + ":";
|
||||
return _label.name.str() + ":";
|
||||
}
|
||||
|
||||
string AsmPrinter::operator()(assembly::StackAssignment const& _assignment)
|
||||
@@ -157,7 +157,7 @@ string AsmPrinter::operator()(assembly::VariableDeclaration const& _variableDecl
|
||||
string AsmPrinter::operator()(assembly::FunctionDefinition const& _functionDefinition)
|
||||
{
|
||||
solAssert(!_functionDefinition.name.empty(), "Invalid function name.");
|
||||
string out = "function " + _functionDefinition.name + "(";
|
||||
string out = "function " + _functionDefinition.name.str() + "(";
|
||||
out += boost::algorithm::join(
|
||||
_functionDefinition.parameters | boost::adaptors::transformed(
|
||||
[this](TypedName argument) { return formatTypedName(argument); }
|
||||
@@ -239,12 +239,12 @@ string AsmPrinter::operator()(Block const& _block)
|
||||
string AsmPrinter::formatTypedName(TypedName _variable) const
|
||||
{
|
||||
solAssert(!_variable.name.empty(), "Invalid variable name.");
|
||||
return _variable.name + appendTypeName(_variable.type);
|
||||
return _variable.name.str() + appendTypeName(_variable.type);
|
||||
}
|
||||
|
||||
string AsmPrinter::appendTypeName(std::string const& _type) const
|
||||
string AsmPrinter::appendTypeName(YulString _type) const
|
||||
{
|
||||
if (m_yul)
|
||||
return ":" + _type;
|
||||
return ":" + _type.str();
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <libsolidity/inlineasm/AsmDataForward.h>
|
||||
|
||||
#include <libyul/YulString.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace dev
|
||||
@@ -56,7 +58,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string formatTypedName(TypedName _variable) const;
|
||||
std::string appendTypeName(std::string const& _type) const;
|
||||
std::string appendTypeName(yul::YulString _type) const;
|
||||
|
||||
bool m_yul = false;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace std;
|
||||
using namespace dev::solidity::assembly;
|
||||
|
||||
|
||||
bool Scope::registerLabel(string const& _name)
|
||||
bool Scope::registerLabel(yul::YulString _name)
|
||||
{
|
||||
if (exists(_name))
|
||||
return false;
|
||||
@@ -32,7 +32,7 @@ bool Scope::registerLabel(string const& _name)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Scope::registerVariable(string const& _name, YulType const& _type)
|
||||
bool Scope::registerVariable(yul::YulString _name, YulType const& _type)
|
||||
{
|
||||
if (exists(_name))
|
||||
return false;
|
||||
@@ -42,7 +42,7 @@ bool Scope::registerVariable(string const& _name, YulType const& _type)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Scope::registerFunction(string const& _name, std::vector<YulType> const& _arguments, std::vector<YulType> const& _returns)
|
||||
bool Scope::registerFunction(yul::YulString _name, std::vector<YulType> const& _arguments, std::vector<YulType> const& _returns)
|
||||
{
|
||||
if (exists(_name))
|
||||
return false;
|
||||
@@ -50,7 +50,7 @@ bool Scope::registerFunction(string const& _name, std::vector<YulType> const& _a
|
||||
return true;
|
||||
}
|
||||
|
||||
Scope::Identifier* Scope::lookup(string const& _name)
|
||||
Scope::Identifier* Scope::lookup(yul::YulString _name)
|
||||
{
|
||||
bool crossedFunctionBoundary = false;
|
||||
for (Scope* s = this; s; s = s->superScope)
|
||||
@@ -70,7 +70,7 @@ Scope::Identifier* Scope::lookup(string const& _name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scope::exists(string const& _name) const
|
||||
bool Scope::exists(yul::YulString _name) const
|
||||
{
|
||||
if (identifiers.count(_name))
|
||||
return true;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include <libsolidity/interface/Exceptions.h>
|
||||
|
||||
#include <libyul/YulString.h>
|
||||
|
||||
#include <libdevcore/Visitor.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
@@ -39,7 +41,7 @@ namespace assembly
|
||||
|
||||
struct Scope
|
||||
{
|
||||
using YulType = std::string;
|
||||
using YulType = yul::YulString;
|
||||
using LabelID = size_t;
|
||||
|
||||
struct Variable { YulType type; };
|
||||
@@ -54,10 +56,10 @@ struct Scope
|
||||
using Visitor = GenericVisitor<Variable const, Label const, Function const>;
|
||||
using NonconstVisitor = GenericVisitor<Variable, Label, Function>;
|
||||
|
||||
bool registerVariable(std::string const& _name, YulType const& _type);
|
||||
bool registerLabel(std::string const& _name);
|
||||
bool registerVariable(yul::YulString _name, YulType const& _type);
|
||||
bool registerLabel(yul::YulString _name);
|
||||
bool registerFunction(
|
||||
std::string const& _name,
|
||||
yul::YulString _name,
|
||||
std::vector<YulType> const& _arguments,
|
||||
std::vector<YulType> const& _returns
|
||||
);
|
||||
@@ -67,12 +69,12 @@ struct Scope
|
||||
/// will any lookups across assembly boundaries.
|
||||
/// The pointer will be invalidated if the scope is modified.
|
||||
/// @param _crossedFunction if true, we already crossed a function boundary during recursive lookup
|
||||
Identifier* lookup(std::string const& _name);
|
||||
Identifier* lookup(yul::YulString _name);
|
||||
/// Looks up the identifier in this and super scopes (will not find variables across function
|
||||
/// boundaries and generally stops at assembly boundaries) and calls the visitor, returns
|
||||
/// false if not found.
|
||||
template <class V>
|
||||
bool lookup(std::string const& _name, V const& _visitor)
|
||||
bool lookup(yul::YulString _name, V const& _visitor)
|
||||
{
|
||||
if (Identifier* id = lookup(_name))
|
||||
{
|
||||
@@ -84,7 +86,7 @@ struct Scope
|
||||
}
|
||||
/// @returns true if the name exists in this scope or in super scopes (also searches
|
||||
/// across function and assembly boundaries).
|
||||
bool exists(std::string const& _name) const;
|
||||
bool exists(yul::YulString _name) const;
|
||||
|
||||
/// @returns the number of variables directly registered inside the scope.
|
||||
size_t numberOfVariables() const;
|
||||
@@ -95,7 +97,7 @@ struct Scope
|
||||
/// If true, variables from the super scope are not visible here (other identifiers are),
|
||||
/// but they are still taken into account to prevent shadowing.
|
||||
bool functionScope = false;
|
||||
std::map<std::string, Identifier> identifiers;
|
||||
std::map<yul::YulString, Identifier> identifiers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ bool ScopeFiller::operator()(Label const& _item)
|
||||
//@TODO secondary location
|
||||
m_errorReporter.declarationError(
|
||||
_item.location,
|
||||
"Label name " + _item.name + " already taken in this scope."
|
||||
"Label name " + _item.name.str() + " already taken in this scope."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -77,16 +77,16 @@ bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef)
|
||||
bool success = true;
|
||||
vector<Scope::YulType> arguments;
|
||||
for (auto const& _argument: _funDef.parameters)
|
||||
arguments.push_back(_argument.type);
|
||||
arguments.emplace_back(_argument.type.str());
|
||||
vector<Scope::YulType> returns;
|
||||
for (auto const& _return: _funDef.returnVariables)
|
||||
returns.push_back(_return.type);
|
||||
returns.emplace_back(_return.type.str());
|
||||
if (!m_currentScope->registerFunction(_funDef.name, arguments, returns))
|
||||
{
|
||||
//@TODO secondary location
|
||||
m_errorReporter.declarationError(
|
||||
_funDef.location,
|
||||
"Function name " + _funDef.name + " already taken in this scope."
|
||||
"Function name " + _funDef.name.str() + " already taken in this scope."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ bool ScopeFiller::registerVariable(TypedName const& _name, SourceLocation const&
|
||||
//@TODO secondary location
|
||||
m_errorReporter.declarationError(
|
||||
_location,
|
||||
"Variable name " + _name.name + " already taken in this scope."
|
||||
"Variable name " + _name.name.str() + " already taken in this scope."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user