mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #10366 from ethereum/wasm-string-literal
[wasm] Document what StringLiteral is
This commit is contained in:
		
						commit
						1dd0cd1245
					
				| @ -345,8 +345,9 @@ bytes BinaryTransform::operator()(Literal const& _literal) | ||||
| 
 | ||||
| bytes BinaryTransform::operator()(StringLiteral const&) | ||||
| { | ||||
| 	// TODO is this used?
 | ||||
| 	yulAssert(false, "String literals not yet implemented"); | ||||
| 	// StringLiteral is a special AST element used for certain builtins.
 | ||||
| 	// It is not mapped to actual WebAssembly, and should be processed in visit(BuiltinCall).
 | ||||
| 	yulAssert(false, ""); | ||||
| } | ||||
| 
 | ||||
| bytes BinaryTransform::operator()(LocalVariable const& _variable) | ||||
|  | ||||
| @ -101,6 +101,8 @@ string TextTransform::operator()(wasm::Literal const& _literal) | ||||
| 
 | ||||
| string TextTransform::operator()(wasm::StringLiteral const& _literal) | ||||
| { | ||||
| 	// StringLiteral is a special AST element used for certain builtins.
 | ||||
| 	// The output of this will not be valid WebAssembly.
 | ||||
| 	string quoted = boost::replace_all_copy(_literal.value, "\\", "\\\\"); | ||||
| 	boost::replace_all(quoted, "\"", "\\\""); | ||||
| 	return "\"" + quoted + "\""; | ||||
|  | ||||
| @ -63,6 +63,7 @@ using Expression = std::variant< | ||||
| >; | ||||
| 
 | ||||
| struct Literal { std::variant<uint32_t, uint64_t> value; }; | ||||
| // This is a special AST element used for certain builtins. It is not mapped to actual WebAssembly.
 | ||||
| struct StringLiteral { std::string value; }; | ||||
| struct LocalVariable { std::string name; }; | ||||
| struct GlobalVariable { std::string name; }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user