Nim: importjs+nim doc,Error:importjs pragma requires JavaScript target

Created on 6 Apr 2020  路  2Comments  路  Source: nim-lang/Nim

Examples

$ cat example.nim
func consolog*() {.importjs: "console.log(#)".} =
  ## Documentation

$ nim doc example.nim
example.nim(1, 28) Error: `importjs` pragma requires the JavaScript target

$

Current Output

example.nim(1, 28) Error: `importjs` pragma requires the JavaScript target

Additional Information

  • {.importcpp.} works without error.
  • Documentation may still generate (?).
  • Doc Test exit non-zero.

System Information

{
  "compiled": "2020-04-04T03:24:50",
  "NimVersion": "1.2.0",
  "hostCPU": "amd64",
  "hostOS": "linux",
  "cpuEndian": "littleEndian",
  "getTempDir": "/tmp/",
  "now": "2020-04-06T02:46:00-03:00",
  "getCurrentEncoding": "UTF-8",
  "getFreeMem": 385024,
  "getTotalMem": 528384,
  "getOccupiedMem": 92592,
  "countProcessors": 6,
  "arch": "x86_64",
  "FileSystemCaseSensitive": true,
  "nimcacheDir": "",
  "ccompilerPath": "",
  "currentCompilerExe": "/home/juan/.choosenim/toolchains/nim-1.2.0/bin/nim",
  "nimpretty": "0.2",
  "nimble": "nimble v0.11.0 compiled at 2020-04-05 13:45:51\ngit hash: couldn't determine git hash",
  "nimgrep": "1.5",
  "nimsuggest": "Nim Compiler Version 1.3.1 [Linux: amd64]\nCompiled at 2020-04-05\nCopyright (c) 2006-2020 by Andreas Rumpf\n\nactive boot switches: -d:release -d:danger --gc:markAndSweep",
  "choosenim": "choosenim v0.6.0 (2020-03-06 18:24:57) [linux/amd64]",
  "gcc": "gcc (Arch Linux 9.3.0-1) 9.3.0",
  "clang": "clang version 9.0.1",
  "git": "2.25.1",
  "node": "v13.12.0",
  "python": "3.8.1",
  "ssd": true
}

Most helpful comment

Or simply no check at all.

All 2 comments

Relevant line, could add and c.config.cmd != cmdDoc but it also has to account for nim check so maybe check if JS is defined?

Or simply no check at all.

Was this page helpful?
0 / 5 - 0 ratings