Improved assignment error message
This commit is contained in:
parent
3340a5824f
commit
62057704f3
@ -61,7 +61,7 @@ func toASTNode(tokens token.List) (Node, error) {
|
|||||||
switch {
|
switch {
|
||||||
case IsVariableDefinition(expr):
|
case IsVariableDefinition(expr):
|
||||||
if len(expr.Children) < 2 {
|
if len(expr.Children) < 2 {
|
||||||
return nil, errors.New(errors.MissingAssignValue, nil, expr.LastChild().Token.End())
|
return nil, errors.New(errors.MissingAssignValue, nil, expr.Token.End())
|
||||||
}
|
}
|
||||||
|
|
||||||
name := expr.Children[0].Token
|
name := expr.Children[0].Token
|
||||||
@ -70,7 +70,7 @@ func toASTNode(tokens token.List) (Node, error) {
|
|||||||
|
|
||||||
case IsAssignment(expr):
|
case IsAssignment(expr):
|
||||||
if len(expr.Children) < 2 {
|
if len(expr.Children) < 2 {
|
||||||
return nil, errors.New(errors.MissingAssignValue, nil, expr.LastChild().Token.End())
|
return nil, errors.New(errors.MissingAssignValue, nil, expr.Token.End())
|
||||||
}
|
}
|
||||||
|
|
||||||
name := expr.Children[0].Token
|
name := expr.Children[0].Token
|
||||||
|
Loading…
Reference in New Issue
Block a user