1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

ast: ThisExpression.Idx1() should point to the end of this (#251)

This commit is contained in:
Wael Nasreddine
2017-06-02 02:04:14 -07:00
committed by Steven Hartland
parent 21ec96599b
commit bc4cd51799
2 changed files with 7 additions and 1 deletions

View File

@@ -1009,6 +1009,12 @@ func TestPosition(t *testing.T) {
is(err, nil)
node = program.Body[0].(*ast.ExpressionStatement).Expression.(*ast.FunctionLiteral)
is(node.(*ast.FunctionLiteral).Source, "function(){ return abc; }")
parser = _newParser("", "this.style", 1, nil)
program, err = parser.parse()
node = program.Body[0].(*ast.ExpressionStatement).Expression.(*ast.DotExpression).Left.(*ast.ThisExpression)
is(node.Idx0(), file.Idx(1))
is(node.Idx1(), file.Idx(5))
})
}