1
1
diff --git internal/compile/compile.go internal/compile/compile.go
2
- index b257d70..c171dc6 100644
2
+ index bc38200..fe7e58e 100644
3
3
--- internal/compile/compile.go
4
4
+++ internal/compile/compile.go
5
5
@@ -29,6 +29,7 @@ import (
@@ -18,31 +18,31 @@ index b257d70..c171dc6 100644
18
18
19
19
// -- transient state --
20
20
21
- @@ -364 ,7 +366 ,6 @@ type pcomp struct {
21
+ @@ -366 ,7 +368 ,6 @@ type pcomp struct {
22
22
23
23
names map[string]uint32
24
24
constants map[interface{}]uint32
25
25
- functions map[*Funcode]uint32
26
26
}
27
27
28
28
// An fcomp holds the compiler state for a Funcode.
29
- @@ -503 ,7 +504 ,6 @@ func File(opts *syntax.FileOptions, stmts []syntax.Stmt, pos syntax.Position, na
29
+ @@ -523 ,7 +524 ,6 @@ func File(opts *syntax.FileOptions, stmts []syntax.Stmt, pos syntax.Position, na
30
30
},
31
31
names: make(map[string]uint32),
32
32
constants: make(map[interface{}]uint32),
33
33
- functions: make(map[*Funcode]uint32),
34
34
}
35
35
pcomp.prog.Toplevel = pcomp.function(name, pos, stmts, locals, nil)
36
36
37
- @@ -521 ,6 +521 ,7 @@ func (pcomp *pcomp) function(name string, pos syntax.Position, stmts []syntax.St
37
+ @@ -541 ,6 +541 ,7 @@ func (pcomp *pcomp) function(name string, pos syntax.Position, stmts []syntax.St
38
38
Doc: docStringFromBody(stmts),
39
39
Locals: bindings(locals),
40
40
FreeVars: bindings(freevars),
41
41
+ Index: math.MaxUint32,
42
42
},
43
43
}
44
44
45
- @@ -980 ,13 +981 ,11 @@ func (pcomp *pcomp) constantIndex(v interface{}) uint32 {
45
+ @@ -1001 ,13 +1002 ,11 @@ func (pcomp *pcomp) constantIndex(v interface{}) uint32 {
46
46
// functionIndex returns the index of the specified function
47
47
// AST the nestedfun pool, adding it if necessary.
48
48
func (pcomp *pcomp) functionIndex(fn *Funcode) uint32 {
@@ -60,7 +60,7 @@ index b257d70..c171dc6 100644
60
60
61
61
// string emits code to push the specified string.
62
62
diff --git internal/compile/serial.go internal/compile/serial.go
63
- index 0dbae47..af003d7 100644
63
+ index 6131322..0b27769 100644
64
64
--- internal/compile/serial.go
65
65
+++ internal/compile/serial.go
66
66
@@ -267,10 +267,10 @@ func DecodeProgram(data []byte) (_ *Program, err error) {
@@ -85,15 +85,16 @@ index 0dbae47..af003d7 100644
85
85
id := d.binding()
86
86
doc := d.string()
87
87
code := d.bytes()
88
- @@ -395,5 +395,6 @@ func (d *decoder) function() *Funcode {
88
+ @@ -395,6 +395,7 @@ func (d *decoder) function() *Funcode {
89
89
NumKwonlyParams: numKwonlyParams,
90
90
HasVarargs: hasVarargs,
91
91
HasKwargs: hasKwargs,
92
92
+ Index: index,
93
93
}
94
- }
94
+ fn.finish()
95
+ return fn
95
96
diff --git starlark/eval.go starlark/eval.go
96
- index be3eb61..fe2b3bc 100644
97
+ index a4640e4..16b75bb 100644
97
98
--- starlark/eval.go
98
99
+++ starlark/eval.go
99
100
@@ -5,6 +5,7 @@
@@ -174,10 +175,10 @@ index be3eb61..fe2b3bc 100644
174
175
// and global environment. This is a variant of ExecFile specialized to
175
176
// the needs of a REPL, in which a sequence of input chunks, each
176
177
diff --git starlark/value.go starlark/value.go
177
- index 5e323ca..345b664 100644
178
+ index d89a9f5..62d679f 100644
178
179
--- starlark/value.go
179
180
+++ starlark/value.go
180
- @@ -696 ,6 +696 ,25 @@ type Function struct {
181
+ @@ -701 ,6 +701 ,25 @@ type Function struct {
181
182
freevars Tuple
182
183
}
183
184
0 commit comments