Documentation ¶
Index ¶
- func UniqueName(originalName string, ls ...interface{ Names() []string }) string
- type ConstructorParam
- type ConstructorParamList
- func (l ConstructorParamList) Adapt(others ...interface{ Names() []string }) ConstructorParamList
- func (l ConstructorParamList) Append(name string, field *types.Field) ConstructorParamList
- func (l ConstructorParamList) AppendAll(other ConstructorParamList) ConstructorParamList
- func (l ConstructorParamList) FindParamByField(field *types.Field) (ConstructorParam, bool)
- func (l ConstructorParamList) FunctionParamList() FunctionParamList
- func (l ConstructorParamList) IDs() []jen.Code
- func (l ConstructorParamList) IndexOf(param ConstructorParam) int
- func (l ConstructorParamList) IndexOfField(field *types.Field) int
- func (l ConstructorParamList) MirCode() []jen.Code
- func (l ConstructorParamList) Names() []string
- func (l ConstructorParamList) Remove(idx int) ConstructorParamList
- func (l ConstructorParamList) RemoveParam(param ConstructorParam) (res ConstructorParamList, found bool)
- func (l ConstructorParamList) Slice() []ConstructorParam
- func (l ConstructorParamList) Sublist(first, afterLast int) ConstructorParamList
- func (l ConstructorParamList) UncheckedAppend(originalName, uniqueName string, field *types.Field) ConstructorParamList
- func (l ConstructorParamList) UncheckedAppendAll(other ConstructorParamList) ConstructorParamList
- type FunctionParam
- type FunctionParamList
- func (l FunctionParamList) Adapt(others ...interface{ Names() []string }) FunctionParamList
- func (l FunctionParamList) Append(name string, tp types.Type) FunctionParamList
- func (l FunctionParamList) AppendAll(other FunctionParamList) FunctionParamList
- func (l FunctionParamList) IDs() []jen.Code
- func (l FunctionParamList) IndexOf(param FunctionParam) int
- func (l FunctionParamList) MirCode() []jen.Code
- func (l FunctionParamList) Names() []string
- func (l FunctionParamList) Remove(idx int) FunctionParamList
- func (l FunctionParamList) RemoveParam(param FunctionParam) (res FunctionParamList, found bool)
- func (l FunctionParamList) Slice() []FunctionParam
- func (l FunctionParamList) Sublist(first, afterLast int) FunctionParamList
- func (l FunctionParamList) UncheckedAppend(originalName, uniqueName string, tp types.Type) FunctionParamList
- func (l FunctionParamList) UncheckedAppendAll(other FunctionParamList) FunctionParamList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UniqueName ¶
UniqueName returns originalName modified in such a way that it is different from all the names in the provided parameter lists.
Types ¶
type ConstructorParam ¶
type ConstructorParam struct { FunctionParam // contains filtered or unexported fields }
ConstructorParam represents a parameter in a constructor of a message.
func (ConstructorParam) Field ¶
func (p ConstructorParam) Field() *types.Field
Field returns the field associated with the constructor parameter.
type ConstructorParamList ¶
type ConstructorParamList struct {
// contains filtered or unexported fields
}
ConstructorParamList represents a list of parameters of a constructor function of a message.
func (ConstructorParamList) Adapt ¶
func (l ConstructorParamList) Adapt(others ...interface{ Names() []string }) ConstructorParamList
Adapt returns a new list that has no name collisions with any of the parameter in any of the provided lists.
func (ConstructorParamList) Append ¶
func (l ConstructorParamList) Append(name string, field *types.Field) ConstructorParamList
Append adds a parameter to the list, making sure that all parameters have unique names.
func (ConstructorParamList) AppendAll ¶
func (l ConstructorParamList) AppendAll(other ConstructorParamList) ConstructorParamList
AppendAll adds all parameters to the list, making sure that all parameters have unique names.
func (ConstructorParamList) FindParamByField ¶
func (l ConstructorParamList) FindParamByField(field *types.Field) (ConstructorParam, bool)
FindParamByField returns the parameter corresponding to the given field.
func (ConstructorParamList) FunctionParamList ¶
func (l ConstructorParamList) FunctionParamList() FunctionParamList
FunctionParamList transforms ConstructorParamList to FunctionParamList.
func (ConstructorParamList) IDs ¶
func (l ConstructorParamList) IDs() []jen.Code
IDs returns the slice of the names of the parameters as jen.Code.
func (ConstructorParamList) IndexOf ¶
func (l ConstructorParamList) IndexOf(param ConstructorParam) int
IndexOf returns the index of the parameter with the given name. If the parameter is not in the list, it returns -1.
func (ConstructorParamList) IndexOfField ¶
func (l ConstructorParamList) IndexOfField(field *types.Field) int
IndexOfField returns the index of the parameter with the given field. If there is no such parameter in the list, it returns -1.
func (ConstructorParamList) MirCode ¶
func (l ConstructorParamList) MirCode() []jen.Code
MirCode returns the slice of function parameters as a jen.Code list to be used in a function declaration.
func (ConstructorParamList) Names ¶
func (l ConstructorParamList) Names() []string
Names returns the slice of the names of the parameters as string.
func (ConstructorParamList) Remove ¶
func (l ConstructorParamList) Remove(idx int) ConstructorParamList
Remove returns a new ConstructorParamList without the parameter with the given index. The names of the other parameters are not changed.
func (ConstructorParamList) RemoveParam ¶
func (l ConstructorParamList) RemoveParam(param ConstructorParam) (res ConstructorParamList, found bool)
RemoveParam returns a new ConstructorParamList with the given parameter removed. The names of the other parameters are not changed. If the parameter is not in the list, it returns the original list. The second return value is true if the parameter was in the list.
func (ConstructorParamList) Slice ¶
func (l ConstructorParamList) Slice() []ConstructorParam
Slice returns the underlying slice corresponding to the list.
func (ConstructorParamList) Sublist ¶
func (l ConstructorParamList) Sublist(first, afterLast int) ConstructorParamList
Sublist returns a ConstructorParamList corresponding to a slice of the original list.
func (ConstructorParamList) UncheckedAppend ¶
func (l ConstructorParamList) UncheckedAppend(originalName, uniqueName string, field *types.Field) ConstructorParamList
UncheckedAppend returns a new FunctionParamList with an item appended to it. uniqueName must be different from all the parameters already in the list.
func (ConstructorParamList) UncheckedAppendAll ¶
func (l ConstructorParamList) UncheckedAppendAll(other ConstructorParamList) ConstructorParamList
UncheckedAppendAll adds all parameters to the list. It is assumed that the names of the parameters being added are different from each other and all the parameters already in the list.
type FunctionParam ¶
type FunctionParam struct {
// contains filtered or unexported fields
}
FunctionParam represents a parameter of a function.
func (FunctionParam) MirCode ¶
func (p FunctionParam) MirCode() jen.Code
MirCode returns the code for the parameter that can be used in a function declaration using Mir-generated
func (FunctionParam) Name ¶
func (p FunctionParam) Name() string
Name returns the name of the function parameter after it has been made unique.
func (FunctionParam) OriginalName ¶
func (p FunctionParam) OriginalName() string
OriginalName return the original name of the function parameter.
func (FunctionParam) Type ¶
func (p FunctionParam) Type() types.Type
Type returns the type of the function parameter.
type FunctionParamList ¶
type FunctionParamList struct {
// contains filtered or unexported fields
}
FunctionParamList represents a list of parameters of a function.
func FunctionParamListOf ¶
func FunctionParamListOf(params ...FunctionParam) FunctionParamList
FunctionParamListOf returns a FunctionParamList containing the given parameters.
func (FunctionParamList) Adapt ¶
func (l FunctionParamList) Adapt(others ...interface{ Names() []string }) FunctionParamList
Adapt returns a new list that has no name collisions with any of the parameter in any of the provided lists.
func (FunctionParamList) Append ¶
func (l FunctionParamList) Append(name string, tp types.Type) FunctionParamList
Append returns a new FunctionParamList with an item appended to it. If a parameter with the same name is already in the list, it will change the name to make it unique.
func (FunctionParamList) AppendAll ¶
func (l FunctionParamList) AppendAll(other FunctionParamList) FunctionParamList
AppendAll adds all parameters to the list, making sure that all parameters have unique names.
func (FunctionParamList) IDs ¶
func (l FunctionParamList) IDs() []jen.Code
IDs returns the slice of the names of the parameters as jen.Code.
func (FunctionParamList) IndexOf ¶
func (l FunctionParamList) IndexOf(param FunctionParam) int
IndexOf returns the index of the parameter with the given name. If the parameter is not in the list, it returns -1.
func (FunctionParamList) MirCode ¶
func (l FunctionParamList) MirCode() []jen.Code
MirCode returns the slice of function parameters as a jen.Code list to be used in a function declaration.
func (FunctionParamList) Names ¶
func (l FunctionParamList) Names() []string
Names returns the slice of the names of the parameters as string.
func (FunctionParamList) Remove ¶
func (l FunctionParamList) Remove(idx int) FunctionParamList
Remove returns a new FunctionParamList without the parameter with the given index. The names of the other parameters are not changed.
func (FunctionParamList) RemoveParam ¶
func (l FunctionParamList) RemoveParam(param FunctionParam) (res FunctionParamList, found bool)
RemoveParam returns a new ConstructorParamList with the given parameter removed. The names of the other parameters are not changed. If the parameter is not in the list, it returns the original list. The second return value is true if the parameter was in the list.
func (FunctionParamList) Slice ¶
func (l FunctionParamList) Slice() []FunctionParam
Slice returns the underlying slice corresponding to the list.
func (FunctionParamList) Sublist ¶
func (l FunctionParamList) Sublist(first, afterLast int) FunctionParamList
Sublist returns a FunctionParamList corresponding to a slice of the original list.
func (FunctionParamList) UncheckedAppend ¶
func (l FunctionParamList) UncheckedAppend(originalName, uniqueName string, tp types.Type) FunctionParamList
UncheckedAppend returns a new FunctionParamList with an item appended to it. uniqueName must be different from all the parameters already in the list.
func (FunctionParamList) UncheckedAppendAll ¶
func (l FunctionParamList) UncheckedAppendAll(other FunctionParamList) FunctionParamList
UncheckedAppendAll adds all parameters to the list. It is assumed that the names of the parameters being added are different from each other and all the parameters already in the list.