aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmAnalysis.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-02-17 06:44:22 +0800
committerchriseth <c@ethdev.com>2017-03-03 22:41:02 +0800
commite963405a19c8435105df1fa48c9cdd92037b341f (patch)
tree98de3a9feb826a3bc77868ffadb7f7e95dfabdc7 /libsolidity/inlineasm/AsmAnalysis.cpp
parent647473cf013f901bfa11f7327e9efce99abd3f22 (diff)
downloaddexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar.gz
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar.bz2
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar.lz
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar.xz
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.tar.zst
dexon-solidity-e963405a19c8435105df1fa48c9cdd92037b341f.zip
Partially add functions.
Diffstat (limited to 'libsolidity/inlineasm/AsmAnalysis.cpp')
-rw-r--r--libsolidity/inlineasm/AsmAnalysis.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp
index 133869ca..9e53fc4a 100644
--- a/libsolidity/inlineasm/AsmAnalysis.cpp
+++ b/libsolidity/inlineasm/AsmAnalysis.cpp
@@ -38,7 +38,7 @@ using namespace dev::solidity::assembly;
bool Scope::registerLabel(string const& _name, size_t _id)
{
- if (lookup(_name))
+ if (exists(_name))
return false;
identifiers[_name] = Scope::Label(_id);
return true;
@@ -47,22 +47,40 @@ bool Scope::registerLabel(string const& _name, size_t _id)
bool Scope::registerVariable(string const& _name)
{
- if (lookup(_name))
+ if (exists(_name))
return false;
identifiers[_name] = Variable();
return true;
}
+bool Scope::registerFunction(string const& _name, size_t _arguments, size_t _returns)
+{
+ if (exists(_name))
+ return false;
+ identifiers[_name] = Function(_arguments, _returns);
+ return true;
+}
+
Scope::Identifier* Scope::lookup(string const& _name)
{
if (identifiers.count(_name))
return &identifiers[_name];
- else if (superScope)
+ else if (superScope && !closedScope)
return superScope->lookup(_name);
else
return nullptr;
}
+bool Scope::exists(string const& _name)
+{
+ if (identifiers.count(_name))
+ return true;
+ else if (superScope)
+ return superScope->exists(_name);
+ else
+ return false;
+}
+
AsmAnalyzer::AsmAnalyzer(AsmAnalyzer::Scopes& _scopes, ErrorList& _errors):
m_scopes(_scopes), m_errors(_errors)
{
@@ -161,6 +179,18 @@ bool AsmAnalyzer::operator()(assembly::VariableDeclaration const& _varDecl)
return success;
}
+bool AsmAnalyzer::operator()(assembly::FunctionDefinition const&)
+{
+ // TODO - we cannot throw an exception here because of some tests.
+ return true;
+}
+
+bool AsmAnalyzer::operator()(assembly::FunctionCall const&)
+{
+ // TODO - we cannot throw an exception here because of some tests.
+ return true;
+}
+
bool AsmAnalyzer::operator()(Block const& _block)
{
bool success = true;