Skip to content

Commit 0fb4cb1

Browse files
authored
Merge pull request #2532 from ethereum/develop
Merge develop to release for 0.4.13.
2 parents 194ff03 + 40d4ee4 commit 0fb4cb1

15 files changed

Lines changed: 179 additions & 22 deletions

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ deploy:
221221
branch:
222222
- develop
223223
- release
224+
- /^v[0-9]/
224225
# This is the deploy target for the native build (Linux and macOS)
225226
# which generates ZIPs per commit and the source tarball.
226227
#

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include(EthPolicy)
88
eth_policy()
99

1010
# project name and version should be set after cmake_policy CMP0048
11-
set(PROJECT_VERSION "0.4.12")
11+
set(PROJECT_VERSION "0.4.13")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
# Let's find our dependencies

Changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
### 0.4.13 (2017-07-06)
2+
3+
Features:
4+
* Syntax Checker: Deprecated "throw" in favour of require(), assert() and revert().
5+
* Type Checker: Warn if a local storage reference variable does not explicitly use the keyword ``storage``.
6+
7+
Bugfixes:
8+
* Code Generator: Correctly unregister modifier variables.
9+
* Compiler Interface: Only output AST if analysis was successful.
10+
* Error Output: Do not omit the error type.
11+
112
### 0.4.12 (2017-07-03)
213

314
Features:

docs/bugs_by_version.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@
301301
"bugs": [],
302302
"released": "2017-07-03"
303303
},
304+
"0.4.13": {
305+
"bugs": [],
306+
"released": "2017-07-06"
307+
},
304308
"0.4.2": {
305309
"bugs": [
306310
"SkipEmptyStringLiteral",

docs/contributing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ Alternatively, there is a testing script at ``scripts/test.sh`` which executes a
7878
Whiskers
7979
========
8080

81-
*Whiskers* is a templating system similar to `Moustache <https://mustache.github.io>`_. It is used by the
81+
*Whiskers* is a templating system similar to `Mustache <https://mustache.github.io>`_. It is used by the
8282
compiler in various places to aid readability, and thus maintainability and verifiability, of the code.
8383

84-
The syntax comes with a substantial difference to Moustache: the template markers ``{{`` and ``}}`` are
84+
The syntax comes with a substantial difference to Mustache: the template markers ``{{`` and ``}}`` are
8585
replaced by ``<`` and ``>`` in order to aid parsing and avoid conflicts with :ref:`inline-assembly`
8686
(The symbols ``<`` and ``>`` are invalid in inline assembly, while ``{`` and ``}`` are used to delimit blocks).
8787
Another limitation is that lists are only resolved one depth and they will not recurse. This may change in the future.
@@ -91,5 +91,5 @@ A rough specification is the following:
9191
Any occurrence of ``<name>`` is replaced by the string-value of the supplied variable ``name`` without any
9292
escaping and without iterated replacements. An area can be delimited by ``<#name>...</name>``. It is replaced
9393
by as many concatenations of its contents as there were sets of variables supplied to the template system,
94-
each time replacing any ``<inner>`` items by their respective value. Top-level variales can also be used
95-
inside such areas.
94+
each time replacing any ``<inner>`` items by their respective value. Top-level variables can also be used
95+
inside such areas.

libsolidity/analysis/ReferencesResolver.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,20 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
289289
typeLoc = DataLocation::Memory;
290290
}
291291
else if (varLoc == Location::Default)
292-
typeLoc = _variable.isCallableParameter() ? DataLocation::Memory : DataLocation::Storage;
292+
{
293+
if (_variable.isCallableParameter())
294+
typeLoc = DataLocation::Memory;
295+
else
296+
{
297+
typeLoc = DataLocation::Storage;
298+
if (!_variable.isStateVariable())
299+
m_errorReporter.warning(
300+
_variable.location(),
301+
"Variable is declared as a storage pointer. "
302+
"Use an explicit \"storage\" keyword to silence this warning."
303+
);
304+
}
305+
}
293306
else
294307
typeLoc = varLoc == Location::Memory ? DataLocation::Memory : DataLocation::Storage;
295308
isPointer = !_variable.isStateVariable();

libsolidity/analysis/SyntaxChecker.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
135135
return true;
136136
}
137137

138+
bool SyntaxChecker::visit(Throw const& _throwStatement)
139+
{
140+
m_errorReporter.warning(
141+
_throwStatement.location(),
142+
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
143+
);
144+
145+
return true;
146+
}
147+
138148
bool SyntaxChecker::visit(UnaryOperation const& _operation)
139149
{
140150
if (_operation.getOperator() == Token::Add)

libsolidity/analysis/SyntaxChecker.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace solidity
3333
* - whether continue/break is in a for/while loop.
3434
* - whether a modifier contains at least one '_'
3535
* - issues deprecation warnings for unary '+'
36+
* - issues deprecation warning for throw
3637
*/
3738
class SyntaxChecker: private ASTConstVisitor
3839
{
@@ -59,6 +60,8 @@ class SyntaxChecker: private ASTConstVisitor
5960
virtual bool visit(Continue const& _continueStatement) override;
6061
virtual bool visit(Break const& _breakStatement) override;
6162

63+
virtual bool visit(Throw const& _throwStatement) override;
64+
6265
virtual bool visit(UnaryOperation const& _operation) override;
6366

6467
virtual bool visit(PlaceholderStatement const& _placeholderStatement) override;

libsolidity/analysis/TypeChecker.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,10 +854,12 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
854854
if (auto ref = dynamic_cast<ReferenceType const*>(type(varDecl).get()))
855855
{
856856
if (ref->dataStoredIn(DataLocation::Storage))
857-
m_errorReporter.warning(
858-
varDecl.location(),
859-
"Uninitialized storage pointer. Did you mean '<type> memory " + varDecl.name() + "'?"
860-
);
857+
{
858+
string errorText{"Uninitialized storage pointer."};
859+
if (varDecl.referenceLocation() == VariableDeclaration::Location::Default)
860+
errorText += " Did you mean '<type> memory " + varDecl.name() + "'?";
861+
m_errorReporter.warning(varDecl.location(), errorText);
862+
}
861863
}
862864
else if (dynamic_cast<MappingType const*>(type(varDecl).get()))
863865
m_errorReporter.typeError(

libsolidity/codegen/ContractCompiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,10 @@ void ContractCompiler::appendModifierOrFunctionCode()
928928
);
929929
}
930930
for (VariableDeclaration const* localVariable: modifier.localVariables())
931+
{
932+
addedVariables.push_back(localVariable);
931933
appendStackVariableInitialisation(*localVariable);
934+
}
932935

933936
stackSurplus =
934937
CompilerUtils::sizeOnStack(modifier.parameters()) +

0 commit comments

Comments
 (0)