Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lisp
lingo
Commits
4fd9dd5e
Commit
4fd9dd5e
authored
Jan 30, 2017
by
Juergen Nickelsen
Browse files
reordered Function struct to save on padding space
parent
1ab862e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
fun/type.go
View file @
4fd9dd5e
...
...
@@ -36,13 +36,13 @@ var ftypeS = [...]string{
}
type
Function
struct
{
ftype
funcType
builtin
Builtin
// for builtins only, obviously
name
string
// function/macro name
fi
*
FormInfo
// nil for a Builtin
minargs
int
maxargs
int
doc
string
name
string
// function/macro name
ftype
funcType
special
bool
// for macros (always special) and builtins
trace
bool
}
...
...
@@ -434,7 +434,7 @@ func makeForm(name string, arglAndBody lob.Object, ftype funcType) *Function {
formInfo
.
bodyForms
=
MacroExpandBody
(
bodyForms
)
formInfo
.
env
=
lob
.
Env
return
&
Function
{
ftype
,
nil
,
name
,
formInfo
,
minargs
,
maxargs
,
docString
,
nil
,
formInfo
,
minargs
,
maxargs
,
docString
,
name
,
ftype
,
ftype
==
MACRO
,
false
,
}
}
...
...
@@ -449,8 +449,8 @@ func Init_funtype() {
for
_
,
bd
:=
range
allBuiltins
{
builtinCounter
++
sym
:=
lob
.
Intern
(
bd
.
name
)
f
:=
&
Function
{
BUILTIN
,
bd
.
function
,
bd
.
name
,
nil
,
bd
.
minargs
,
bd
.
maxargs
,
strings
.
TrimSpace
(
bd
.
doc
),
f
:=
&
Function
{
bd
.
function
,
nil
,
bd
.
minargs
,
bd
.
maxargs
,
strings
.
TrimSpace
(
bd
.
doc
),
bd
.
name
,
BUILTIN
,
bd
.
isspecial
,
false
}
sym
.
SetFunction
(
f
)
sym
.
PutProp
(
lob
.
FuncDefinedIn
,
lob
.
NewString
(
bd
.
source
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment