Skip to content

Commit

Permalink
Merge pull request #1436 from profelis/master
Browse files Browse the repository at this point in the history
add unsafe_table_lookup to AST serialization
  • Loading branch information
borisbat authored Dec 16, 2024
2 parents 00ecf8e + ae4d8cd commit 16e9432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions daslib/lint.das
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class LintVisitor : AstVisitor
if v.isAccessUnused
self->lint_error("unused variable {v.name}: {describe(v._type)} (add an underscore prefix if you really need it)", v.at)
return
if !v.access_flags.access_ref && !v.access_flags.access_pass && v.init != null && v.init |> is_expr_const()
self->lint_error("unused variable {v.name}: {describe(v._type)} (add an underscore prefix if you really need it)", v.at)
if !v.access_flags.access_ref && !v.access_flags.access_pass && v.init != null && v.init |> is_expr_const() && !v.access_flags.access_fold
self->lint_error("unused variable {v.name}: {describe(v._type)} (add an underscore prefix if you really need it) {v.access_flags}", v.at)
return
if !v.access_flags.access_ref && !v.access_flags.access_pass && !v.access_flags.access_get && (v.init == null || v.init.flags.noSideEffects)
if !v.access_flags.access_ref && !v.access_flags.access_pass && !v.access_flags.access_get && (v.init == null || v.init.flags.noSideEffects) && !v.access_flags.access_fold
self->lint_error("unused variable {v.name}: {describe(v._type)} (add an underscore prefix if you really need it)", v.at)
return
if !v.access_flags.access_get && !v.access_flags.access_ref
if !v.access_flags.access_get && !v.access_flags.access_ref && (v.init == null)
let sideEffects = (v.init != null && !v.init.flags.noSideEffects)
if !sideEffects
self->lint_error("variable {v.name}: {describe(v._type)} is never used", v.at)
Expand Down
1 change: 1 addition & 0 deletions src/builtin/module_builtin_ast_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,6 +2076,7 @@ namespace das {
<< value.macro_context_persistent_heap
<< value.macro_context_collect
<< value.rtti
<< value.unsafe_table_lookup
<< value.relaxed_pointer_const
<< value.version_2_syntax
<< value.gen2_make_syntax
Expand Down

0 comments on commit 16e9432

Please sign in to comment.