Commit a6ed7764 authored by Lisa Suzuki's avatar Lisa Suzuki Committed by Commit Bot

idl_parser: Support annotated types in OptionalType (Iterable's value type)

This CL's intention is to adjust to the change of WebIDL's specification.

Before this CL, Iterable's value types cannot be annotated.

After this CL, however, Iterable's value types can be annotated types.

In order to check if ASTs are dumped correctly, I also added pattern match based tests.

Bug: 714866
Change-Id: I4e5cb09f36b6b7c04b7a0d3a32cff085691bcdc6
Reviewed-on: https://chromium-review.googlesource.com/662979Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501488}
parent cc477ff2
...@@ -732,7 +732,7 @@ class IDLParser(object): ...@@ -732,7 +732,7 @@ class IDLParser(object):
p[0] = self.BuildProduction('Iterable', p, 2, childlist) p[0] = self.BuildProduction('Iterable', p, 2, childlist)
def p_OptionalType(self, p): def p_OptionalType(self, p):
"""OptionalType : ',' Type """OptionalType : ',' TypeWithExtendedAttributes
|""" |"""
if len(p) > 1: if len(p) > 1:
p[0] = p[2] p[0] = p[2]
......
...@@ -324,6 +324,15 @@ interface MyIfacePromise { ...@@ -324,6 +324,15 @@ interface MyIfacePromise {
* ExtAttributes() * ExtAttributes()
* ExtAttribute(Clamp) * ExtAttribute(Clamp)
* ExtAttribute(XAttr) * ExtAttribute(XAttr)
* Iterable()
* Type()
* PrimitiveType(long)
* ExtAttributes()
* ExtAttribute(Clamp)
* Type()
* PrimitiveType(long long)
* ExtAttributes()
* ExtAttribute(EnforceRange)
*/ */
interface MyIfaceIterable { interface MyIfaceIterable {
iterable<long>; iterable<long>;
...@@ -331,6 +340,7 @@ interface MyIfaceIterable { ...@@ -331,6 +340,7 @@ interface MyIfaceIterable {
iterable<[Clamp] long>; iterable<[Clamp] long>;
iterable<[TreatNullAs=EmptyString] DOMString>; iterable<[TreatNullAs=EmptyString] DOMString>;
iterable<[Clamp, XAttr] long>; iterable<[Clamp, XAttr] long>;
iterable<[Clamp] long, [EnforceRange] long long>;
}; };
/** TREE /** TREE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment