Commit 4bee023e authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

IDL parser: Accept partial interface mixin

Before this CL, we took "partial interface mixin" a syntax error,
but Web IDL spec now accepts it to extend interface mixins.
This CL updates parser to accept it, and merges InterfaceMixin
class into Interface class.

Bug: 781257
Change-Id: I2b8584d5a1d4b8d2ffd53ba6a80c39e19feae11e
Reviewed-on: https://chromium-review.googlesource.com/1119744Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571808}
parent 25a6baa6
......@@ -307,14 +307,22 @@ class IDLParser(object):
p[0] = self.BuildError(p, 'Partial')
def p_PartialDefinition(self, p):
"""PartialDefinition : PartialDictionary
| PartialInterface
"""PartialDefinition : INTERFACE PartialInterfaceOrPartialMixin
| PartialDictionary
| Namespace"""
if len(p) > 2:
p[0] = p[2]
else:
p[0] = p[1]
def p_PartialInterfaceOrPartialMixin(self, p):
"""PartialInterfaceOrPartialMixin : PartialInterfaceRest
| MixinRest"""
p[0] = p[1]
def p_PartialInterface(self, p):
"""PartialInterface : INTERFACE identifier '{' InterfaceMembers '}' ';'"""
p[0] = self.BuildNamed('Interface', p, 2, p[4])
def p_PartialInterfaceRest(self, p):
"""PartialInterfaceRest : identifier '{' InterfaceMembers '}' ';'"""
p[0] = self.BuildNamed('Interface', p, 1, p[3])
def p_InterfaceMembers(self, p):
"""InterfaceMembers : ExtendedAttributeList InterfaceMember InterfaceMembers
......@@ -344,7 +352,8 @@ class IDLParser(object):
def p_MixinRest(self, p):
"""MixinRest : MIXIN identifier '{' MixinMembers '}' ';'"""
p[0] = self.BuildNamed('InterfaceMixin', p, 2, p[4])
p[0] = self.BuildNamed('Interface', p, 2, p[4])
p[0].AddChildren(self.BuildTrue('MIXIN'))
def p_MixinMembers(self, p):
"""MixinMembers : ExtendedAttributeList MixinMember MixinMembers
......
......@@ -43,18 +43,24 @@ partial interface MyIFacePartial { };
partial interface MyIFaceInherit : Foo {};
/** TREE
*InterfaceMixin(IFaceMixin)
*Interface(IFaceMixin)
* MIXIN: True
*/
interface mixin IFaceMixin {};
/** ERROR Unexpected ":" after identifier "IFaceMixinInherit". */
interface mixin IFaceMixinInherit : Foo {};
/** ERROR Unexpected keyword "mixin" after keyword "interface". */
/** TREE
*Interface(PartialIFaceMixin)
* PARTIAL: True
* MIXIN: True
*/
partial interface mixin PartialIFaceMixin {};
/** TREE
*InterfaceMixin(IFaceMixin)
*Interface(IFaceMixin)
* MIXIN: True
* Error(Unexpected keyword "static" after "{".)
*/
interface mixin IFaceMixin {
......@@ -62,7 +68,8 @@ interface mixin IFaceMixin {
};
/** TREE
*InterfaceMixin(IFaceMixin)
*Interface(IFaceMixin)
* MIXIN: True
* Const(pi)
* PrimitiveType(double)
* Value() = "3.14159"
......
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