• 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
16export type function f(): void {
17}
18
19export type let x: number = 7
20
21label1:
22let x = 77
23
24class A {
25    let x: number = 5;
26}
27
28function f() {
29    struct A {
30        let x:number;
31    }
32    function s(): void {}
33}
34
35try
36    let x: number = 89
37} catch(a: Exception) {
38}
39
40try x: number;
41
42try
43    let x: number;
44catch
45finally {}
46
47class A {
48    let x: number = 5;
49}
50
51throw
52"abc"
53// there were more errors
54/* @@? 22:1 Error SyntaxError: Label must be followed by a loop statement. */
55/* @@? 22:5 Error TypeError: Variable 'x' has already been declared. */
56/* @@? 25:5 Error SyntaxError: Unexpected token 'let'. */
57/* @@? 28:1 Error TypeError: Function f is already declared. */
58/* @@? 29:5 Error SyntaxError: Illegal start of STRUCT expression. */
59/* @@? 30:9 Error SyntaxError: Unexpected token 'let'. */
60/* @@? 32:5 Error SyntaxError: Nested functions are not allowed. */
61/* @@? 36:5 Error SyntaxError: Expected '{', got 'let'. */
62/* @@? 40:1 Error SyntaxError: A try statement should contain either finally clause or at least one catch clause. */
63/* @@? 40:5 Error SyntaxError: Expected '{', got 'identification literal'. */
64/* @@? 40:8 Error SyntaxError: Label must be followed by a loop statement. */
65/* @@? 42:1 Error SyntaxError: A try statement should contain either finally clause or at least one catch clause. */
66/* @@? 43:5 Error SyntaxError: Expected '{', got 'let'. */
67/* @@? 45:9 Error SyntaxError: Unexpected token '{'. */
68/* @@? 47:1 Error SyntaxError: Illegal start of CLASS expression. */
69/* @@? 48:5 Error SyntaxError: Unexpected token 'let'. */
70/* @@? 52:1 Error SyntaxError: Illegal newline after throw. */
71/* @@? 72:1 Error SyntaxError: Expected '}', got 'end of stream'. */
72