mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration6.ts] ////
|
|
|
|
//// [destructuringParameterDeclaration6.ts]
|
|
// A parameter declaration may specify either an identifier or a binding pattern.
|
|
|
|
// Reserved words are not allowed to be used as an identifier in parameter declaration
|
|
"use strict"
|
|
|
|
// Error
|
|
function a({while}) { }
|
|
function a1({public}) { }
|
|
function a4([while, for, public]){ }
|
|
function a5(...while) { }
|
|
function a6(...public) { }
|
|
function a7(...a: string) { }
|
|
a({ while: 1 });
|
|
|
|
// No Error
|
|
function b1({public: x}) { }
|
|
function b2({while: y}) { }
|
|
b1({ public: 1 });
|
|
b2({ while: 1 });
|
|
|
|
|
|
|
|
//// [destructuringParameterDeclaration6.js]
|
|
// A parameter declaration may specify either an identifier or a binding pattern.
|
|
// Reserved words are not allowed to be used as an identifier in parameter declaration
|
|
"use strict";
|
|
// Error
|
|
function a({ while: }) { }
|
|
function a1({ public }) { }
|
|
function a4([]) { }
|
|
while (, )
|
|
for (, public; ; )
|
|
;
|
|
{ }
|
|
function a5(...) { }
|
|
while () { }
|
|
function a6(...public) { }
|
|
function a7(...a) { }
|
|
a({ while: 1 });
|
|
// No Error
|
|
function b1({ public: x }) { }
|
|
function b2({ while: y }) { }
|
|
b1({ public: 1 });
|
|
b2({ while: 1 });
|