v.compiler_tests.method_form #
host_receiver is what the declaration of a generic function gets before its name, fn (host_ Host) longest[T Named](...).
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.