question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax error when emitting events in Solidity 0.4.21

See original GitHub issue

This issue is a duplication of this question on Ethereum StackExchange:

I’m having a syntax error in VS Code in the parts where I emit events using new notation for Solidity v0.4.21.

Remix doesn’t raise any errors, though.

My User Settings in VS Code contain "solidity.compileUsingRemoteVersion": "latest", and compiler doesn’t raise error on emit itself, rather gives this message:

Syntax error: Expected "!=", "%", "%=", "&", "&&", "&=", "*", "*=", "+", "++", "+=", ",", "-", "--", "-=", "/", "/*", "/=", ";", "<", "<<", "<<=", "<=", "=", "==", ">", ">=", ">>", ">>=", ">>>", "?", "^", "^=", "|", "|=", "||", comment, end of line, or whitespace but "(" found.

Here’s how it looks like (2nd emit event is ok for some reason):

screen shot 2018-03-13 at 22 36 25

The problem is in syntax only, compilation completes successfully.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:34 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
juanfranblancocommented, Mar 27, 2018

@duaraghav8 Many thanks, I will update it today and let you know. And yes indentation formatting seems rather complex.

2reactions
duaraghav8commented, Mar 19, 2018

MAN this feature is in demand!

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code Syntax error when emitting events in Solidity 0.4.21
I'm having a syntax error in VS Code in the parts where I emit events using new notation for Solidity v0.4.21.
Read more >
'emit' keyword in Solidity. Although there are some ... - Aniket
In order to make events stand out with regards to regular function calls, emit EventName() as opposed to just EventName() should now be...
Read more >
Contracts — Solidity 0.4.21 documentation - API Manual
When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base...
Read more >
Solidity 0.4.21 Release Announcement
General: Support and recommend using emit EventName(); to call events explicitly. Inline Assembly: Enforce strict mode as experimental 0.5.0 ...
Read more >
Solidity Syntax error - SENT - Stack Overflow
The emit keyword was added in Solidity 0.4.21. Prior to that version, you emit events by using just the event name.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found