Closed shekhirin closed 2 years ago
This is totally a good idea. The solang vscode plugin also does not need llvm, and if did not need llvm, it could be built as a node wasm module.
The llvm dependencies should be in src/emit/
. If they're not, they should be abstracted/moved.
An Solidity formatter is a great.I'd love to see that happen.
Problem
Currently there's no way to use
parser
without compiling theinkwell
dependency which in turn requires the LLVM to be installed.I encountered that issue while working on Solidity formatter in Foundry (https://github.com/gakonst/foundry/pull/201) where we use only
parser::parse
function to construct the AST. Without the hard LLVM dependency it would be much easier for users to install our CLI since they won't need to have LLVM installed on their machine.Solution
I tried to add an
llvm
feature toCargo.toml
and use#[cfg(feature = "llvm")]
insrc/lib.rs
but that didn't work straight away sinceparser
is writing lots of diagnostic messages while parsing and these messages are written from the package that’s currently depends on LLVM. So simple[features]
inCargo.toml
won’t solve the issue for now.The proposed solution is to separate the diagnostics-related types & functions into the separate module which can be used without LLVM dependency.