mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'publishTarball' into release
Conflicts: .travis.yml scripts/create_source_tarball.sh
This commit is contained in:
commit
ba04211e17
@ -171,6 +171,7 @@ deploy:
|
||||
- provider: releases
|
||||
api_key:
|
||||
secure: kyDTn9taQWSzALK2CbtJ9VC1KhIO3DzIM1aIwpJexPsEq6h1Wnjp3PoyyzJGf+09AjWZLM5lNcHy6/F9AEINgnEeekdMVNT1YIYsGSJ76z/pDXB4AOZKqGXdZgLNvmxZy9dWQJykBSV65kGgEZlihW/5gF0/ouxyZafYOYlwseA7H2NDDTdIzf5uV9oIPo/y3phXG1nxGcmE3tOH/bEJL+dv0C6hI3dhL7mQhmmBCgyo/ZlAEsdj0hbBF332dxqojGwfPeuFDrxvnWLX4jhbJAkrqKgcU+1lnsr7aI+RBHu7mV3/Fj+XfTrs3J9HvCjVfe0d9s1dMsIhdY8xT8NnZX618AiZYMIoQ1gE89R8uL/mN5BpcYG7U654FDG/+OTIa6VBMDxB9J85kYdnLq3XBlcr1YoPMfTJ1UV7mpG4D1EDJObgToyCEDNbKS1Nf+osVcP8UcsrvhBCNXhPsFud8ZemaXmrVNhJOcf8sAHZx2N/HSfm7Im74ZFqJbHrWlx9aFKZ71BvSCPAbcp4hGw0A0Anynn9hOfxZjh5aqwxhz4ieTolCWaZCVyMveLJccu2ib2LVza2soHiSX2maFFlXqkoPd8h3vIGMR4CbqWfxAhXuxzMivOc24kPVHLEt5zq9635V519eOEEPYUs4X1ArZySKvJBbEcJ2RP+AZrZlj4=
|
||||
file: $TRAVIS_BUILD_DIR/solidity-$ZIP_SUFFIX.zip
|
||||
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
|
||||
@ -8,7 +8,7 @@ include(EthPolicy)
|
||||
eth_policy()
|
||||
|
||||
# project name and version should be set after cmake_policy CMP0048
|
||||
set(PROJECT_VERSION "0.4.7")
|
||||
set(PROJECT_VERSION "0.4.8")
|
||||
project(solidity VERSION ${PROJECT_VERSION})
|
||||
|
||||
# Let's find our dependencies
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
### 0.4.8 (unreleased)
|
||||
|
||||
BugFixes:
|
||||
* Type checker, code generator: enable access to events of base contracts' names.
|
||||
|
||||
### 0.4.7 (2016-12-15)
|
||||
|
||||
Features:
|
||||
|
||||
@ -56,9 +56,9 @@ copyright = '2016, Ethereum'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.4.7'
|
||||
version = '0.4.8'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.4.7-develop'
|
||||
release = '0.4.8-develop'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@ -207,8 +207,8 @@ Creating Contracts via ``new``
|
||||
==============================
|
||||
|
||||
A contract can create a new contract using the ``new`` keyword. The full
|
||||
code of the contract being created has to be known and, thus, recursive
|
||||
creation-dependencies are now possible.
|
||||
code of the contract being created has to be known in advance, so recursive
|
||||
creation-dependencies are not possible.
|
||||
|
||||
::
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ ContractDefinition = ( 'contract' | 'library' ) Identifier
|
||||
ContractPart = StateVariableDeclaration | UsingForDeclaration
|
||||
| StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition
|
||||
|
||||
InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )?
|
||||
InheritanceSpecifier = UserDefinedTypeName ( '(' Expression ( ',' Expression )* ')' )?
|
||||
|
||||
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ('=' Expression)? ';'
|
||||
UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';'
|
||||
@ -23,7 +23,7 @@ StructDefinition = 'struct' Identifier '{'
|
||||
ModifierDefinition = 'modifier' Identifier ParameterList? Block
|
||||
FunctionDefinition = 'function' Identifier? ParameterList
|
||||
( FunctionCall | Identifier | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )*
|
||||
( 'returns' ParameterList )? Block
|
||||
( 'returns' ParameterList )? ( ';' | Block )
|
||||
EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';'
|
||||
|
||||
EnumValue = Identifier
|
||||
@ -36,9 +36,17 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')'
|
||||
// semantic restriction: mappings and structs (recursively) containing mappings
|
||||
// are not allowed in argument lists
|
||||
VariableDeclaration = TypeName Identifier
|
||||
TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName
|
||||
|
||||
TypeName = ElementaryTypeName
|
||||
| UserDefinedTypeName StorageLocation?
|
||||
| Mapping
|
||||
| ArrayTypeName
|
||||
| FunctionTypeName
|
||||
|
||||
UserDefinedTypeName = Identifier ( '.' Identifier )*
|
||||
|
||||
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
|
||||
ArrayTypeName = TypeName StorageLocation? '[' Expression? ']'
|
||||
ArrayTypeName = TypeName '[' Expression? ']' StorageLocation?
|
||||
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )*
|
||||
( 'returns' TypeNameList )?
|
||||
StorageLocation = 'memory' | 'storage'
|
||||
@ -69,7 +77,7 @@ Expression =
|
||||
| Expression '**' Expression
|
||||
| Expression ('*' | '/' | '%') Expression
|
||||
| Expression ('+' | '-') Expression
|
||||
| Expression ('<<' | '>>')
|
||||
| Expression ('<<' | '>>') Expression
|
||||
| Expression '&' Expression
|
||||
| Expression '^' Expression
|
||||
| Expression '|' Expression
|
||||
@ -82,7 +90,12 @@ Expression =
|
||||
| Expression? (',' Expression)
|
||||
| PrimaryExpression
|
||||
|
||||
PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | HexLiteral | StringLiteral
|
||||
PrimaryExpression = Identifier
|
||||
| BooleanLiteral
|
||||
| NumberLiteral
|
||||
| HexLiteral
|
||||
| StringLiteral
|
||||
| ElementaryTypeNameExpression
|
||||
|
||||
FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' Expression? ( ',' Expression )* ')'
|
||||
NewExpression = 'new' Identifier
|
||||
@ -90,13 +103,18 @@ MemberAccess = Expression '.' Identifier
|
||||
IndexAccess = Expression '[' Expression? ']'
|
||||
|
||||
BooleanLiteral = 'true' | 'false'
|
||||
NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)?
|
||||
NumberLiteral = ( HexNumber | DecimalNumber ) (' ' NumberUnit)?
|
||||
NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether'
|
||||
| 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years'
|
||||
HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'')
|
||||
StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"'
|
||||
Identifier = [a-zA-Z_] [a-zA-Z_0-9]*
|
||||
|
||||
HexNumber = '0x' [0-9a-fA-F]+
|
||||
DecimalNumber = [0-9]+
|
||||
|
||||
ElementaryTypeNameExpression = ElementaryTypeName
|
||||
|
||||
ElementaryTypeName = 'address' | 'bool' | 'string' | 'var'
|
||||
| Int | Uint | Byte | Fixed | Ufixed
|
||||
|
||||
|
||||
@ -87,6 +87,15 @@ Solidity Tools
|
||||
* `evmdis <https://github.com/Arachnid/evmdis>`_
|
||||
EVM Disassembler that performs static analysis on the bytecode to provide a higher level of abstraction than raw EVM operations.
|
||||
|
||||
Third-Party Solidity Parsers and Grammars
|
||||
-----------------------------------------
|
||||
|
||||
* `solidity-parser <https://github.com/ConsenSys/solidity-parser>`_
|
||||
Solidity parser for JavaScript
|
||||
|
||||
* `Solidity Grammar for ANTLR 4 <https://github.com/federicobond/solidity-antlr4>`_
|
||||
Solidity grammar for the ANTLR 4 parser generator
|
||||
|
||||
Language Documentation
|
||||
----------------------
|
||||
|
||||
|
||||
@ -96,8 +96,8 @@ Use in Actual Compilers
|
||||
When the compiler is invoked, it is not only possible to specify how to
|
||||
discover the first element of a path, but it is possible to specify path prefix
|
||||
remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to
|
||||
``/usr/local/dapp-bin/library`` and the compiler will read the files from there. If
|
||||
remapping keys are prefixes of each other, the longest is tried first. This
|
||||
``/usr/local/dapp-bin/library`` and the compiler will read the files from there.
|
||||
If multiple remappings can be applied, the one with the longest key is tried first. This
|
||||
allows for a "fallback-remapping" with e.g. ``""`` maps to
|
||||
``"/usr/local/include/solidity"``. Furthermore, these remappings can
|
||||
depend on the context, which allows you to configure packages to
|
||||
|
||||
@ -570,3 +570,4 @@ Language Grammar
|
||||
================
|
||||
|
||||
.. literalinclude:: grammar.txt
|
||||
:language: none
|
||||
|
||||
@ -765,7 +765,7 @@ assigning it to a local variable, as in
|
||||
Mappings
|
||||
========
|
||||
|
||||
Mapping types are declared as ``mapping _KeyType => _ValueType``.
|
||||
Mapping types are declared as ``mapping(_KeyType => _ValueType)``.
|
||||
Here ``_KeyType`` can be almost any type except for a mapping, a dynamically sized array, a contract, an enum and a struct.
|
||||
``_ValueType`` can actually be any type, including mappings.
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ struct OpPop: SimplePeepholeOptimizerMethod<OpPop, 2>
|
||||
if (instructionInfo(instr).ret == 1 && !instructionInfo(instr).sideEffects)
|
||||
{
|
||||
for (int j = 0; j < instructionInfo(instr).args; j++)
|
||||
*_out = Instruction::POP;
|
||||
*_out = {Instruction::POP, _op.location()};
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,6 +217,9 @@ vector<Declaration const*> const& ContractDefinition::inheritableMembers() const
|
||||
|
||||
for (EnumDefinition const* e: definedEnums())
|
||||
addInheritableMember(e);
|
||||
|
||||
for (EventDefinition const* e: events())
|
||||
addInheritableMember(e);
|
||||
}
|
||||
return *m_inheritableMembers;
|
||||
}
|
||||
|
||||
@ -908,19 +908,43 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
||||
solAssert(_memberAccess.annotation().type, "_memberAccess has no type");
|
||||
if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get()))
|
||||
{
|
||||
if (funType->location() != FunctionType::Location::Internal)
|
||||
{
|
||||
_memberAccess.expression().accept(*this);
|
||||
m_context << funType->externalIdentifier();
|
||||
}
|
||||
else
|
||||
switch (funType->location())
|
||||
{
|
||||
case FunctionType::Location::Internal:
|
||||
// We do not visit the expression here on purpose, because in the case of an
|
||||
// internal library function call, this would push the library address forcing
|
||||
// us to link against it although we actually do not need it.
|
||||
auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration);
|
||||
solAssert(!!function, "Function not found in member access");
|
||||
utils().pushCombinedFunctionEntryLabel(*function);
|
||||
if (auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration))
|
||||
utils().pushCombinedFunctionEntryLabel(*function);
|
||||
else
|
||||
solAssert(false, "Function not found in member access");
|
||||
break;
|
||||
case FunctionType::Location::Event:
|
||||
if (!dynamic_cast<EventDefinition const*>(_memberAccess.annotation().referencedDeclaration))
|
||||
solAssert(false, "event not found");
|
||||
// no-op, because the parent node will do the job
|
||||
break;
|
||||
case FunctionType::Location::External:
|
||||
case FunctionType::Location::Creation:
|
||||
case FunctionType::Location::DelegateCall:
|
||||
case FunctionType::Location::CallCode:
|
||||
case FunctionType::Location::Send:
|
||||
case FunctionType::Location::Bare:
|
||||
case FunctionType::Location::BareCallCode:
|
||||
case FunctionType::Location::BareDelegateCall:
|
||||
_memberAccess.expression().accept(*this);
|
||||
m_context << funType->externalIdentifier();
|
||||
break;
|
||||
case FunctionType::Location::Log0:
|
||||
case FunctionType::Location::Log1:
|
||||
case FunctionType::Location::Log2:
|
||||
case FunctionType::Location::Log3:
|
||||
case FunctionType::Location::Log4:
|
||||
case FunctionType::Location::ECRecover:
|
||||
case FunctionType::Location::SHA256:
|
||||
case FunctionType::Location::RIPEMD160:
|
||||
default:
|
||||
solAssert(false, "unsupported member function");
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<TypeType const*>(_memberAccess.annotation().type.get()))
|
||||
|
||||
@ -6,10 +6,9 @@ set -e
|
||||
REPO_ROOT="$(dirname "$0")"/..
|
||||
(
|
||||
cd "$REPO_ROOT"
|
||||
version=`grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt`
|
||||
commithash=`git rev-parse --short=8 HEAD`
|
||||
committimestamp=`git show --format=%ci HEAD | head -n 1`
|
||||
commitdate=`git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./'`
|
||||
version=$(grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt)
|
||||
commithash=$(git rev-parse --short=8 HEAD)
|
||||
commitdate=$(git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./')
|
||||
|
||||
# file exists and has zero size -> not a prerelease
|
||||
if [ -e prerelease.txt -a ! -s prerelease.txt ]
|
||||
|
||||
@ -2770,6 +2770,28 @@ BOOST_AUTO_TEST_CASE(event_no_arguments)
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_access_through_base_name)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A {
|
||||
event x();
|
||||
}
|
||||
contract B is A {
|
||||
function f() returns (uint) {
|
||||
A.x();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
callContractFunction("f()");
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data.empty());
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("x()")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_anonymous)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user