mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
transformer: add support for instrumenting the V compiler with -d trace_transformer
This commit is contained in:
parent
f002fd4493
commit
234fb8e2b0
2 changed files with 5 additions and 0 deletions
|
@ -285,6 +285,7 @@ a copy of the compiler rather than replacing it with `v self`.
|
|||
| `trace_scanner` | Prints details about the recognized tokens. *Very* verbose. Use `./vnew -no-builtin -check-syntax file.v` later. |
|
||||
| `trace_parser` | Prints details about parsed statements and expressions. Very verbose. Use it for panics in the parser. |
|
||||
| `trace_checker` | Prints details about the statements being checked. Very verbose. Use it for panics in the checker. |
|
||||
| `trace_transformer` | Prints details about the statements being transformed. Very verbose. Use it for panics in the transformer stage. |
|
||||
| | |
|
||||
| `trace_gen` | Prints all the strings written to the generated C file. Very verbose. |
|
||||
| `trace_cgen_stmt` | Prints details about the statements that are being processed by cgen. |
|
||||
|
|
|
@ -174,6 +174,10 @@ pub fn (mut t Transformer) check_safe_array(mut node ast.IndexExpr) {
|
|||
}
|
||||
|
||||
pub fn (mut t Transformer) stmt(mut node ast.Stmt) ast.Stmt {
|
||||
$if trace_transformer ? {
|
||||
ntype := typeof(*node).replace('v.ast.', '')
|
||||
eprintln('transformer: ${t.file.path:-50} | pos: ${node.pos.line_str():-39} | node: ${ntype:12} | ${node}')
|
||||
}
|
||||
match mut node {
|
||||
ast.EmptyStmt {}
|
||||
ast.NodeError {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue