Skip to content

Commit

Permalink
feat(napi/transform): display semantic error (#6160)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Sep 29, 2024
1 parent f27d59f commit 15552ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions napi/transform/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ pub fn transform(
}

fn transpile(ctx: &TransformContext<'_>) -> CodegenReturn {
let (symbols, scopes) = SemanticBuilder::new(ctx.source_text())
let semantic_ret = SemanticBuilder::new(ctx.source_text())
// Estimate transformer will triple scopes, symbols, references
.with_excess_capacity(2.0)
.build(&ctx.program())
.semantic
.into_symbol_table_and_scope_tree();
.with_check_syntax_error(true)
.build(&ctx.program());
ctx.add_diagnostics(semantic_ret.errors);

let (symbols, scopes) = semantic_ret.semantic.into_symbol_table_and_scope_tree();
let ret = Transformer::new(
ctx.allocator,
ctx.file_path(),
Expand Down

0 comments on commit 15552ac

Please sign in to comment.