summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/new.target/asi.js
blob: e0244833a9d880f6278c909f509c976dbf45b04f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-meta-properties-runtime-semantics-evaluation
es6id: 12.3.8.1
description: NewTarget is composed of three distinct tokens
features: [new.target]
---*/

var newTarget = null;

var withSpaces = function() {
  newTarget = new   .   target;
};

withSpaces();
assert.sameValue(newTarget, undefined, 'tokens seperated by whitespace');

new withSpaces();
assert.sameValue(newTarget, withSpaces, 'tokens separateed by whitespace');

newTarget = null;

var withLineBreaks = function() {
  newTarget = new

.

target;
};

withLineBreaks();
assert.sameValue(newTarget, undefined, 'tokens seperated by line breaks');

new withLineBreaks();
assert.sameValue(newTarget, withLineBreaks, 'tokens seperated by line breaks');

var withSLDC = function() {
  newTarget = new/* */./* */target;
};

withSLDC();
assert.sameValue(
  newTarget, undefined, 'tokens separated by SingleLineDelimitedComments'
);

new withSLDC();
assert.sameValue(
  newTarget, withSLDC, 'tokens separated by SingleLineDelimitedComments'
);


var withMLC = function() {
  newTarget = new/*
  */./*
  */target;
};

withMLC();
assert.sameValue(
  newTarget, undefined, 'tokens separated by MultiLineComments'
);

new withMLC();
assert.sameValue(
  newTarget, withMLC, 'tokens separated by MultiLineComments'
);

reportCompare(0, 0);