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(MyIFaceContainsUnresolvedConflictDiff)
79 * PrimitiveType(DOMString)
80 * Error(Unexpected "<" after ";".)
82 interface MyIFaceContainsUnresolvedConflictDiff
{
92 *Interface(MyIFaceBig)
94 * PrimitiveType(DOMString)
97 interface MyIFaceBig
{
98 const DOMString? setString
= null
;
102 *Interface(MyIfaceEmptySequenceDefalutValue)
109 * PrimitiveType(DOMString)
112 * PrimitiveType(void)
114 interface MyIfaceEmptySequenceDefalutValue
{
115 void foo
(optional sequence
<DOMString
> arg
= []);
119 *Interface(MyIFaceBig2)
121 * PrimitiveType(DOMString)
124 * PrimitiveType(long)
127 * PrimitiveType(long long)
129 * Attribute(myString)
131 * PrimitiveType(DOMString)
132 * Attribute(readOnlyString)
134 * PrimitiveType(DOMString)
135 * Attribute(staticString)
137 * PrimitiveType(DOMString)
138 * Operation(myFunction)
142 * PrimitiveType(long long)
144 * PrimitiveType(void)
145 * Operation(staticFunction)
149 * PrimitiveType(long long)
151 * PrimitiveType(void)
153 interface MyIFaceBig2
{
154 const DOMString? nullValue
= null
;
155 const long longValue
= 123;
156 const long long longValue2
= 123;
157 attribute DOMString myString
;
158 readonly attribute DOMString readOnlyString
;
159 static attribute DOMString staticString
;
160 void myFunction
(long long myLong
);
161 static
void staticFunction
(long long myLong
);
166 *Interface(MyIFaceSpecials)
171 * PrimitiveType(DOMString)
173 * PrimitiveType(void)
174 * Operation(_unnamed_)
178 * PrimitiveType(DOMString)
180 * PrimitiveType(double)
181 * Operation(GetFiveSix)
187 * PrimitiveType(long long)
191 interface MyIFaceSpecials
{
192 setter creator
void set
(DOMString property
);
193 getter
double (DOMString property
);
194 long long [5][6] GetFiveSix
(SomeType arg
);
198 *Interface(MyIFaceStringifiers)
201 * Operation(_unnamed_)
204 * PrimitiveType(DOMString)
206 * Operation(namedStringifier)
209 * PrimitiveType(DOMString)
211 * Attribute(stringValue)
213 * PrimitiveType(DOMString)
215 interface MyIFaceStringifiers
{
217 stringifier DOMString
();
218 stringifier DOMString namedStringifier
();
219 stringifier attribute DOMString stringValue
;
223 *Interface(MyExtendedAttributeInterface)
227 * PrimitiveType(void)
230 * ExtAttribute(MethodIdentList)
232 * ExtAttribute(MyExtendedAttribute)
233 * ExtAttribute(MyExtendedIdentListAttribute)
235 [MyExtendedAttribute
,
236 MyExtendedIdentListAttribute
=(Foo
, Bar
, Baz
)]
237 interface MyExtendedAttributeInterface
{
238 [Attr
, MethodIdentList
=(Foo
, Bar
)] void method
();
242 *Interface(MyIfacePromise)
248 * PrimitiveType(void)
254 * PrimitiveType(long)
268 interface MyIfacePromise
{
269 Promise
<void> method1
();
270 Promise
<long> method2
();
271 Promise
<any
> method3
();
276 *Interface(MyIfaceIterable)
279 * PrimitiveType(long)
282 * PrimitiveType(double)
284 * PrimitiveType(DOMString)
287 * PrimitiveType(boolean)
289 interface MyIfaceIterable
{
291 iterable
<double, DOMString
>;
292 legacyiterable
<boolean>;
296 *Interface(MyIfaceMaplike)
299 * PrimitiveType(long)
301 * PrimitiveType(DOMString)
304 * PrimitiveType(double)
306 * PrimitiveType(boolean)
308 interface MyIfaceMaplike
{
309 readonly maplike
<long, DOMString
>;
310 maplike
<double, boolean>;
314 *Interface(MyIfaceSetlike)
317 * PrimitiveType(long)
320 * PrimitiveType(double)
322 interface MyIfaceSetlike
{
323 readonly setlike
<long>;
328 *Interface(MyIfaceSerializer)
357 interface MyIfaceSerializer
{
359 serializer any toJSON
();
362 serializer
= { getter
};
363 serializer
= { attribute
};
364 serializer
= { inherit
, attribute
};
365 serializer
= { inherit
};
366 serializer
= { inherit
, name1
, name2
};
367 serializer
= { name1
, name2
};
369 serializer
= [getter
];
370 serializer
= [name1
, name2
];
374 *Interface(MyIfaceFrozenArray)
379 * PrimitiveType(DOMString)
381 interface MyIfaceFrozenArray
{
382 readonly attribute FrozenArray
<DOMString
> foo
;