Skip to content

Commit 80b7d36

Browse files
axicchriseth
authored andcommitted
Remove non-0.5.0 warning for emit keyword (make it mandatory)
1 parent 503eb8c commit 80b7d36

7 files changed

Lines changed: 7 additions & 25 deletions

File tree

libsolidity/analysis/TypeChecker.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,12 +1712,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
17121712
m_errorReporter.typeError(_functionCall.location(), "\"suicide\" has been deprecated in favour of \"selfdestruct\"");
17131713
}
17141714
if (!m_insideEmitStatement && functionType->kind() == FunctionType::Kind::Event)
1715-
{
1716-
if (m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050))
1717-
m_errorReporter.typeError(_functionCall.location(), "Event invocations have to be prefixed by \"emit\".");
1718-
else
1719-
m_errorReporter.warning(_functionCall.location(), "Invoking events without \"emit\" prefix is deprecated.");
1720-
}
1715+
m_errorReporter.typeError(_functionCall.location(), "Event invocations have to be prefixed by \"emit\".");
17211716

17221717
TypePointers parameterTypes = functionType->parameterTypes();
17231718

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
contract c {
22
event e(uint indexed a, bytes3 indexed s, bool indexed b);
3-
function f() public { e(2, "abc", true); }
3+
function f() public { emit e(2, "abc", true); }
44
}
55
// ----
6-
// Warning: (102-119): Invoking events without "emit" prefix is deprecated.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
contract c {
22
event e(uint a, bytes3 indexed s, bool indexed b);
3-
function f() public { e(2, "abc", true); }
3+
function f() public { emit e(2, "abc", true); }
44
}
55
// ----
6-
// Warning: (94-111): Invoking events without "emit" prefix is deprecated.

test/libsolidity/syntaxTests/nameAndTypeResolution/094_event_inheritance.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ contract base {
22
event e(uint a, bytes3 indexed s, bool indexed b);
33
}
44
contract c is base {
5-
function f() public { e(2, "abc", true); }
5+
function f() public { emit e(2, "abc", true); }
66
}
77
// ----
8-
// Warning: (120-137): Invoking events without "emit" prefix is deprecated.

test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ contract C {
55
}
66
}
77
// ----
8-
// Warning: (62-65): Invoking events without "emit" prefix is deprecated.
8+
// TypeError: (62-65): Event invocations have to be prefixed by "emit".

test/libsolidity/syntaxTests/types/empty_tuple_event.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ pragma solidity ^0.4.3;
22
contract C {
33
event SomeEvent();
44
function a() public {
5-
(SomeEvent(), 7);
5+
(emit SomeEvent(), 7);
66
}
77
}
88
// ----
9-
// Warning: (95-106): Invoking events without "emit" prefix is deprecated.
9+
// TypeError: (95-106): Event invocations have to be prefixed by "emit".
1010
// Warning: (95-106): Tuple component cannot be empty.

test/libsolidity/syntaxTests/types/empty_tuple_event_050.sol

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)