feat: 增加了analyzer, compiler不再分析并且报错, 只生产 bytecode, analyzer作为前端结束最后一道防线检查代码,同时引入一个简单的LSP
This commit is contained in:
@@ -12,13 +12,13 @@ namespace Fig
|
||||
Result<void, Error> Compiler::CompileVarDecl(VarDecl *varDecl)
|
||||
{
|
||||
const String &name = varDecl->name;
|
||||
if (HasLocalInCurrentScope(name))
|
||||
{
|
||||
return std::unexpected(Error(ErrorType::RedeclarationError,
|
||||
std::format("variable `{}` has already defined in this scope", name),
|
||||
"change its name",
|
||||
makeSourceLocation(varDecl)));
|
||||
}
|
||||
// if (HasLocalInCurrentScope(name))
|
||||
// {
|
||||
// return std::unexpected(Error(ErrorType::RedeclarationError,
|
||||
// std::format("variable `{}` has already defined in this scope", name),
|
||||
// "change its name",
|
||||
// makeSourceLocation(varDecl)));
|
||||
// }
|
||||
std::uint8_t varReg;
|
||||
if (varDecl->initExpr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user