Fix op used when stringifying AstExprIndexName

This commit is contained in:
JohnnyMorganz 2022-07-02 14:09:32 +01:00
parent 6467c855e8
commit ff329bcc48
2 changed files with 3 additions and 3 deletions

View file

@ -385,7 +385,7 @@ struct Printer
else if (const auto& a = expr.as<AstExprIndexName>())
{
visualize(*a->expr);
writer.symbol(".");
writer.symbol(std::string(1, a->op));
writer.write(a->index.value);
}
else if (const auto& a = expr.as<AstExprIndexExpr>())
@ -766,7 +766,7 @@ struct Printer
else if (const auto& a = program.as<AstStatFunction>())
{
writer.keyword("function");
visualizeWithSelf(*a->name, a->func->self != nullptr);
visualize(*a->name);
visualizeFunctionBody(*a->func);
}
else if (const auto& a = program.as<AstStatLocalFunction>())

View file

@ -583,7 +583,7 @@ TEST_CASE_FIXTURE(Fixture, "transpile_error_expr")
auto names = AstNameTable{allocator};
ParseResult parseResult = Parser::parse(code.data(), code.size(), names, allocator, {});
CHECK_EQ("local a = (error-expr: f.%error-id%)-(error-expr)", transpileWithTypes(*parseResult.root));
CHECK_EQ("local a = (error-expr: f:%error-id%)-(error-expr)", transpileWithTypes(*parseResult.root));
}
TEST_CASE_FIXTURE(Fixture, "transpile_error_stat")