diff --git a/src/ast/ast.h b/src/ast/ast.h index 810db59504..1ca192a462 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -1807,7 +1807,7 @@ class NaryOperation final : public Expression { NaryOperation(Zone* zone, Token::Value op, Expression* first, size_t initial_subsequent_size) - : Expression(kNoSourcePosition, kNaryOperation), + : Expression(first->position(), kNaryOperation), first_(first), subsequent_(zone) { bit_field_ |= OperatorField::encode(op); diff --git a/test/mjsunit/regress/regress-crbug-791256.js b/test/mjsunit/regress/regress-crbug-791256.js new file mode 100644 index 0000000000..bf9fc25977 --- /dev/null +++ b/test/mjsunit/regress/regress-crbug-791256.js @@ -0,0 +1,12 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original repro. A DCHECK used to fire. +(function* (name = (eval(foo), foo, prototype)) { }); + +// Simpler repro. +(function (name = (foo, bar, baz) ) { }); + +// A test which uses the value of the n-ary operation. +(function (param = (0, 1, 2)) { assertEquals(2, param); })();