src/pylib/Lib/inspect_impl/sourcegetters

Search:
Group by:
Source   Edit  

Procs

func getdocNoDedentImpl(obj: NimNode): string {....raises: [], tags: [],
    forbids: [].}
Source   Edit  

Macros

macro getfile(obj: typed): string
in Python this may returns path for .pyc, but as Nim doesn't generate vm code, this always returns the actual source file. Thus the same as getsourcefile Source   Edit  
macro getline(obj: typed): int
Source   Edit  
macro getsource(obj: typed): string
Note: due to implement limit, the result string is not the extract the same as the origin source code, but those after some transformations, that's something that's allowed to be omitted is added. see below for examples

Example:

func f: int =
  ## doc
  1
static:
  assert getsource(f) == """
func f(): int =
  result =
    ## doc
    1
"""
Source   Edit  

Templates

template getsourcefile(obj: typed): string
see getfile Source   Edit  
template getsourcelinesImpl(obj: NimNode; splitlines): untyped

get source code of the object

the first element is the source code the second element is the line number of the first line of the source code

Source   Edit