| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
esid: sec-meta-properties-runtime-semantics-evaluation |
| 5 |
es6id: 12.3.8.1 |
| 6 |
description: NewTarget is composed of three distinct tokens |
| 7 |
---*/ |
| 8 |
|
| 9 |
var newTarget = null; |
| 10 |
|
| 11 |
var withSpaces = function() { |
| 12 |
newTarget = new . target; |
| 13 |
}; |
| 14 |
|
| 15 |
withSpaces(); |
| 16 |
assert.sameValue(newTarget, undefined, 'tokens seperated by whitespace'); |
| 17 |
|
| 18 |
new withSpaces(); |
| 19 |
assert.sameValue(newTarget, withSpaces, 'tokens separateed by whitespace'); |
| 20 |
|
| 21 |
newTarget = null; |
| 22 |
|
| 23 |
var withLineBreaks = function() { |
| 24 |
newTarget = new |
| 25 |
|
| 26 |
. |
| 27 |
|
| 28 |
target; |
| 29 |
}; |
| 30 |
|
| 31 |
withLineBreaks(); |
| 32 |
assert.sameValue(newTarget, undefined, 'tokens seperated by line breaks'); |
| 33 |
|
| 34 |
new withLineBreaks(); |
| 35 |
assert.sameValue(newTarget, withLineBreaks, 'tokens seperated by line breaks'); |
| 36 |
|
| 37 |
var withSLDC = function() { |
| 38 |
newTarget = new/* */./* */target; |
| 39 |
}; |
| 40 |
|
| 41 |
withSLDC(); |
| 42 |
assert.sameValue( |
| 43 |
newTarget, undefined, 'tokens separated by SingleLineDelimitedComments' |
| 44 |
); |
| 45 |
|
| 46 |
new withSLDC(); |
| 47 |
assert.sameValue( |
| 48 |
newTarget, withSLDC, 'tokens separated by SingleLineDelimitedComments' |
| 49 |
); |
| 50 |
|
| 51 |
|
| 52 |
var withMLC = function() { |
| 53 |
newTarget = new/* |
| 54 |
*/./* |
| 55 |
*/target; |
| 56 |
}; |
| 57 |
|
| 58 |
withMLC(); |
| 59 |
assert.sameValue( |
| 60 |
newTarget, undefined, 'tokens separated by MultiLineComments' |
| 61 |
); |
| 62 |
|
| 63 |
new withMLC(); |
| 64 |
assert.sameValue( |
| 65 |
newTarget, withMLC, 'tokens separated by MultiLineComments' |
| 66 |
); |