mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Tests for ether subdenominations. Work in progress
This commit is contained in:
		
							parent
							
								
									dca5f7b57b
								
							
						
					
					
						commit
						426f9a2860
					
				
							
								
								
									
										8
									
								
								AST.cpp
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								AST.cpp
									
									
									
									
									
								
							| @ -599,10 +599,10 @@ Literal::Literal(Location const& _location, Token::Value _token, | |||||||
| 				 Token::Value _sub): | 				 Token::Value _sub): | ||||||
| 	PrimaryExpression(_location), m_token(_token), m_value(_value) | 	PrimaryExpression(_location), m_token(_token), m_value(_value) | ||||||
| { | { | ||||||
| 	solAssert(_sub == Token::ILLEGAL || _sub == Token::ETH_SUB_WEI || | 	if(Token::isEtherSubdenomination(_sub)) | ||||||
| 			  _sub == Token::ETH_SUB_SZABO || _sub == Token::ETH_SUB_FINNEY || | 		m_subDenomination = static_cast<Literal::ethSubDenomination>(_sub); | ||||||
| 			  _sub == Token::ETH_SUB_ETHER, "Illegal Token::Value given to Literal ctor"); | 	else | ||||||
| 	m_subDenomination =static_cast<Literal::ethSubDenomination>(_sub); | 		m_subDenomination = Literal::ethSubDenomination::NONE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Literal::checkTypeRequirements() | void Literal::checkTypeRequirements() | ||||||
|  | |||||||
| @ -694,6 +694,8 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() | |||||||
| 	case Token::NUMBER: | 	case Token::NUMBER: | ||||||
| 		nextToken = m_scanner->peekNextToken(); | 		nextToken = m_scanner->peekNextToken(); | ||||||
| 	case Token::STRING_LITERAL: | 	case Token::STRING_LITERAL: | ||||||
|  | 		if (Token::isEtherSubdenomination(nextToken)) | ||||||
|  | 			m_scanner->next(); | ||||||
| 		nodeFactory.markEndPosition(); | 		nodeFactory.markEndPosition(); | ||||||
| 		expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance(), nextToken); | 		expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance(), nextToken); | ||||||
| 		break; | 		break; | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								Token.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Token.h
									
									
									
									
									
								
							| @ -383,6 +383,7 @@ public: | |||||||
| 	static bool isCountOp(Value op) { return op == INC || op == DEC; } | 	static bool isCountOp(Value op) { return op == INC || op == DEC; } | ||||||
| 	static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } | 	static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } | ||||||
| 	static bool isVisibilitySpecifier(Value op) { return op == PUBLIC || op == PRIVATE || op == PROTECTED; } | 	static bool isVisibilitySpecifier(Value op) { return op == PUBLIC || op == PRIVATE || op == PROTECTED; } | ||||||
|  | 	static bool isEtherSubdenomination(Value op) { return op == ETH_SUB_WEI || op == ETH_SUB_SZABO || op == ETH_SUB_FINNEY || op == Token::ETH_SUB_ETHER; } | ||||||
| 
 | 
 | ||||||
| 	// Returns a string corresponding to the JS token string
 | 	// Returns a string corresponding to the JS token string
 | ||||||
| 	// (.e., "<" for the token LT) or NULL if the token doesn't
 | 	// (.e., "<" for the token LT) or NULL if the token doesn't
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user