• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16try {
17    let x = 77
18} catch(a: exception)
19}
20
21try
22    let x = 55
23} finally (x)
24}
25
26
27while {}
28
29while x > 0 {}
30
31let a = let x = 77.0;
32
33function f(x: number, ... args: number[]) {
34    "use strict"
35}
36
37function foo() {
38    private @annotate
39    let a: number = 10;
40}
41
42for (let i = 1 in [0, 1, 2]) {}
43
44/* @@? 19:1 Error SyntaxError: Unexpected token '}', expected '{'. */
45/* @@? 19:1 Error SyntaxError: Expected a '{', got '}'. */
46/* @@? 22:5 Error SyntaxError: Expected a '{', got 'let'. */
47/* @@? 23:11 Error SyntaxError: Expected a '{', got '('. */
48/* @@? 27:7 Error SyntaxError: Unexpected token '{', expected '(' */
49/* @@? 29:1 Error SyntaxError: Unexpected token 'while', expected ')'. */
50/* @@? 29:7 Error SyntaxError: Unexpected token 'identification literal', expected '(' */
51/* @@? 29:13 Error SyntaxError: Unexpected token '{', expected ')'. */
52/* @@? 31:9 Error SyntaxError: Unexpected token 'let'. */
53/* @@? 31:9 Error SyntaxError: Unexpected token 'let'. */
54/* @@? 34:5 Error SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list */
55/* @@? 38:5 Error SyntaxError: Annotation declaration can not have access modifier */
56/* @@? 38:5 Error SyntaxError: Unexpected token 'private'. */
57/* @@? 38:13 Error SyntaxError: Unexpected token '@'. */
58/* @@? 42:16 Error SyntaxError: for-in loop variable declaration may not have an initializer */
59/* @@? 42:16 Error SyntaxError: Unexpected token: 'in'. */
60