aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-05-25 00:34:19 +0800
committerchriseth <chris@ethereum.org>2017-06-08 21:52:44 +0800
commit97cc968a133247e729ed1d189d35ef2b7b53b3d4 (patch)
treec2aa552abea75a732e36e0c6b357ea879f35de54 /libsolidity/analysis
parent21e0b69dcb189fb52ac4e38959801582e02ca8fd (diff)
downloaddexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.gz
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.bz2
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.lz
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.xz
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.zst
dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.zip
Initial EVM1.5 assembly implementation.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp8
-rw-r--r--libsolidity/analysis/TypeChecker.cpp3
2 files changed, 9 insertions, 2 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index b70b0f0e..d814f5ec 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -169,7 +169,7 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
ErrorList errors;
ErrorReporter errorsIgnored(errors);
julia::ExternalIdentifierAccess::Resolver resolver =
- [&](assembly::Identifier const& _identifier, julia::IdentifierContext) {
+ [&](assembly::Identifier const& _identifier, julia::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");
@@ -188,6 +188,12 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
}
if (declarations.size() != 1)
return size_t(-1);
+ if (auto var = dynamic_cast<VariableDeclaration const*>(declarations.front()))
+ if (var->isLocalVariable() && _crossesFunctionBoundary)
+ {
+ m_errorReporter.declarationError(_identifier.location, "Cannot access local Solidity variables from inside an inline assembly function.");
+ return size_t(-1);
+ }
_inlineAssembly.annotation().externalReferences[&_identifier].isSlot = isSlot;
_inlineAssembly.annotation().externalReferences[&_identifier].isOffset = isOffset;
_inlineAssembly.annotation().externalReferences[&_identifier].declaration = declarations.front();
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 0fb0d212..b1911ef0 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -632,7 +632,8 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
// We run the resolve step again regardless.
julia::ExternalIdentifierAccess::Resolver identifierAccess = [&](
assembly::Identifier const& _identifier,
- julia::IdentifierContext _context
+ julia::IdentifierContext _context,
+ bool
)
{
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);