• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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
16exports.etsAnnotationsEnable = true;
17exports.emitIntermediateTS = true;
18
19exports.source = `
20const a = 1
21const b = 2
22
23@interface Anno {
24    d  = !a
25    e: number = a | b
26    f: number = a & b
27    g: number = a >> b
28    h: number = a >>> b
29    i: number = a << b
30    j: number = a ^ b
31    k: number = a * b
32    l: number = a / b
33    m: number = a + b
34    o: number = a - b
35    p: number = a % b
36    q: number = a ** b
37    r: number = a && b
38    s: number = (a - 1) || b
39    t = a < 2
40    u = a <= 1
41    v = a > 2
42    w = a >= 1
43    x = a === 1
44    y = a !== 1
45    z = a == 1
46}
47`
48
49exports.expectResult = `let __generate__Id: number = 0;
50function generateId(): string {
51    return "annotationDeclarationFieldInitializer1_" + ++__generate__Id;
52}
53const a = 1;
54const b = 2;
55@interface __$$ETS_ANNOTATION$$__Anno {
56    d: boolean = false;
57    e: number = 3;
58    f: number = 0;
59    g: number = 0;
60    h: number = 0;
61    i: number = 4;
62    j: number = 3;
63    k: number = 2;
64    l: number = 0.5;
65    m: number = 3;
66    o: number = -1;
67    p: number = 1;
68    q: number = 1;
69    r: number = 2;
70    s: number = 2;
71    t: boolean = true;
72    u: boolean = true;
73    v: boolean = false;
74    w: boolean = true;
75    x: boolean = true;
76    y: boolean = false;
77    z: boolean = true;
78}
79`