aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-09-01 00:44:29 +0800
committerLianaHus <liana@ethdev.com>2015-09-08 19:12:00 +0800
commit1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4 (patch)
tree6ecb1323bec51a67a53d63bfd250f4ccfcee926c /solc
parent6f4a39c183a905b8e07da59c17bfd25c2febbf7f (diff)
downloaddexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar.gz
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar.bz2
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar.lz
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar.xz
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.tar.zst
dexon-solidity-1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4.zip
renamed getter functions
Diffstat (limited to 'solc')
-rw-r--r--solc/CommandLineInterface.cpp80
-rw-r--r--solc/jsonCompiler.cpp40
2 files changed, 60 insertions, 60 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 28f550ea..3ce6a2d9 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -123,31 +123,31 @@ void CommandLineInterface::handleBinary(string const& _contract)
if (m_args.count(g_argBinaryStr))
{
if (m_args.count("output-dir"))
- createFile(_contract + ".bin", toHex(m_compiler->getBytecode(_contract)));
+ createFile(_contract + ".bin", toHex(m_compiler->bytecode(_contract)));
else
{
cout << "Binary: " << endl;
- cout << toHex(m_compiler->getBytecode(_contract)) << endl;
+ cout << toHex(m_compiler->bytecode(_contract)) << endl;
}
}
if (m_args.count(g_argCloneBinaryStr))
{
if (m_args.count("output-dir"))
- createFile(_contract + ".clone_bin", toHex(m_compiler->getCloneBytecode(_contract)));
+ createFile(_contract + ".clone_bin", toHex(m_compiler->cloneBytecode(_contract)));
else
{
cout << "Clone Binary: " << endl;
- cout << toHex(m_compiler->getCloneBytecode(_contract)) << endl;
+ cout << toHex(m_compiler->cloneBytecode(_contract)) << endl;
}
}
if (m_args.count(g_argRuntimeBinaryStr))
{
if (m_args.count("output-dir"))
- createFile(_contract + ".bin", toHex(m_compiler->getRuntimeBytecode(_contract)));
+ createFile(_contract + ".bin", toHex(m_compiler->runtimeBytecode(_contract)));
else
{
cout << "Binary of the runtime part: " << endl;
- cout << toHex(m_compiler->getRuntimeBytecode(_contract)) << endl;
+ cout << toHex(m_compiler->runtimeBytecode(_contract)) << endl;
}
}
}
@@ -155,11 +155,11 @@ void CommandLineInterface::handleBinary(string const& _contract)
void CommandLineInterface::handleOpcode(string const& _contract)
{
if (m_args.count("output-dir"))
- createFile(_contract + ".opcode", eth::disassemble(m_compiler->getBytecode(_contract)));
+ createFile(_contract + ".opcode", eth::disassemble(m_compiler->bytecode(_contract)));
else
{
cout << "Opcodes: " << endl;
- cout << eth::disassemble(m_compiler->getBytecode(_contract));
+ cout << eth::disassemble(m_compiler->bytecode(_contract));
cout << endl;
}
@@ -179,7 +179,7 @@ void CommandLineInterface::handleSignatureHashes(string const& _contract)
return;
string out;
- for (auto const& it: m_compiler->getContractDefinition(_contract).getInterfaceFunctions())
+ for (auto const& it: m_compiler->contractDefinition(_contract).interfaceFunctions())
out += toHex(it.first.ref()) + ": " + it.second->externalSignature() + "\n";
if (m_args.count("output-dir"))
@@ -223,11 +223,11 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
if (m_args.count(argName))
{
if (m_args.count("output-dir"))
- createFile(_contract + suffix, m_compiler->getMetadata(_contract, _type));
+ createFile(_contract + suffix, m_compiler->metadata(_contract, _type));
else
{
cout << title << endl;
- cout << m_compiler->getMetadata(_contract, _type) << endl;
+ cout << m_compiler->metadata(_contract, _type) << endl;
}
}
@@ -236,46 +236,46 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
void CommandLineInterface::handleGasEstimation(string const& _contract)
{
using Gas = GasEstimator::GasConsumption;
- if (!m_compiler->getAssemblyItems(_contract) && !m_compiler->getRuntimeAssemblyItems(_contract))
+ if (!m_compiler->assemblyItems(_contract) && !m_compiler->runtimeAssemblyItems(_contract))
return;
cout << "Gas estimation:" << endl;
- if (eth::AssemblyItems const* items = m_compiler->getAssemblyItems(_contract))
+ if (eth::AssemblyItems const* items = m_compiler->assemblyItems(_contract))
{
Gas gas = GasEstimator::functionalEstimation(*items);
- u256 bytecodeSize(m_compiler->getRuntimeBytecode(_contract).size());
+ u256 bytecodeSize(m_compiler->runtimeBytecode(_contract).size());
cout << "construction:" << endl;
cout << " " << gas << " + " << (bytecodeSize * eth::c_createDataGas) << " = ";
gas += bytecodeSize * eth::c_createDataGas;
cout << gas << endl;
}
- if (eth::AssemblyItems const* items = m_compiler->getRuntimeAssemblyItems(_contract))
+ if (eth::AssemblyItems const* items = m_compiler->runtimeAssemblyItems(_contract))
{
- ContractDefinition const& contract = m_compiler->getContractDefinition(_contract);
+ ContractDefinition const& contract = m_compiler->contractDefinition(_contract);
cout << "external:" << endl;
- for (auto it: contract.getInterfaceFunctions())
+ for (auto it: contract.interfaceFunctions())
{
string sig = it.second->externalSignature();
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, sig);
cout << " " << sig << ":\t" << gas << endl;
}
- if (contract.getFallbackFunction())
+ if (contract.fallbackFunction())
{
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, "INVALID");
cout << " fallback:\t" << gas << endl;
}
cout << "internal:" << endl;
- for (auto const& it: contract.getDefinedFunctions())
+ for (auto const& it: contract.definedFunctions())
{
if (it->isPartOfExternalInterface() || it->isConstructor())
continue;
- size_t entry = m_compiler->getFunctionEntryPoint(_contract, *it);
+ size_t entry = m_compiler->functionEntryPoint(_contract, *it);
GasEstimator::GasConsumption gas = GasEstimator::GasConsumption::infinite();
if (entry > 0)
gas = GasEstimator::functionalEstimation(*items, entry, *it);
FunctionType type(*it);
- cout << " " << it->getName() << "(";
- auto end = type.getParameterTypes().end();
- for (auto it = type.getParameterTypes().begin(); it != end; ++it)
+ cout << " " << it->name() << "(";
+ auto end = type.parameterTypes().end();
+ for (auto it = type.parameterTypes().begin(); it != end; ++it)
cout << (*it)->toString() << (it + 1 == end ? "" : ",");
cout << "):\t" << gas << endl;
}
@@ -488,7 +488,7 @@ void CommandLineInterface::handleCombinedJSON()
set<string> requests;
boost::split(requests, m_args["combined-json"].as<string>(), boost::is_any_of(","));
- vector<string> contracts = m_compiler->getContractNames();
+ vector<string> contracts = m_compiler->contractNames();
if (!contracts.empty())
output["contracts"] = Json::Value(Json::objectValue);
@@ -496,24 +496,24 @@ void CommandLineInterface::handleCombinedJSON()
{
Json::Value contractData(Json::objectValue);
if (requests.count("interface"))
- contractData["interface"] = m_compiler->getSolidityInterface(contractName);
+ contractData["interface"] = m_compiler->solidityInterface(contractName);
if (requests.count("abi"))
- contractData["abi"] = m_compiler->getInterface(contractName);
+ contractData["abi"] = m_compiler->interface(contractName);
if (requests.count("bin"))
- contractData["bin"] = toHex(m_compiler->getBytecode(contractName));
+ contractData["bin"] = toHex(m_compiler->bytecode(contractName));
if (requests.count("clone-bin"))
- contractData["clone-bin"] = toHex(m_compiler->getCloneBytecode(contractName));
+ contractData["clone-bin"] = toHex(m_compiler->cloneBytecode(contractName));
if (requests.count("opcodes"))
- contractData["opcodes"] = eth::disassemble(m_compiler->getBytecode(contractName));
+ contractData["opcodes"] = eth::disassemble(m_compiler->bytecode(contractName));
if (requests.count("asm"))
{
ostringstream unused;
contractData["asm"] = m_compiler->streamAssembly(unused, contractName, m_sourceCodes, true);
}
if (requests.count("devdoc"))
- contractData["devdoc"] = m_compiler->getMetadata(contractName, DocumentationType::NatspecDev);
+ contractData["devdoc"] = m_compiler->metadata(contractName, DocumentationType::NatspecDev);
if (requests.count("userdoc"))
- contractData["userdoc"] = m_compiler->getMetadata(contractName, DocumentationType::NatspecUser);
+ contractData["userdoc"] = m_compiler->metadata(contractName, DocumentationType::NatspecUser);
output["contracts"][contractName] = contractData;
}
@@ -522,7 +522,7 @@ void CommandLineInterface::handleCombinedJSON()
output["sources"] = Json::Value(Json::objectValue);
for (auto const& sourceCode: m_sourceCodes)
{
- ASTJsonConverter converter(m_compiler->getAST(sourceCode.first));
+ ASTJsonConverter converter(m_compiler->AST(sourceCode.first));
output["sources"][sourceCode.first] = Json::Value(Json::objectValue);
output["sources"][sourceCode.first]["AST"] = converter.json();
}
@@ -546,11 +546,11 @@ void CommandLineInterface::handleAst(string const& _argStr)
{
vector<ASTNode const*> asts;
for (auto const& sourceCode: m_sourceCodes)
- asts.push_back(&m_compiler->getAST(sourceCode.first));
+ asts.push_back(&m_compiler->AST(sourceCode.first));
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
- if (m_compiler->getRuntimeAssemblyItems())
+ if (m_compiler->runtimeAssemblyItems())
gasCosts = GasEstimator::breakToStatementLevel(
- GasEstimator::structuralEstimation(*m_compiler->getRuntimeAssemblyItems(), asts),
+ GasEstimator::structuralEstimation(*m_compiler->runtimeAssemblyItems(), asts),
asts
);
@@ -562,12 +562,12 @@ void CommandLineInterface::handleAst(string const& _argStr)
string postfix = "";
if (_argStr == g_argAstStr)
{
- ASTPrinter printer(m_compiler->getAST(sourceCode.first), sourceCode.second);
+ ASTPrinter printer(m_compiler->AST(sourceCode.first), sourceCode.second);
printer.print(data);
}
else
{
- ASTJsonConverter converter(m_compiler->getAST(sourceCode.first));
+ ASTJsonConverter converter(m_compiler->AST(sourceCode.first));
converter.print(data);
postfix += "_json";
}
@@ -584,7 +584,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
if (_argStr == g_argAstStr)
{
ASTPrinter printer(
- m_compiler->getAST(sourceCode.first),
+ m_compiler->AST(sourceCode.first),
sourceCode.second,
gasCosts
);
@@ -592,7 +592,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
}
else
{
- ASTJsonConverter converter(m_compiler->getAST(sourceCode.first));
+ ASTJsonConverter converter(m_compiler->AST(sourceCode.first));
converter.print(cout);
}
}
@@ -608,7 +608,7 @@ void CommandLineInterface::actOnInput()
handleAst(g_argAstStr);
handleAst(g_argAstJson);
- vector<string> contracts = m_compiler->getContractNames();
+ vector<string> contracts = m_compiler->contractNames();
for (string const& contract: contracts)
{
if (needsHumanTargetedStdout(m_args))
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index bde13762..207ecb3c 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -54,7 +54,7 @@ string formatError(Exception const& _exception, string const& _name, CompilerSta
Json::Value functionHashes(ContractDefinition const& _contract)
{
Json::Value functionHashes(Json::objectValue);
- for (auto const& it: _contract.getInterfaceFunctions())
+ for (auto const& it: _contract.interfaceFunctions())
functionHashes[it.second->externalSignature()] = toHex(it.first.ref());
return functionHashes;
}
@@ -71,42 +71,42 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
{
Json::Value gasEstimates(Json::objectValue);
using Gas = GasEstimator::GasConsumption;
- if (!_compiler.getAssemblyItems(_contract) && !_compiler.getRuntimeAssemblyItems(_contract))
+ if (!_compiler.assemblyItems(_contract) && !_compiler.runtimeAssemblyItems(_contract))
return gasEstimates;
- if (eth::AssemblyItems const* items = _compiler.getAssemblyItems(_contract))
+ if (eth::AssemblyItems const* items = _compiler.assemblyItems(_contract))
{
Gas gas = GasEstimator::functionalEstimation(*items);
- u256 bytecodeSize(_compiler.getRuntimeBytecode(_contract).size());
+ u256 bytecodeSize(_compiler.runtimeBytecode(_contract).size());
Json::Value creationGas(Json::arrayValue);
creationGas[0] = gasToJson(gas);
creationGas[1] = gasToJson(bytecodeSize * eth::c_createDataGas);
gasEstimates["creation"] = creationGas;
}
- if (eth::AssemblyItems const* items = _compiler.getRuntimeAssemblyItems(_contract))
+ if (eth::AssemblyItems const* items = _compiler.runtimeAssemblyItems(_contract))
{
- ContractDefinition const& contract = _compiler.getContractDefinition(_contract);
+ ContractDefinition const& contract = _compiler.contractDefinition(_contract);
Json::Value externalFunctions(Json::objectValue);
- for (auto it: contract.getInterfaceFunctions())
+ for (auto it: contract.interfaceFunctions())
{
string sig = it.second->externalSignature();
externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig));
}
- if (contract.getFallbackFunction())
+ if (contract.fallbackFunction())
externalFunctions[""] = gasToJson(GasEstimator::functionalEstimation(*items, "INVALID"));
gasEstimates["external"] = externalFunctions;
Json::Value internalFunctions(Json::objectValue);
- for (auto const& it: contract.getDefinedFunctions())
+ for (auto const& it: contract.definedFunctions())
{
if (it->isPartOfExternalInterface() || it->isConstructor())
continue;
- size_t entry = _compiler.getFunctionEntryPoint(_contract, *it);
+ size_t entry = _compiler.functionEntryPoint(_contract, *it);
GasEstimator::GasConsumption gas = GasEstimator::GasConsumption::infinite();
if (entry > 0)
gas = GasEstimator::functionalEstimation(*items, entry, *it);
FunctionType type(*it);
- string sig = it->getName() + "(";
- auto end = type.getParameterTypes().end();
- for (auto it = type.getParameterTypes().begin(); it != end; ++it)
+ string sig = it->name() + "(";
+ auto end = type.parameterTypes().end();
+ for (auto it = type.parameterTypes().begin(); it != end; ++it)
sig += (*it)->toString() + (it + 1 == end ? "" : ",");
sig += ")";
internalFunctions[sig] = gasToJson(gas);
@@ -163,14 +163,14 @@ string compile(string _input, bool _optimize)
}
output["contracts"] = Json::Value(Json::objectValue);
- for (string const& contractName: compiler.getContractNames())
+ for (string const& contractName: compiler.contractNames())
{
Json::Value contractData(Json::objectValue);
- contractData["solidity_interface"] = compiler.getSolidityInterface(contractName);
- contractData["interface"] = compiler.getInterface(contractName);
- contractData["bytecode"] = toHex(compiler.getBytecode(contractName));
- contractData["opcodes"] = eth::disassemble(compiler.getBytecode(contractName));
- contractData["functionHashes"] = functionHashes(compiler.getContractDefinition(contractName));
+ contractData["solidity_interface"] = compiler.solidityInterface(contractName);
+ contractData["interface"] = compiler.interface(contractName);
+ contractData["bytecode"] = toHex(compiler.bytecode(contractName));
+ contractData["opcodes"] = eth::disassemble(compiler.bytecode(contractName));
+ contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName));
contractData["gasEstimates"] = estimateGas(compiler, contractName);
ostringstream unused;
contractData["assembly"] = compiler.streamAssembly(unused, contractName, sources, true);
@@ -179,7 +179,7 @@ string compile(string _input, bool _optimize)
output["sources"] = Json::Value(Json::objectValue);
output["sources"][""] = Json::Value(Json::objectValue);
- output["sources"][""]["AST"] = ASTJsonConverter(compiler.getAST("")).json();
+ output["sources"][""]["AST"] = ASTJsonConverter(compiler.AST("")).json();
return Json::FastWriter().write(output);
}