Skip to content

Commit

Permalink
Remove remaining code about AllowLambda (google#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohkinozomu authored Oct 13, 2021
1 parent 87f3331 commit b0039bd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
6 changes: 4 additions & 2 deletions cmd/starlark/starlark.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ func init() {
flag.BoolVar(&compile.Disassemble, "disassemble", compile.Disassemble, "show disassembly during compilation of each function")

// non-standard dialect flags
flag.BoolVar(&resolve.AllowFloat, "float", resolve.AllowFloat, "obsolete; no effect")
flag.BoolVar(&resolve.AllowSet, "set", resolve.AllowSet, "allow set data type")
flag.BoolVar(&resolve.AllowLambda, "lambda", resolve.AllowLambda, "allow lambda expressions")
flag.BoolVar(&resolve.AllowRecursion, "recursion", resolve.AllowRecursion, "allow while statements and recursive functions")
flag.BoolVar(&resolve.AllowGlobalReassign, "globalreassign", resolve.AllowGlobalReassign, "allow reassignment of globals, and if/for/while statements at top level")

// flags that are now standard
flag.BoolVar(&resolve.AllowFloat, "float", resolve.AllowFloat, "obsolete; no effect")
flag.BoolVar(&resolve.AllowLambda, "lambda", resolve.AllowLambda, "obsolete; no effect")
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion doc/impl.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ environment.

Not all features of the Go implementation are "standard" (that is,
supported by Bazel's Java implementation), at least for now, so
non-standard features such as `lambda`, `float`, and `set`
non-standard features such as `set`
are flag-controlled. The resolver reports
any uses of dialect features that have not been enabled.

Expand Down
1 change: 0 additions & 1 deletion resolve/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func TestDefVarargsAndKwargsSet(t *testing.T) {
}

func TestLambdaVarargsAndKwargsSet(t *testing.T) {
resolve.AllowLambda = true
source := "f = lambda *args, **kwargs: 0\n"
file, err := syntax.Parse("foo.star", source, 0)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion starlark/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func TestExecFile(t *testing.T) {
}

setOptions(chunk.Source)
resolve.AllowLambda = true // used extensively

_, err := starlark.ExecFile(thread, filename, chunk.Source, predeclared)
switch err := err.(type) {
Expand Down
4 changes: 0 additions & 4 deletions syntax/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,6 @@ func (x *DictEntry) Span() (start, end Position) {
}

// A LambdaExpr represents an inline function abstraction.
//
// Although they may be added in future, lambda expressions are not
// currently part of the Starlark spec, so their use is controlled by the
// resolver.AllowLambda flag.
type LambdaExpr struct {
commentsRef
Lambda Position
Expand Down

0 comments on commit b0039bd

Please sign in to comment.