• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2025 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/* @@? 18:9 Error TypeError: Argument must be an instance of 'Exception' or 'Error' */
45/* @@? 18:12 Error TypeError: Cannot find type 'exception'. */
46/* @@? 19:1 Error SyntaxError: Expected '{', got '}'. */
47/* @@? 22:5 Error SyntaxError: Expected '{', got 'let'. */
48/* @@? 23:11 Error SyntaxError: Expected '{', got '('. */
49/* @@? 23:11 Error TypeError: Unresolved reference x */
50/* @@? 27:7 Error SyntaxError: Expected '(', got '{'. */
51/* @@? 27:7 Error TypeError: need to specify target type for class composite */
52/* @@? 29:1 Error SyntaxError: Expected ')', got 'while'. */
53/* @@? 29:7 Error SyntaxError: Expected '(', got 'identification literal'. */
54/* @@? 29:7 Error TypeError: Bad operand type, the types of the operands must be numeric, same enumeration, or boolean type. */
55/* @@? 29:13 Error SyntaxError: Expected ')', got '{'. */
56/* @@? 31:9 Error SyntaxError: Unexpected token 'let'. */
57/* @@? 31:13 Error SyntaxError: Unexpected token 'x'. */
58/* @@? 34:5 Error SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list. */
59/* @@? 38:5 Error SyntaxError: Unexpected token 'private'. */
60/* @@? 38:5 Error SyntaxError: Annotation declaration can not have access modifier. */
61/* @@? 38:13 Error SyntaxError: Unexpected token '@'. */
62/* @@? 38:14 Error TypeError: Cannot find type 'annotate'. */
63/* @@? 42:16 Error SyntaxError: for-in loop variable declaration may not have an initializer. */
64/* @@? 42:16 Error SyntaxError: Unexpected token 'in'. */
65