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. */
5 /* Test Interface productions
7 Run with --test to generate an AST and verify that all comments accurately
8 reflect the state of the Nodes.
11 This comment signals that a node of type <Type> is created with the
15 This comment signals that a error of <Error String> is generated. The error
16 is not assigned to a node, but are expected in order.
19 This comment signals that a property has been set on the Node such that
28 This comment signals that a tree of nodes matching the BUILD comment
29 symatics should exist. This is an exact match.
36 interface MyIFace
{ };
39 *Interface(MyIFaceInherit)
42 interface MyIFaceInherit
: Foo
{};
45 *Interface(MyIFacePartial)
47 partial
interface MyIFacePartial
{ };
49 /* ERROR Unexpected ":" after identifier "MyIFaceInherit". */
50 partial
interface MyIFaceInherit
: Foo
{};
53 *Interface(MyIFaceMissingArgument)
58 * PrimitiveType(DOMString)
59 * Error(Missing argument.)
63 interface MyIFaceMissingArgument
{
64 void foo
(DOMString arg
, );
68 *Error(Unexpected keyword "double" after keyword "readonly".)
70 interface MyIFaceMissingAttribute
{
75 *Interface(MyIFaceBig)
77 * PrimitiveType(DOMString)
80 interface MyIFaceBig
{
81 const DOMString? setString
= null
;
85 *Interface(MyIfaceEmptySequenceDefalutValue)
92 * PrimitiveType(DOMString)
97 interface MyIfaceEmptySequenceDefalutValue
{
98 void foo
(optional sequence
<DOMString
> arg
= []);
102 *Interface(MyIFaceBig2)
104 * PrimitiveType(DOMString)
107 * PrimitiveType(long)
110 * PrimitiveType(long long)
112 * Attribute(myString)
114 * PrimitiveType(DOMString)
115 * Attribute(readOnlyString)
117 * PrimitiveType(DOMString)
118 * Attribute(staticString)
120 * PrimitiveType(DOMString)
121 * Operation(myFunction)
125 * PrimitiveType(long long)
127 * PrimitiveType(void)
128 * Operation(staticFunction)
132 * PrimitiveType(long long)
134 * PrimitiveType(void)
136 interface MyIFaceBig2
{
137 const DOMString? nullValue
= null
;
138 const long longValue
= 123;
139 const long long longValue2
= 123;
140 attribute DOMString myString
;
141 readonly attribute DOMString readOnlyString
;
142 static attribute DOMString staticString
;
143 void myFunction
(long long myLong
);
144 static
void staticFunction
(long long myLong
);
149 *Interface(MyIFaceSpecials)
154 * PrimitiveType(DOMString)
156 * PrimitiveType(void)
157 * Operation(_unnamed_)
161 * PrimitiveType(DOMString)
163 * PrimitiveType(double)
164 * Operation(GetFiveSix)
170 * PrimitiveType(long long)
174 interface MyIFaceSpecials
{
175 setter creator
void set
(DOMString property
);
176 getter
double (DOMString property
);
177 long long [5][6] GetFiveSix
(SomeType arg
);
181 *Interface(MyIFaceStringifiers)
184 * Operation(_unnamed_)
187 * PrimitiveType(DOMString)
189 * Operation(namedStringifier)
192 * PrimitiveType(DOMString)
194 * Attribute(stringValue)
196 * PrimitiveType(DOMString)
198 interface MyIFaceStringifiers
{
200 stringifier DOMString
();
201 stringifier DOMString namedStringifier
();
202 stringifier attribute DOMString stringValue
;
206 *Interface(MyExtendedAttributeInterface)
210 * PrimitiveType(void)
213 * ExtAttribute(MethodIdentList)
215 * ExtAttribute(MyExtendedAttribute)
216 * ExtAttribute(MyExtendedIdentListAttribute)
218 [MyExtendedAttribute
,
219 MyExtendedIdentListAttribute
=(Foo
, Bar
, Baz
)]
220 interface MyExtendedAttributeInterface
{
221 [Attr
, MethodIdentList
=(Foo
, Bar
)] void method
();
225 *Interface(MyIfacePromise)
231 * PrimitiveType(void)
237 * PrimitiveType(long)
251 interface MyIfacePromise
{
252 Promise
<void> method1
();
253 Promise
<long> method2
();
254 Promise
<any
> method3
();
259 *Interface(MyIfaceIterable)
262 * PrimitiveType(long)
265 * PrimitiveType(double)
267 * PrimitiveType(DOMString)
270 * PrimitiveType(boolean)
272 interface MyIfaceIterable
{
274 iterable
<double, DOMString
>;
275 legacyiterable
<boolean>;
279 *Interface(MyIfaceMaplike)
282 * PrimitiveType(long)
284 * PrimitiveType(DOMString)
287 * PrimitiveType(double)
289 * PrimitiveType(boolean)
291 interface MyIfaceMaplike
{
292 readonly maplike
<long, DOMString
>;
293 maplike
<double, boolean>;
297 *Interface(MyIfaceSetlike)
300 * PrimitiveType(long)
303 * PrimitiveType(double)
305 interface MyIfaceSetlike
{
306 readonly setlike
<long>;