v.compiler_tests.method_form #
The method form of a program of the tests of generic constraints: each of its generic functions becomes a method, with the same type parameters, of Host, a struct without type parameters, and each use of one goes through host, a constant Host. The type parameters of a method's own are to behave as those of a function, with their constraints too: a test checks both forms of its program, and the method form has to report what the program reports, where it reports it.
fn of #
fn of(source string) ?MethodForm
of returns the method form of source, or none when source declares no generic function.
struct Insert #
struct Insert {
pub:
col int
width int
}
Insert is text that the method form adds to a line of the program: width bytes before its column col, both counted from 1.
struct MethodForm #
struct MethodForm {
pub:
source string
inserts map[int][]Insert // by line, counted from 1
}
MethodForm is the method form of a program, and what it adds to each line.
fn (MethodForm) col #
fn (m MethodForm) col(line int, col int) int
col returns where the column col of the line line of the program is in its method form.
fn (MethodForm) differences #
fn (m MethodForm) differences(errors []string, method_errors []string) string
differences tells how the errors of the method form, method_errors, differ from those of the program, errors, or returns '' when the method form reports what the program reports, where the method form moves it. Both are lists of line:col: message, in any order. A message may name the function through Host; an error at the name of a use may be at host instead.