Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignmentToString ¶
func AssignmentToString(f *model.Function, a model.Assignment) string
AssignmentToString returns the string representation of the assignment.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator represents a code generator.
func NewGenerator ¶
NewGenerator creates a new generator with the given code.
func (*Generator) FuncToString ¶
FuncToString generates the string representation of a given Function. The generated string can be used to represent the Function as Go code. The function generates a doc comment (if any), the function signature, the variable declarations (if any), the assignment statements, and the return statement. The function uses ManipulatorToString to generate the string representation of manipulators.
func (*Generator) Generate ¶
Generate generates the code into a file with the given path. It returns the generated code as a byte slice.
func (*Generator) ManipulatorToString ¶
ManipulatorToString returns a string representation of the given Manipulator. It generates a function call that performs the manipulation and returns the result as a string. Parameters: - m: the Manipulator to be converted into a string representation. - src: the source Var that corresponds to the Manipulator's first argument. - dst: the destination Var that corresponds to the Manipulator's second argument. Returns: - a string that represents the function call to the Manipulator.