Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / idl_parser / test_parser / interface_web.idl
blob90b0e83e8433707692fc00457aed1dfe056d0f6b
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.
10 BUILD Type(Name)
11 This comment signals that a node of type <Type> is created with the
12 name <Name>.
14 ERROR Error String
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.
18 PROP Key=Value
19 This comment signals that a property has been set on the Node such that
20 <Key> = <Value>.
22 TREE
23 Type(Name)
24 Type(Name)
25 Type(Name)
26 Type(Name)
27 ...
28 This comment signals that a tree of nodes matching the BUILD comment
29 symatics should exist. This is an exact match.
33 /* TREE
34 *Interface(MyIFace)
36 interface MyIFace { };
38 /* TREE
39 *Interface(MyIFaceInherit)
40 * Inherit(Foo)
42 interface MyIFaceInherit : Foo {};
44 /* TREE
45 *Interface(MyIFacePartial)
47 partial interface MyIFacePartial { };
49 /* ERROR Unexpected ":" after identifier "MyIFaceInherit". */
50 partial interface MyIFaceInherit : Foo {};
52 /* TREE
53 *Interface(MyIFaceMissingArgument)
54 * Operation(foo)
55 * Arguments()
56 * Argument(arg)
57 * Type()
58 * PrimitiveType(DOMString)
59 * Error(Missing argument.)
60 * Type()
61 * PrimitiveType(void)
63 interface MyIFaceMissingArgument {
64 void foo(DOMString arg, );
67 /* TREE
68 *Error(Unexpected keyword "double" after keyword "readonly".)
70 interface MyIFaceMissingAttribute {
71 readonly double foo;
74 /* TREE
75 *Interface(MyIFaceContainsUnresolvedConflictDiff)
76 * Operation(foo)
77 * Arguments()
78 * Type()
79 * PrimitiveType(DOMString)
80 * Error(Unexpected "<" after ";".)
82 interface MyIFaceContainsUnresolvedConflictDiff {
83 DOMString foo();
84 <<<<<< ours
85 DOMString bar();
86 iterable<long>;
87 ======
88 >>>>>> theirs
91 /* TREE
92 *Interface(MyIFaceBig)
93 * Const(setString)
94 * PrimitiveType(DOMString)
95 * Value(NULL)
97 interface MyIFaceBig {
98 const DOMString? setString = null;
101 /* TREE
102 *Interface(MyIfaceEmptySequenceDefalutValue)
103 * Operation(foo)
104 * Arguments()
105 * Argument(arg)
106 * Type()
107 * Sequence()
108 * Type()
109 * PrimitiveType(DOMString)
110 * Default()
111 * Type()
112 * PrimitiveType(void)
114 interface MyIfaceEmptySequenceDefalutValue {
115 void foo(optional sequence<DOMString> arg = []);
118 /* TREE
119 *Interface(MyIFaceBig2)
120 * Const(nullValue)
121 * PrimitiveType(DOMString)
122 * Value(NULL)
123 * Const(longValue)
124 * PrimitiveType(long)
125 * Value(123)
126 * Const(longValue2)
127 * PrimitiveType(long long)
128 * Value(123)
129 * Attribute(myString)
130 * Type()
131 * PrimitiveType(DOMString)
132 * Attribute(readOnlyString)
133 * Type()
134 * PrimitiveType(DOMString)
135 * Attribute(staticString)
136 * Type()
137 * PrimitiveType(DOMString)
138 * Operation(myFunction)
139 * Arguments()
140 * Argument(myLong)
141 * Type()
142 * PrimitiveType(long long)
143 * Type()
144 * PrimitiveType(void)
145 * Operation(staticFunction)
146 * Arguments()
147 * Argument(myLong)
148 * Type()
149 * PrimitiveType(long long)
150 * Type()
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);
165 /* TREE
166 *Interface(MyIFaceSpecials)
167 * Operation(set)
168 * Arguments()
169 * Argument(property)
170 * Type()
171 * PrimitiveType(DOMString)
172 * Type()
173 * PrimitiveType(void)
174 * Operation(_unnamed_)
175 * Arguments()
176 * Argument(property)
177 * Type()
178 * PrimitiveType(DOMString)
179 * Type()
180 * PrimitiveType(double)
181 * Operation(GetFiveSix)
182 * Arguments()
183 * Argument(arg)
184 * Type()
185 * Typeref(SomeType)
186 * Type()
187 * PrimitiveType(long long)
188 * Array(5)
189 * Array(6)
191 interface MyIFaceSpecials {
192 setter creator void set(DOMString property);
193 getter double (DOMString property);
194 long long [5][6] GetFiveSix(SomeType arg);
197 /* TREE
198 *Interface(MyIFaceStringifiers)
199 * Stringifier()
200 * Stringifier()
201 * Operation(_unnamed_)
202 * Arguments()
203 * Type()
204 * PrimitiveType(DOMString)
205 * Stringifier()
206 * Operation(namedStringifier)
207 * Arguments()
208 * Type()
209 * PrimitiveType(DOMString)
210 * Stringifier()
211 * Attribute(stringValue)
212 * Type()
213 * PrimitiveType(DOMString)
215 interface MyIFaceStringifiers {
216 stringifier;
217 stringifier DOMString ();
218 stringifier DOMString namedStringifier();
219 stringifier attribute DOMString stringValue;
222 /* TREE
223 *Interface(MyExtendedAttributeInterface)
224 * Operation(method)
225 * Arguments()
226 * Type()
227 * PrimitiveType(void)
228 * ExtAttributes()
229 * ExtAttribute(Attr)
230 * ExtAttribute(MethodIdentList)
231 * ExtAttributes()
232 * ExtAttribute(MyExtendedAttribute)
233 * ExtAttribute(MyExtendedIdentListAttribute)
235 [MyExtendedAttribute,
236 MyExtendedIdentListAttribute=(Foo, Bar, Baz)]
237 interface MyExtendedAttributeInterface {
238 [Attr, MethodIdentList=(Foo, Bar)] void method();
241 /* TREE
242 *Interface(MyIfacePromise)
243 * Operation(method1)
244 * Arguments()
245 * Type()
246 * Promise(Promise)
247 * Type()
248 * PrimitiveType(void)
249 * Operation(method2)
250 * Arguments()
251 * Type()
252 * Promise(Promise)
253 * Type()
254 * PrimitiveType(long)
255 * Operation(method3)
256 * Arguments()
257 * Type()
258 * Promise(Promise)
259 * Type()
260 * Any()
261 * Operation(method4)
262 * Arguments()
263 * Type()
264 * Promise(Promise)
265 * Type()
266 * Any()
268 interface MyIfacePromise {
269 Promise<void> method1();
270 Promise<long> method2();
271 Promise<any> method3();
272 Promise method4();
275 /* TREE
276 *Interface(MyIfaceIterable)
277 * Iterable()
278 * Type()
279 * PrimitiveType(long)
280 * Iterable()
281 * Type()
282 * PrimitiveType(double)
283 * Type()
284 * PrimitiveType(DOMString)
285 * LegacyIterable()
286 * Type()
287 * PrimitiveType(boolean)
289 interface MyIfaceIterable {
290 iterable<long>;
291 iterable<double, DOMString>;
292 legacyiterable<boolean>;
295 /* TREE
296 *Interface(MyIfaceMaplike)
297 * Maplike()
298 * Type()
299 * PrimitiveType(long)
300 * Type()
301 * PrimitiveType(DOMString)
302 * Maplike()
303 * Type()
304 * PrimitiveType(double)
305 * Type()
306 * PrimitiveType(boolean)
308 interface MyIfaceMaplike {
309 readonly maplike<long, DOMString>;
310 maplike<double, boolean>;
313 /* TREE
314 *Interface(MyIfaceSetlike)
315 * Setlike()
316 * Type()
317 * PrimitiveType(long)
318 * Setlike()
319 * Type()
320 * PrimitiveType(double)
322 interface MyIfaceSetlike {
323 readonly setlike<long>;
324 setlike<double>;
327 /* TREE
328 *Interface(MyIfaceSerializer)
329 * Serializer()
330 * Serializer()
331 * Operation(toJSON)
332 * Arguments()
333 * Type()
334 * Any()
335 * Serializer()
336 * Serializer()
337 * Map()
338 * Serializer()
339 * Map()
340 * Serializer()
341 * Map()
342 * Serializer()
343 * Map()
344 * Serializer()
345 * Map()
346 * Serializer()
347 * Map()
348 * Serializer()
349 * Map()
350 * Serializer()
351 * List()
352 * Serializer()
353 * List()
354 * Serializer()
355 * List()
357 interface MyIfaceSerializer {
358 serializer;
359 serializer any toJSON();
360 serializer = name;
361 serializer = {};
362 serializer = { getter };
363 serializer = { attribute };
364 serializer = { inherit, attribute };
365 serializer = { inherit };
366 serializer = { inherit, name1, name2 };
367 serializer = { name1, name2 };
368 serializer = [];
369 serializer = [getter];
370 serializer = [name1, name2];