Skip to content

Commit

Permalink
parser: allow for @[has_globals] to be used for all V programs, tur…
Browse files Browse the repository at this point in the history
…n the `@[wasm_import_namespace]` error into a notice
  • Loading branch information
spytheman committed Mar 6, 2025
1 parent 0eb41e5 commit f8b70b7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -3716,19 +3716,14 @@ fn (mut p Parser) module_decl() ast.Module {
p.is_generated = true
}
'has_globals' {
if p.inside_vlib_file {
p.has_globals = true
} else {
p.error_with_pos('[has_globals] is allowed only in .v files of `vlib` modules',
ma.pos)
}
p.has_globals = true
}
'translated' {
p.is_translated = true
}
'wasm_import_namespace' {
if !p.pref.is_fmt && p.pref.backend != .wasm {
p.error_with_pos('[wasm_import_namespace] is allowed only in the wasm backend',
p.note_with_pos('@[wasm_import_namespace] is only supported by the wasm backend',
ma.pos)
}
}
Expand Down

0 comments on commit f8b70b7

Please sign in to comment.