lang: Make scope error messages be more consistent
This commit is contained in:
@@ -9768,7 +9768,7 @@ func (obj *ExprCall) SetScope(scope *interfaces.Scope, sctx map[string]interface
|
|||||||
if obj.data.Debug || true { // TODO: leave this on permanently?
|
if obj.data.Debug || true { // TODO: leave this on permanently?
|
||||||
lambdaScopeFeedback(obj.scope, obj.data.Logf)
|
lambdaScopeFeedback(obj.scope, obj.data.Logf)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("func `%s` does not exist in this scope", prefixedName)
|
return fmt.Errorf("lambda `$%s` does not exist in this scope", prefixedName)
|
||||||
}
|
}
|
||||||
target = f
|
target = f
|
||||||
}
|
}
|
||||||
@@ -10462,7 +10462,7 @@ func (obj *ExprVar) SetScope(scope *interfaces.Scope, sctx map[string]interfaces
|
|||||||
if obj.data.Debug || true { // TODO: leave this on permanently?
|
if obj.data.Debug || true { // TODO: leave this on permanently?
|
||||||
variableScopeFeedback(obj.scope, obj.data.Logf)
|
variableScopeFeedback(obj.scope, obj.data.Logf)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("variable %s not in scope", obj.Name)
|
return fmt.Errorf("var `$%s` does not exist in this scope", obj.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.scope.Variables[obj.Name] = target
|
obj.scope.Variables[obj.Name] = target
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ if true {
|
|||||||
$b = true
|
$b = true
|
||||||
}
|
}
|
||||||
-- OUTPUT --
|
-- OUTPUT --
|
||||||
# err: errSetScope: variable b not in scope
|
# err: errSetScope: var `$b` does not exist in this scope
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ panic($i0.x != "goodbye")
|
|||||||
panic($i1.y != "hello")
|
panic($i1.y != "hello")
|
||||||
|
|
||||||
# the really tricky case
|
# the really tricky case
|
||||||
# XXX: works atm, but not supported for now: could not set scope: variable i0.y not in scope
|
# XXX: works atm, but not supported for now, error is:
|
||||||
|
# could not set scope: var `$i0.y` does not exist in this scope
|
||||||
# We currently re-export anything in the parent scope as available from our
|
# We currently re-export anything in the parent scope as available from our
|
||||||
# current child scope, which makes this variable visible. Unfortunately, it does
|
# current child scope, which makes this variable visible. Unfortunately, it does
|
||||||
# not have the correct dependency (edge) present in the Ordering system, so it
|
# not have the correct dependency (edge) present in the Ordering system, so it
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ $f = func($x) {
|
|||||||
$name = $f("foo")
|
$name = $f("foo")
|
||||||
test "${name}" {}
|
test "${name}" {}
|
||||||
-- OUTPUT --
|
-- OUTPUT --
|
||||||
# err: errSetScope: variable x not in scope
|
# err: errSetScope: var `$x` does not exist in this scope
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ test "${f1.z}" {}
|
|||||||
test "${f1.x1}" {}
|
test "${f1.x1}" {}
|
||||||
|
|
||||||
# the really tricky case
|
# the really tricky case
|
||||||
# XXX: works atm, but not supported for now: could not set scope: variable f1.x2 not in scope
|
# XXX: works atm, but not supported for now, error is:
|
||||||
|
# could not set scope: var `$f1.x2` does not exist in this scope
|
||||||
# We currently re-export anything in the parent scope as available from our
|
# We currently re-export anything in the parent scope as available from our
|
||||||
# current child scope, which makes this variable visible. Unfortunately, it does
|
# current child scope, which makes this variable visible. Unfortunately, it does
|
||||||
# not have the correct dependency (edge) present in the Ordering system, so it
|
# not have the correct dependency (edge) present in the Ordering system, so it
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ $x = "this is x.mcl"
|
|||||||
import "x.mcl" as f
|
import "x.mcl" as f
|
||||||
$y = $f.x + " and this is y.mcl"
|
$y = $f.x + " and this is y.mcl"
|
||||||
-- OUTPUT --
|
-- OUTPUT --
|
||||||
# err: errSetScope: variable g.x not in scope
|
# err: errSetScope: var `$g.x` does not exist in this scope
|
||||||
|
|||||||
Reference in New Issue
Block a user