mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #3183 from federicobond/fix-event-parsing
Fix event parsing. Refs #3175
This commit is contained in:
		
						commit
						14707b27e2
					
				| @ -20,6 +20,7 @@ Features: | ||||
|  * Type Checker: More detailed errors for invalid array lengths (such as division by zero). | ||||
| 
 | ||||
| Bugfixes: | ||||
|   * Parser: Disallow event declarations with no parameter list. | ||||
| 
 | ||||
| ### 0.4.18 (2017-10-18) | ||||
| 
 | ||||
|  | ||||
| @ -644,15 +644,11 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition() | ||||
| 
 | ||||
| 	expectToken(Token::Event); | ||||
| 	ASTPointer<ASTString> name(expectIdentifierToken()); | ||||
| 	ASTPointer<ParameterList> parameters; | ||||
| 	if (m_scanner->currentToken() == Token::LParen) | ||||
| 	{ | ||||
| 
 | ||||
| 	VarDeclParserOptions options; | ||||
| 	options.allowIndexed = true; | ||||
| 		parameters = parseParameterList(options); | ||||
| 	} | ||||
| 	else | ||||
| 		parameters = createEmptyParameterList(); | ||||
| 	ASTPointer<ParameterList> parameters = parseParameterList(options); | ||||
| 
 | ||||
| 	bool anonymous = false; | ||||
| 	if (m_scanner->currentToken() == Token::Anonymous) | ||||
| 	{ | ||||
|  | ||||
| @ -2971,7 +2971,7 @@ BOOST_AUTO_TEST_CASE(event_no_arguments) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract ClientReceipt { | ||||
| 			event Deposit; | ||||
| 			event Deposit(); | ||||
| 			function deposit() { | ||||
| 				Deposit(); | ||||
| 			} | ||||
| @ -3013,7 +3013,7 @@ BOOST_AUTO_TEST_CASE(events_with_same_name) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract ClientReceipt { | ||||
| 			event Deposit; | ||||
| 			event Deposit(); | ||||
| 			event Deposit(address _addr); | ||||
| 			event Deposit(address _addr, uint _amount); | ||||
| 			function deposit() returns (uint) { | ||||
| @ -3059,7 +3059,7 @@ BOOST_AUTO_TEST_CASE(events_with_same_name_inherited) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract A { | ||||
| 			event Deposit; | ||||
| 			event Deposit(); | ||||
| 		} | ||||
| 
 | ||||
| 		contract B { | ||||
|  | ||||
| @ -960,6 +960,16 @@ BOOST_AUTO_TEST_CASE(event_arguments_indexed) | ||||
| 	BOOST_CHECK(successParse(text)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(event_with_no_argument_list_fails) | ||||
| { | ||||
| 	char const* text = R"( | ||||
| 		contract c { | ||||
| 			event e; | ||||
| 		} | ||||
| 	)"; | ||||
| 	CHECK_PARSE_ERROR(text, "Expected token LParen got 'Semicolon'"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(visibility_specifiers) | ||||
| { | ||||
| 	char const* text = R"( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user