mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	added one more test and realized that there was one last change before the parser is perfect
This commit is contained in:
		
							parent
							
								
									f7a1860abd
								
							
						
					
					
						commit
						fe04d7f7f7
					
				| @ -1056,7 +1056,7 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() | |||||||
| 				if (m_scanner->currentToken() == oppositeToken) | 				if (m_scanner->currentToken() == oppositeToken) | ||||||
| 					break; | 					break; | ||||||
| 				else if (m_scanner->currentToken() == Token::Comma) | 				else if (m_scanner->currentToken() == Token::Comma) | ||||||
| 					if (isArray && (m_scanner->peekNextToken() == (Token::Comma || oppositeToken))) | 					if (isArray && (m_scanner->peekNextToken() == Token::Comma || m_scanner->peekNextToken() == oppositeToken)) | ||||||
| 						fatalParserError(std::string("Expected value in array cell after ',' .")); | 						fatalParserError(std::string("Expected value in array cell after ',' .")); | ||||||
| 					m_scanner->next(); | 					m_scanner->next(); | ||||||
| 			} | 			} | ||||||
|  | |||||||
| @ -1047,28 +1047,55 @@ BOOST_AUTO_TEST_CASE(using_for) | |||||||
| 	BOOST_CHECK(successParse(text)); | 	BOOST_CHECK(successParse(text)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOST_AUTO_TEST_CASE(inline_array_declaration) | BOOST_AUTO_TEST_CASE(inline_array_declaration_lvalue) | ||||||
| { | { | ||||||
| 	char const* text = R"( | 	char const* text = R"( | ||||||
| 		contract c { | 		contract c { | ||||||
| 			uint[] a; | 			uint[] a; | ||||||
| 			function f() returns (uint, uint) { | 			function f() returns (uint) { | ||||||
| 				a = [1,2,3]; | 				a = [1,2,3]; | ||||||
| 				return (a[3], [3,4][0]); | 				return (a[3]); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	)"; | 	)"; | ||||||
| 	BOOST_CHECK(successParse(text)); | 	BOOST_CHECK(successParse(text)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOST_AUTO_TEST_CASE(inline_array_empty_cells_check) | BOOST_AUTO_TEST_CASE(inline_array_declaration_self) | ||||||
|  | { | ||||||
|  | 	char const* text = R"( | ||||||
|  | 		contract c { | ||||||
|  | 			uint[] a; | ||||||
|  | 			function f() returns (uint) { | ||||||
|  | 				return ([1,2,3][0]); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	)"; | ||||||
|  | 	BOOST_CHECK(successParse(text)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | BOOST_AUTO_TEST_CASE(inline_array_empty_cells_check_beginning) | ||||||
| { | { | ||||||
| 	char const* text = R"( | 	char const* text = R"( | ||||||
| 		contract c { | 		contract c { | ||||||
| 			uint[] a; | 			uint[] a; | ||||||
| 			function f() returns (uint, uint) { | 			function f() returns (uint, uint) { | ||||||
| 				a = [,2,3]; | 				a = [,2,3]; | ||||||
| 				return (a[3], [3,4][0]); | 				return (a[3], [,3,4][0]); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	)"; | ||||||
|  | 	BOOST_CHECK(!successParse(text)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | BOOST_AUTO_TEST_CASE(inline_array_empty_cells_check_commas) | ||||||
|  | { | ||||||
|  | 	char const* text = R"( | ||||||
|  | 		contract c { | ||||||
|  | 			uint[] a; | ||||||
|  | 			function f() returns (uint, uint) { | ||||||
|  | 				a = [1, ,3]; | ||||||
|  | 				return (a[3], [3, ,4][0]); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	)"; | 	)"; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user