MCPcopy Create free account
hub / github.com/argotorg/solidity / handleAst

Method handleAst

solc/CommandLineInterface.cpp:1159–1191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159void CommandLineInterface::handleAst()
1160{
1161 solAssert(CompilerInputModes.count(m_options.input.mode) == 1);
1162
1163 if (!m_options.compiler.outputs.astCompactJson)
1164 return;
1165
1166 std::vector<ASTNode const*> asts;
1167 for (auto const& sourceCode: m_fileReader.sourceUnits())
1168 asts.push_back(&m_compiler->ast(sourceCode.first));
1169
1170 if (!m_options.output.dir.empty())
1171 {
1172 for (auto const& sourceCode: m_fileReader.sourceUnits())
1173 {
1174 std::stringstream data;
1175 std::string postfix = "";
1176 ASTJsonExporter(m_compiler->state(), m_compiler->sourceIndices()).print(data, m_compiler->ast(sourceCode.first), m_options.formatting.json);
1177 postfix += "_json";
1178 boost::filesystem::path path(sourceCode.first);
1179 createFile(path.filename().string() + postfix + ".ast", data.str());
1180 }
1181 }
1182 else
1183 {
1184 sout() << "JSON AST (compact format):" << std::endl << std::endl;
1185 for (auto const& sourceCode: m_fileReader.sourceUnits())
1186 {
1187 sout() << std::endl << "======= " << sourceCode.first << " =======" << std::endl;
1188 ASTJsonExporter(m_compiler->state(), m_compiler->sourceIndices()).print(sout(), m_compiler->ast(sourceCode.first), m_options.formatting.json);
1189 }
1190 }
1191}
1192
1193void CommandLineInterface::serveLSP()
1194{

Callers

nothing calls this directly

Calls 7

ASTJsonExporterClass · 0.85
strMethod · 0.80
countMethod · 0.45
emptyMethod · 0.45
printMethod · 0.45
stateMethod · 0.45
sourceIndicesMethod · 0.45

Tested by

no test coverage detected