Skip to content

Commit

Permalink
built in packages know their own names
Browse files Browse the repository at this point in the history
  • Loading branch information
glycerine committed Dec 27, 2018
1 parent 4fe3294 commit d12a0a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion repl/repl2.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,13 @@ func (env *MontyEnv) Init() {
}

// freeze them all, to avoid user overwriting them.
for _, pkg := range dict.Map {
for nm, pkg := range dict.Map {
pkg.Freeze()
// name the built in packages
sd, ok := pkg.(*starlark.StringDict)
if ok {
sd.PackageName = nm
}
}

// add the struct constructor.
Expand Down

0 comments on commit d12a0a1

Please sign in to comment.