asi.js (1438B)
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 features: [new.target] 8 ---*/ 9 10 var newTarget = null; 11 12 var withSpaces = function() { 13 newTarget = new . target; 14 }; 15 16 withSpaces(); 17 assert.sameValue(newTarget, undefined, 'tokens seperated by whitespace'); 18 19 new withSpaces(); 20 assert.sameValue(newTarget, withSpaces, 'tokens separateed by whitespace'); 21 22 newTarget = null; 23 24 var withLineBreaks = function() { 25 newTarget = new 26 27 . 28 29 target; 30 }; 31 32 withLineBreaks(); 33 assert.sameValue(newTarget, undefined, 'tokens seperated by line breaks'); 34 35 new withLineBreaks(); 36 assert.sameValue(newTarget, withLineBreaks, 'tokens seperated by line breaks'); 37 38 var withSLDC = function() { 39 newTarget = new/* */./* */target; 40 }; 41 42 withSLDC(); 43 assert.sameValue( 44 newTarget, undefined, 'tokens separated by SingleLineDelimitedComments' 45 ); 46 47 new withSLDC(); 48 assert.sameValue( 49 newTarget, withSLDC, 'tokens separated by SingleLineDelimitedComments' 50 ); 51 52 53 var withMLC = function() { 54 newTarget = new/* 55 */./* 56 */target; 57 }; 58 59 withMLC(); 60 assert.sameValue( 61 newTarget, undefined, 'tokens separated by MultiLineComments' 62 ); 63 64 new withMLC(); 65 assert.sameValue( 66 newTarget, withMLC, 'tokens separated by MultiLineComments' 67 ); 68 69 reportCompare(0, 0);