mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-29 09:21:03 +02:00
Call top level function even if there are no TLAs (match cpp semantics) (#169)
* Call top level function even if there are no TLAs (match cpp semantics)
This commit is contained in:
parent
c7a5b68f1c
commit
7c8f4d0b12
@ -444,6 +444,9 @@ const (
|
||||
ObjectFieldExpr // '['expr1']':[:[:]] expr2
|
||||
ObjectFieldStr // expr1:[:[:]] expr2
|
||||
ObjectLocal // local id = expr2
|
||||
ObjectNullID // null id
|
||||
ObjectNullExpr // null '['expr1']'
|
||||
ObjectNullStr // null expr1
|
||||
)
|
||||
|
||||
type ObjectFieldHide int
|
||||
|
@ -942,7 +942,6 @@ func evaluateAux(i *interpreter, node ast.Node, tla vmExtMap) (value, *TraceElem
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if len(tla) != 0 {
|
||||
// If it's not a function, ignore TLA
|
||||
if f, ok := result.(*valueFunction); ok {
|
||||
toplevelArgMap := prepareExtVars(i, tla, "top-level-arg")
|
||||
@ -959,7 +958,6 @@ func evaluateAux(i *interpreter, node ast.Node, tla vmExtMap) (value, *TraceElem
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
manifestationLoc := ast.MakeLocationRangeMessage("During manifestation")
|
||||
manifestationTrace := &TraceElement{
|
||||
loc: &manifestationLoc,
|
||||
|
3
testdata/function_manifested.jsonnet
vendored
Normal file
3
testdata/function_manifested.jsonnet
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
f(x): 3,
|
||||
}
|
1
testdata/function_no_params.golden
vendored
Normal file
1
testdata/function_no_params.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
42
|
5
testdata/function_too_many_params.golden
vendored
Normal file
5
testdata/function_too_many_params.golden
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
RUNTIME ERROR: Missing argument: x
|
||||
-------------------------------------------------
|
||||
Top-level function
|
||||
|
||||
|
1
testdata/function_too_many_params.jsonnet
vendored
Normal file
1
testdata/function_too_many_params.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
function(x) 3
|
Loading…
x
Reference in New Issue
Block a user