Skip to content

disruptek/dust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dust

Given a test program that produces a semantic error, mutate the AST of that program to remove syntax that is irrelevant to the error.

Usage

It will overwrite your source file during operation.

--define:release is strongly recommended.

dust test.nim

Example

import macros

macro foo(n: typed) =
  copyNimTree(n)


# Why is this ok
foo:
  var a = 3

foo:
  let b = 3

# But this is not
foo:
  var x = 2 + 3
  if false:
    x = x + 5
  proc c() =
    echo x
    discard

...turns into...

import
  macros

macro foo(n: typed) =
  copyNimTree(n)

foo:
  proc c() =
    discard

License

MIT