Skip to content

Commit

Permalink
IDL parser: Add AST tests for Constructor and Exposed
Browse files Browse the repository at this point in the history
These extended attributes have uncommon structures and they need
to be handled independently.
This CL adds those tests to show how IDL parser creates AST for them.


Bug: 650150
Change-Id: I041c1c105cc877354ac1b2149d91a9888eafdcf5
Reviewed-on: https://chromium-review.googlesource.com/688256
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504903}
  • Loading branch information
peria authored and Commit Bot committed Sep 28, 2017
1 parent 70e38ec commit 1d9e6ea
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tools/idl_parser/test_parser/interface_web.idl
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,70 @@ interface MyIFaceArgumentWithAnnotatedType2 {
void voidMethodTestArgumentWithExtAttribute1([Clamp, XAttr] long long myLong);
void voidMethodTestArgumentWithExtAttribute2([EnforceRange] long longArg);
};

/** TREE
*Interface(InterfaceConstructors)
* ExtAttributes()
* ExtAttribute(Constructor)
* ExtAttribute(Constructor)
* Arguments()
* Argument(doubleArg)
* Type()
* PrimitiveType(double)
* ExtAttribute(CustomConstructor)
* ExtAttribute(CustomConstructor)
* Arguments()
* Argument(doubleArg)
* Type()
* PrimitiveType(double)
* ExtAttribute(NamedConstructor) = "Audio"
* ExtAttribute(NamedConstructor)
* Call(Audio)
* Arguments()
* Argument(src)
* Type()
* StringType(DOMString)
*/
[
Constructor,
Constructor(double doubleArg),
CustomConstructor,
CustomConstructor(double doubleArg),
NamedConstructor=Audio,
NamedConstructor=Audio(DOMString src)
] interface InterfaceConstructors { };

/** TREE
*Interface(InterfaceExposed)
* ExtAttributes()
* ExtAttribute(Exposed) = "Window"
* ExtAttribute(Exposed) = "['Window', 'Worker']"
* ExtAttribute(Exposed)
* Arguments()
* Argument(Feature1)
* Type()
* Typeref(Window)
* ExtAttribute(Exposed)
* Arguments()
* Argument(Feature1)
* Type()
* Typeref(Window)
* Argument(Feature2)
* Type()
* Typeref(Worker)
*/
[
Exposed=Window,
Exposed=(Window, Worker),
Exposed(Window Feature1),
Exposed(Window Feature1, Worker Feature2)
] interface InterfaceExposed { };

/** TREE
*Interface(InterfaceExposedError)
* ExtAttributes()
* ExtAttribute(Exposed)
* Arguments()
* Error(Unexpected ,.)
*/
[ Exposed(Window, Worker) ] interface InterfaceExposedError { };

0 comments on commit 1d9e6ea

Please sign in to comment.