mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #3369 from ethereum/jsonio-colon
Properly handle colons in file names within jsonio
This commit is contained in:
		
						commit
						8901b38959
					
				| @ -7,6 +7,7 @@ Features: | ||||
| Bugfixes: | ||||
|  * Parser: Disallow event declarations with no parameter list. | ||||
|  * Standard JSON: Populate the ``sourceLocation`` field in the error list. | ||||
|  * Standard JSON: Properly support file names containing a colon (such as URLs). | ||||
|  * Type Checker: Suggest the experimental ABI encoder if using ``struct``s as function parameters | ||||
|    (instead of an internal compiler error). | ||||
|  * Type Checker: Improve error message for wrong struct initialization. | ||||
|  | ||||
| @ -461,7 +461,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) | ||||
| 	Json::Value contractsOutput = Json::objectValue; | ||||
| 	for (string const& contractName: compilationSuccess ? m_compilerStack.contractNames() : vector<string>()) | ||||
| 	{ | ||||
| 		size_t colon = contractName.find(':'); | ||||
| 		size_t colon = contractName.rfind(':'); | ||||
| 		solAssert(colon != string::npos, ""); | ||||
| 		string file = contractName.substr(0, colon); | ||||
| 		string name = contractName.substr(colon + 1); | ||||
|  | ||||
| @ -451,6 +451,36 @@ BOOST_AUTO_TEST_CASE(output_selection_dependent_contract_with_import) | ||||
| 	BOOST_CHECK_EQUAL(dev::jsonCompactPrint(contract["abi"]), "[{\"constant\":false,\"inputs\":[],\"name\":\"f\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(filename_with_colon) | ||||
| { | ||||
| 	char const* input = R"( | ||||
| 	{ | ||||
| 		"language": "Solidity", | ||||
| 		"settings": { | ||||
| 			"outputSelection": { | ||||
| 				"http://github.com/ethereum/solidity/std/StandardToken.sol": { | ||||
| 					"A": [ | ||||
| 						"abi" | ||||
| 					] | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		"sources": { | ||||
| 			"http://github.com/ethereum/solidity/std/StandardToken.sol": { | ||||
| 				"content": "contract A { }" | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	)"; | ||||
| 	Json::Value result = compile(input); | ||||
| 	BOOST_CHECK(containsAtMostWarnings(result)); | ||||
| 	Json::Value contract = getContractResult(result, "http://github.com/ethereum/solidity/std/StandardToken.sol", "A"); | ||||
| 	BOOST_CHECK(contract.isObject()); | ||||
| 	BOOST_CHECK(contract["abi"].isArray()); | ||||
| 	BOOST_CHECK_EQUAL(dev::jsonCompactPrint(contract["abi"]), "[]"); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user