• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2   Use of this source code is governed by a BSD-style license that can be
3  found in the LICENSE file. */
4
5/* Test Interface productions
6
7Run with --test to generate an AST and verify that all comments accurately
8reflect the state of the Nodes.
9
10BUILD Type(Name)
11This comment signals that a node of type <Type> is created with the
12name <Name>.
13
14ERROR Error String
15This comment signals that a error of <Error String> is generated.  The error
16is not assigned to a node, but are expected in order.
17
18PROP Key=Value
19This comment signals that a property has been set on the Node such that
20<Key> = <Value>.
21
22TREE
23Type(Name)
24  Type(Name)
25  Type(Name)
26    Type(Name)
27    ...
28This comment signals that a tree of nodes matching the BUILD comment
29symatics should exist.  This is an exact match.
30*/
31
32
33/* TREE
34 *Interface(MyIFace)
35 */
36interface MyIFace { };
37
38/* TREE
39 *Interface(MyIFaceInherit)
40 *  Inherit(Foo)
41 */
42interface MyIFaceInherit : Foo {};
43
44/* TREE
45 *Interface(MyIFacePartial)
46 */
47partial interface MyIFacePartial { };
48
49/* ERROR Unexpected ":" after identifier "MyIFaceInherit". */
50partial interface MyIFaceInherit : Foo {};
51
52/* TREE
53 *Interface(MyIFaceBig)
54 *  Const(setString)
55 *    PrimitiveType(DOMString)
56 *    Value(NULL)
57 */
58interface MyIFaceBig {
59  const DOMString? setString = null;
60};
61
62/* TREE
63 *Interface(MyIFaceBig2)
64 *  Const(nullValue)
65 *    PrimitiveType(DOMString)
66 *    Value(NULL)
67 *  Const(longValue)
68 *    PrimitiveType(long)
69 *    Value(123)
70 *  Const(longValue2)
71 *    PrimitiveType(long long)
72 *    Value(123)
73 *  Attribute(myString)
74 *    Type()
75 *      PrimitiveType(DOMString)
76 *  Attribute(readOnlyString)
77 *    Type()
78 *      PrimitiveType(DOMString)
79 *  Attribute(staticString)
80 *    Type()
81 *      PrimitiveType(DOMString)
82 *  Operation(myFunction)
83 *    Arguments()
84 *      Argument(myLong)
85 *        Type()
86 *          PrimitiveType(long long)
87 *    Type()
88 *      PrimitiveType(void)
89 *  Operation(staticFunction)
90 *    Arguments()
91 *      Argument(myLong)
92 *        Type()
93 *          PrimitiveType(long long)
94 *    Type()
95 *      PrimitiveType(void)
96 */
97interface MyIFaceBig2 {
98  const DOMString? nullValue = null;
99  const long longValue = 123;
100  const long long longValue2 = 123;
101  attribute DOMString myString;
102  readonly attribute DOMString readOnlyString;
103  static attribute DOMString staticString;
104  void myFunction(long long myLong);
105  static void staticFunction(long long myLong);
106};
107
108
109/* TREE
110 *Interface(MyIFaceSpecials)
111 *  Operation(set)
112 *    Arguments()
113 *      Argument(property)
114 *        Type()
115 *          PrimitiveType(DOMString)
116 *    Type()
117 *      PrimitiveType(void)
118 *  Operation(_unnamed_)
119 *    Arguments()
120 *      Argument(property)
121 *        Type()
122 *          PrimitiveType(DOMString)
123 *    Type()
124 *      PrimitiveType(double)
125 *  Operation(GetFiveSix)
126 *    Arguments()
127 *      Argument(arg)
128 *        Type()
129 *          Typeref(SomeType)
130 *    Type()
131 *      PrimitiveType(long long)
132 *      Array(5)
133 *        Array(6)
134 */
135interface MyIFaceSpecials {
136  setter creator void set(DOMString property);
137  getter double (DOMString property);
138  long long [5][6] GetFiveSix(SomeType arg);
139};
140