aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/DeclarationContainer.cpp5
-rw-r--r--libsolidity/analysis/DeclarationContainer.h3
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.cpp8
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp9
-rw-r--r--libsolidity/analysis/SyntaxChecker.h2
-rw-r--r--libsolidity/analysis/TypeChecker.cpp150
-rw-r--r--libsolidity/analysis/TypeChecker.h2
-rw-r--r--libsolidity/ast/AST.h6
-rw-r--r--libsolidity/ast/Types.cpp21
-rw-r--r--libsolidity/ast/Types.h2
-rw-r--r--libsolidity/codegen/ABIFunctions.cpp3
-rw-r--r--libsolidity/codegen/ABIFunctions.h2
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp4
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp4
-rw-r--r--libsolidity/formal/SMTChecker.cpp2
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp2
-rw-r--r--libsolidity/interface/AssemblyStack.cpp2
-rw-r--r--libsolidity/interface/CompilerStack.h2
-rw-r--r--libsolidity/interface/ErrorReporter.h6
-rw-r--r--libsolidity/interface/Natspec.h2
-rw-r--r--libsolidity/interface/StandardCompiler.h2
-rw-r--r--libsolidity/parsing/Scanner.h2
22 files changed, 136 insertions, 105 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.cpp b/libsolidity/analysis/DeclarationContainer.cpp
index 786272e4..9e2bf6d3 100644
--- a/libsolidity/analysis/DeclarationContainer.cpp
+++ b/libsolidity/analysis/DeclarationContainer.cpp
@@ -96,6 +96,11 @@ void DeclarationContainer::activateVariable(ASTString const& _name)
m_invisibleDeclarations.erase(_name);
}
+bool DeclarationContainer::isInvisible(ASTString const& _name) const
+{
+ return m_invisibleDeclarations.count(_name);
+}
+
bool DeclarationContainer::registerDeclaration(
Declaration const& _declaration,
ASTString const* _name,
diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h
index a3e0bd0a..9d7a17a3 100644
--- a/libsolidity/analysis/DeclarationContainer.h
+++ b/libsolidity/analysis/DeclarationContainer.h
@@ -62,6 +62,9 @@ public:
/// VariableDeclarationStatements.
void activateVariable(ASTString const& _name);
+ /// @returns true if declaration is currently invisible.
+ bool isInvisible(ASTString const& _name) const;
+
/// @returns existing declaration names similar to @a _name.
/// Searches this and all parent containers.
std::vector<ASTString> similarNames(ASTString const& _name) const;
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp
index b856544a..7c23c992 100644
--- a/libsolidity/analysis/NameAndTypeResolver.cpp
+++ b/libsolidity/analysis/NameAndTypeResolver.cpp
@@ -156,7 +156,13 @@ bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
void NameAndTypeResolver::activateVariable(string const& _name)
{
solAssert(m_currentScope, "");
- m_currentScope->activateVariable(_name);
+ // Scoped local variables are invisible before activation.
+ // When a local variable is activated, its name is removed
+ // from a scope's invisible variables.
+ // This is used to avoid activation of variables of same name
+ // in the same scope (an error is returned).
+ if (m_currentScope->isInvisible(_name))
+ m_currentScope->activateVariable(_name);
}
vector<Declaration const*> NameAndTypeResolver::resolveName(ASTString const& _name, ASTNode const* _scope) const
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index 63f8fac3..4311e77d 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -254,15 +254,6 @@ bool SyntaxChecker::visit(FunctionTypeName const& _node)
return true;
}
-bool SyntaxChecker::visit(VariableDeclaration const& _declaration)
-{
- if (!_declaration.typeName())
- {
- m_errorReporter.syntaxError(_declaration.location(), "Use of the \"var\" keyword is disallowed.");
- }
- return true;
-}
-
bool SyntaxChecker::visit(StructDefinition const& _struct)
{
if (_struct.members().empty())
diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h
index 1579df57..8ee3df37 100644
--- a/libsolidity/analysis/SyntaxChecker.h
+++ b/libsolidity/analysis/SyntaxChecker.h
@@ -69,8 +69,6 @@ private:
virtual bool visit(FunctionDefinition const& _function) override;
virtual bool visit(FunctionTypeName const& _node) override;
- virtual bool visit(VariableDeclaration const& _declaration) override;
-
virtual bool visit(StructDefinition const& _struct) override;
ErrorReporter& m_errorReporter;
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index a11b1879..8ea0a4d7 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -23,6 +23,7 @@
#include <libsolidity/analysis/TypeChecker.h>
#include <memory>
#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/join.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <libsolidity/ast/AST.h>
#include <libsolidity/inlineasm/AsmAnalysis.h>
@@ -123,10 +124,7 @@ bool TypeChecker::visit(ContractDefinition const& _contract)
m_errorReporter.typeError(function->parameterList().location(), "Fallback function cannot take parameters.");
if (!function->returnParameters().empty())
m_errorReporter.typeError(function->returnParameterList()->location(), "Fallback function cannot return values.");
- if (
- _contract.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050) &&
- function->visibility() != FunctionDefinition::Visibility::External
- )
+ if (function->visibility() != FunctionDefinition::Visibility::External)
m_errorReporter.typeError(function->location(), "Fallback function must be defined as \"external\".");
}
@@ -451,7 +449,7 @@ void TypeChecker::overrideError(FunctionDefinition const& function, FunctionDefi
{
m_errorReporter.typeError(
function.location(),
- SecondarySourceLocation().append("Overriden function is here:", super.location()),
+ SecondarySourceLocation().append("Overridden function is here:", super.location()),
message
);
}
@@ -551,33 +549,18 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
if (arguments)
{
- bool v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
-
if (parameterTypes.size() != arguments->size())
{
- if (arguments->size() == 0 && !v050)
- m_errorReporter.warning(
- _inheritance.location(),
- "Wrong argument count for constructor call: " +
- toString(arguments->size()) +
- " arguments given but expected " +
- toString(parameterTypes.size()) +
- "."
- );
- else
- {
- m_errorReporter.typeError(
- _inheritance.location(),
- "Wrong argument count for constructor call: " +
- toString(arguments->size()) +
- " arguments given but expected " +
- toString(parameterTypes.size()) +
- "."
- );
- return;
- }
+ m_errorReporter.typeError(
+ _inheritance.location(),
+ "Wrong argument count for constructor call: " +
+ toString(arguments->size()) +
+ " arguments given but expected " +
+ toString(parameterTypes.size()) +
+ ". Remove parentheses if you do not want to provide arguments here."
+ );
}
- for (size_t i = 0; i < arguments->size(); ++i)
+ for (size_t i = 0; i < std::min(arguments->size(), parameterTypes.size()); ++i)
if (!type(*(*arguments)[i])->isImplicitlyConvertibleTo(*parameterTypes[i]))
m_errorReporter.typeError(
(*arguments)[i]->location(),
@@ -1054,6 +1037,47 @@ void TypeChecker::endVisit(EmitStatement const& _emit)
m_insideEmitStatement = false;
}
+namespace
+{
+/**
+ * @returns a suggested left-hand-side of a multi-variable declaration contairing
+ * the variable declarations given in @a _decls.
+ */
+string createTupleDecl(vector<VariableDeclaration const*> const& _decls)
+{
+ vector<string> components;
+ for (VariableDeclaration const* decl: _decls)
+ if (decl)
+ components.emplace_back(decl->annotation().type->toString(false) + " " + decl->name());
+ else
+ components.emplace_back();
+
+ if (_decls.size() == 1)
+ return components.front();
+ else
+ return "(" + boost::algorithm::join(components, ", ") + ")";
+}
+
+bool typeCanBeExpressed(vector<VariableDeclaration const*> const& decls)
+{
+ for (VariableDeclaration const* decl: decls)
+ {
+ // skip empty tuples (they can be expressed of course)
+ if (!decl)
+ continue;
+
+ if (auto functionType = dynamic_cast<FunctionType const*>(decl->annotation().type.get()))
+ if (
+ functionType->kind() != FunctionType::Kind::Internal &&
+ functionType->kind() != FunctionType::Kind::External
+ )
+ return false;
+ }
+
+ return true;
+}
+}
+
bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
{
bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
@@ -1164,6 +1188,8 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
else
assignments[assignments.size() - i - 1] = variables[variables.size() - i - 1].get();
+ bool autoTypeDeductionNeeded = false;
+
for (size_t i = 0; i < assignments.size(); ++i)
{
if (!assignments[i])
@@ -1174,6 +1200,8 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
solAssert(!!valueComponentType, "");
if (!var.annotation().type)
{
+ autoTypeDeductionNeeded = true;
+
// Infer type from value.
solAssert(!var.typeName(), "");
var.annotation().type = valueComponentType->mobileType();
@@ -1217,14 +1245,6 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
}
else
solAssert(dynamic_cast<FixedPointType const*>(var.annotation().type.get()), "Unknown type.");
-
- m_errorReporter.warning(
- _statement.location(),
- "The type of this variable was inferred as " +
- typeName +
- extension +
- ". This is probably not desired. Use an explicit type to silence this warning."
- );
}
var.accept(*this);
@@ -1261,6 +1281,23 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
}
}
}
+
+ if (autoTypeDeductionNeeded)
+ {
+ if (!typeCanBeExpressed(assignments))
+ m_errorReporter.syntaxError(
+ _statement.location(),
+ "Use of the \"var\" keyword is disallowed. "
+ "Type cannot be expressed in syntax."
+ );
+ else
+ m_errorReporter.syntaxError(
+ _statement.location(),
+ "Use of the \"var\" keyword is disallowed. "
+ "Use explicit declaration `" + createTupleDecl(assignments) + " = ...ยด instead."
+ );
+ }
+
return false;
}
@@ -1408,14 +1445,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
}
else
{
- bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
bool isPure = true;
TypePointer inlineArrayType;
for (size_t i = 0; i < components.size(); ++i)
{
- // Outside of an lvalue-context, the only situation where a component can be empty is (x,).
- if (!components[i] && !(i == 1 && components.size() == 2))
+ if (!components[i])
m_errorReporter.fatalTypeError(_tuple.location(), "Tuple component cannot be empty.");
else if (components[i])
{
@@ -1427,10 +1462,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
{
if (_tuple.isInlineArray())
m_errorReporter.fatalTypeError(components[i]->location(), "Array component cannot be empty.");
- if (v050)
- m_errorReporter.fatalTypeError(components[i]->location(), "Tuple component cannot be empty.");
- else
- m_errorReporter.warning(components[i]->location(), "Tuple component cannot be empty.");
+ m_errorReporter.typeError(components[i]->location(), "Tuple component cannot be empty.");
}
// Note: code generation will visit each of the expression even if they are not assigned from.
@@ -1468,11 +1500,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
if (components.size() == 1)
_tuple.annotation().type = type(*components[0]);
else
- {
- if (components.size() == 2 && !components[1])
- types.pop_back();
_tuple.annotation().type = make_shared<TupleType>(types);
- }
}
}
@@ -1663,8 +1691,6 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
else
_functionCall.annotation().type = make_shared<TupleType>(returnTypes);
- bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
-
if (auto functionName = dynamic_cast<Identifier const*>(&_functionCall.expression()))
{
if (functionName->name() == "sha3" && functionType->kind() == FunctionType::Kind::SHA3)
@@ -1684,23 +1710,15 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
auto const& argType = type(*arguments[i]);
if (auto literal = dynamic_cast<RationalNumberType const*>(argType.get()))
{
- /* If no mobile type is available an error will be raised elsewhere. */
if (literal->mobileType())
+ m_errorReporter.typeError(
+ arguments[i]->location(),
+ "Cannot perform packed encoding for a literal. Please convert it to an explicit type first."
+ );
+ else
{
- if (v050)
- m_errorReporter.typeError(
- arguments[i]->location(),
- "Cannot perform packed encoding for a literal. Please convert it to an explicit type first."
- );
- else
- m_errorReporter.warning(
- arguments[i]->location(),
- "The type of \"" +
- argType->toString() +
- "\" was inferred as " +
- literal->mobileType()->toString() +
- ". This is probably not desired. Use an explicit type to silence this warning."
- );
+ /* If no mobile type is available an error will be raised elsewhere. */
+ solAssert(m_errorReporter.hasErrors(), "");
}
}
}
@@ -1827,7 +1845,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
if (functionType->takesArbitraryParameters())
m_errorReporter.typeError(
_functionCall.location(),
- "Named arguments cannnot be used for functions that take arbitrary parameters."
+ "Named arguments cannot be used for functions that take arbitrary parameters."
);
else if (parameterNames.size() > argumentNames.size())
m_errorReporter.typeError(_functionCall.location(), "Some argument names are missing.");
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index 2245abd6..8dc6b376 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -68,7 +68,7 @@ private:
void checkContractDuplicateFunctions(ContractDefinition const& _contract);
void checkContractDuplicateEvents(ContractDefinition const& _contract);
void checkContractIllegalOverrides(ContractDefinition const& _contract);
- /// Reports a type error with an appropiate message if overriden function signature differs.
+ /// Reports a type error with an appropriate message if overridden function signature differs.
/// Also stores the direct super function in the AST annotations.
void checkFunctionOverride(FunctionDefinition const& function, FunctionDefinition const& super);
void overrideError(FunctionDefinition const& function, FunctionDefinition const& super, std::string message);
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index 9906fa68..e862fd62 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -1169,11 +1169,11 @@ public:
Statement const& body() const { return *m_body; }
private:
- /// For statement's initialization expresion. for(XXX; ; ). Can be empty
+ /// For statement's initialization expression. for(XXX; ; ). Can be empty
ASTPointer<Statement> m_initExpression;
- /// For statement's condition expresion. for(; XXX ; ). Can be empty
+ /// For statement's condition expression. for(; XXX ; ). Can be empty
ASTPointer<Expression> m_condExpression;
- /// For statement's loop expresion. for(;;XXX). Can be empty
+ /// For statement's loop expression. for(;;XXX). Can be empty
ASTPointer<ExpressionStatement> m_loopExpression;
/// The body of the loop
ASTPointer<Statement> m_body;
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 23614e58..dd0736e9 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -771,20 +771,23 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal
}
else if (expPoint != _literal.value().end())
{
- // Parse base and exponent. Checks numeric limit.
- bigint exp = bigint(string(expPoint + 1, _literal.value().end()));
+ // Parse mantissa and exponent. Checks numeric limit.
+ tuple<bool, rational> mantissa = parseRational(string(_literal.value().begin(), expPoint));
- if (exp > numeric_limits<int32_t>::max() || exp < numeric_limits<int32_t>::min())
+ if (!get<0>(mantissa))
return make_tuple(false, rational(0));
+ value = get<1>(mantissa);
- uint32_t expAbs = bigint(abs(exp)).convert_to<uint32_t>();
-
+ // 0E... is always zero.
+ if (value == 0)
+ return make_tuple(true, rational(0));
- tuple<bool, rational> base = parseRational(string(_literal.value().begin(), expPoint));
+ bigint exp = bigint(string(expPoint + 1, _literal.value().end()));
- if (!get<0>(base))
+ if (exp > numeric_limits<int32_t>::max() || exp < numeric_limits<int32_t>::min())
return make_tuple(false, rational(0));
- value = get<1>(base);
+
+ uint32_t expAbs = bigint(abs(exp)).convert_to<uint32_t>();
if (exp < 0)
{
@@ -949,7 +952,7 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ
RationalNumberType const& other = dynamic_cast<RationalNumberType const&>(*_other);
if (Token::isCompareOp(_operator))
{
- // Since we do not have a "BoolConstantType", we have to do the acutal comparison
+ // Since we do not have a "BoolConstantType", we have to do the actual comparison
// at runtime and convert to mobile typse first. Such a comparison is not a very common
// use-case and will be optimized away.
TypePointer thisMobile = mobileType();
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index 4415fb4b..135f4a0e 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -1031,7 +1031,7 @@ public:
/// @param _selfType if the function is bound, this has to be supplied and is the type of the
/// expression the function is called on.
bool canTakeArguments(TypePointers const& _arguments, TypePointer const& _selfType = TypePointer()) const;
- /// @returns true if the types of parameters are equal (does't check return parameter types)
+ /// @returns true if the types of parameters are equal (doesn't check return parameter types)
bool hasEqualArgumentTypes(FunctionType const& _other) const;
/// @returns true if the ABI is used for this call (only meaningful for external calls)
diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp
index 4818e111..b3f1bc7e 100644
--- a/libsolidity/codegen/ABIFunctions.cpp
+++ b/libsolidity/codegen/ABIFunctions.cpp
@@ -1188,7 +1188,8 @@ string ABIFunctions::abiDecodingFunctionCalldataArray(ArrayType const& _type)
solAssert(_type.dataStoredIn(DataLocation::CallData), "");
if (!_type.isDynamicallySized())
solAssert(_type.length() < u256("0xffffffffffffffff"), "");
- solAssert(!_type.baseType()->isDynamicallyEncoded(), "");
+ if (_type.baseType()->isDynamicallyEncoded())
+ solUnimplemented("Calldata arrays with non-value base types are not yet supported by Solidity.");
solAssert(_type.baseType()->calldataEncodedSize() < u256("0xffffffffffffffff"), "");
string functionName =
diff --git a/libsolidity/codegen/ABIFunctions.h b/libsolidity/codegen/ABIFunctions.h
index 6bfb3f15..3caaa1d9 100644
--- a/libsolidity/codegen/ABIFunctions.h
+++ b/libsolidity/codegen/ABIFunctions.h
@@ -203,7 +203,7 @@ private:
std::string arrayLengthFunction(ArrayType const& _type);
/// @returns the name of a function that computes the number of bytes required
/// to store an array in memory given its length (internally encoded, not ABI encoded).
- /// The function reverts for too large lengthes.
+ /// The function reverts for too large lengths.
std::string arrayAllocationSizeFunction(ArrayType const& _type);
/// @returns the name of a function that converts a storage slot number
/// or a memory pointer to the slot number / memory pointer for the data position of an array
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 5adce4a0..2d81a106 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -363,8 +363,8 @@ void CompilerUtils::encodeToMemory(
// Stack during operation:
// <v1> <v2> ... <vn> <mem_start> <dyn_head_1> ... <dyn_head_r> <end_of_mem>
- // The values dyn_head_i are added during the first loop and they point to the head part
- // of the ith dynamic parameter, which is filled once the dynamic parts are processed.
+ // The values dyn_head_n are added during the first loop and they point to the head part
+ // of the nth dynamic parameter, which is filled once the dynamic parts are processed.
// store memory start pointer
m_context << Instruction::DUP1;
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 2e548e32..483faae4 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -1751,7 +1751,7 @@ void ExpressionCompiler::appendShiftOperatorCode(Token::Value _operator, Type co
{
if (c_valueSigned)
// In the following assembly snippet, xor_mask will be zero, if value_to_shift is positive.
- // Therefor xor'ing with xor_mask is the identity and the computation reduces to
+ // Therefore xor'ing with xor_mask is the identity and the computation reduces to
// div(value_to_shift, exp(2, shift_amount)), which is correct, since for positive values
// arithmetic right shift is dividing by a power of two (which, as a bitwise operation, results
// in discarding bits on the right and filling with zeros from the left).
@@ -1879,7 +1879,7 @@ void ExpressionCompiler::appendExternalFunctionCall(
{
m_context << u256(0);
utils().fetchFreeMemoryPointer();
- // This touches too much, but that way we save some rounding arithmetics
+ // This touches too much, but that way we save some rounding arithmetic
m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE;
}
}
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp
index a4d9500b..e2a51267 100644
--- a/libsolidity/formal/SMTChecker.cpp
+++ b/libsolidity/formal/SMTChecker.cpp
@@ -95,7 +95,7 @@ bool SMTChecker::visit(FunctionDefinition const& _function)
void SMTChecker::endVisit(FunctionDefinition const&)
{
- // TOOD we could check for "reachability", i.e. satisfiability here.
+ // TODO we could check for "reachability", i.e. satisfiability here.
// We only handle local variables, so we clear at the beginning of the function.
// If we add storage variables, those should be cleared differently.
removeLocalVariables();
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index 7df9ab88..cd429a98 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -150,7 +150,7 @@ assembly::Statement Parser::parseStatement()
expectToken(Token::Comma);
elementary = parseElementaryOperation();
if (elementary.type() != typeid(assembly::Identifier))
- fatalParserError("Variable name expected in multiple assignemnt.");
+ fatalParserError("Variable name expected in multiple assignment.");
assignment.variableNames.emplace_back(boost::get<assembly::Identifier>(elementary));
}
while (currentToken() == Token::Comma);
diff --git a/libsolidity/interface/AssemblyStack.cpp b/libsolidity/interface/AssemblyStack.cpp
index a4b0265e..46fa1d6b 100644
--- a/libsolidity/interface/AssemblyStack.cpp
+++ b/libsolidity/interface/AssemblyStack.cpp
@@ -119,7 +119,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
julia::EVMAssembly assembly(true);
julia::CodeTransform(assembly, *m_analysisInfo, m_language == Language::Yul, true)(*m_parserResult);
object.bytecode = make_shared<eth::LinkerObject>(assembly.finalize());
- /// TOOD: fill out text representation
+ /// TODO: fill out text representation
return object;
}
case Machine::eWasm:
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index 4359c3fa..0578ac86 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -93,7 +93,7 @@ public:
m_errorList(),
m_errorReporter(m_errorList) {}
- /// @returns the list of errors that occured during parsing and type checking.
+ /// @returns the list of errors that occurred during parsing and type checking.
ErrorList const& errors() const { return m_errorReporter.errors(); }
/// @returns the current state.
diff --git a/libsolidity/interface/ErrorReporter.h b/libsolidity/interface/ErrorReporter.h
index d1a0030f..fd53587a 100644
--- a/libsolidity/interface/ErrorReporter.h
+++ b/libsolidity/interface/ErrorReporter.h
@@ -92,6 +92,12 @@ public:
void clear();
+ /// @returns true iff there is any error (ignores warnings).
+ bool hasErrors() const
+ {
+ return m_errorCount > 0;
+ }
+
private:
void error(Error::Type _type,
SourceLocation const& _location,
diff --git a/libsolidity/interface/Natspec.h b/libsolidity/interface/Natspec.h
index 0701f821..6a827d3b 100644
--- a/libsolidity/interface/Natspec.h
+++ b/libsolidity/interface/Natspec.h
@@ -45,7 +45,7 @@ public:
/// @param _contractDef The contract definition
/// @return A JSON representation of the contract's user documentation
static Json::Value userDocumentation(ContractDefinition const& _contractDef);
- /// Genereates the Developer's documentation of the contract
+ /// Generates the Developer's documentation of the contract
/// @param _contractDef The contract definition
/// @return A JSON representation
/// of the contract's developer documentation
diff --git a/libsolidity/interface/StandardCompiler.h b/libsolidity/interface/StandardCompiler.h
index 11a0b4c2..2772394a 100644
--- a/libsolidity/interface/StandardCompiler.h
+++ b/libsolidity/interface/StandardCompiler.h
@@ -31,7 +31,7 @@ namespace solidity
{
/**
- * Standard JSON compiler interface, which expects a JSON input and returns a JSON ouput.
+ * Standard JSON compiler interface, which expects a JSON input and returns a JSON output.
* See docs/using-the-compiler#compiler-input-and-output-json-description.
*/
class StandardCompiler: boost::noncopyable
diff --git a/libsolidity/parsing/Scanner.h b/libsolidity/parsing/Scanner.h
index 0adaa6fd..8a3011eb 100644
--- a/libsolidity/parsing/Scanner.h
+++ b/libsolidity/parsing/Scanner.h
@@ -223,7 +223,7 @@ private:
bool isSourcePastEndOfInput() const { return m_source.isPastEndOfInput(); }
TokenDesc m_skippedComment; // desc for current skipped comment
- TokenDesc m_nextSkippedComment; // desc for next skiped comment
+ TokenDesc m_nextSkippedComment; // desc for next skipped comment
TokenDesc m_currentToken; // desc for current token (as returned by Next())
TokenDesc m_nextToken; // desc for next token (one token look-ahead)