Commit 36fcc8ac authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

IDL parser: Drop accepting extended attributes on enum values

For now, IDL parser allows to put extended attributes on enum values,
that is syntactically invalid in Web IDL spec [1].
In Blink, other IDL compiler parts ignore them, and no IDL files have them.

In order to avoid misleading developers, this CL makes IDL parser
to disallow extended attributes on enum values.

[1] https://heycam.github.io/webidl/#idl-enums


Bug: 871867
Change-Id: Ic57406ce3ff94a0c1a4cf38da12b217c05667eb0
Reviewed-on: https://chromium-review.googlesource.com/1169482Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582009}
parent 815783d1
...@@ -464,9 +464,9 @@ class IDLParser(object): ...@@ -464,9 +464,9 @@ class IDLParser(object):
p[0] = self.BuildError(p, 'Enum') p[0] = self.BuildError(p, 'Enum')
def p_EnumValueList(self, p): def p_EnumValueList(self, p):
"""EnumValueList : ExtendedAttributeList string EnumValueListComma""" """EnumValueList : string EnumValueListComma"""
enum = self.BuildNamed('EnumItem', p, 2, p[1]) enum = self.BuildNamed('EnumItem', p, 1)
p[0] = ListFromConcat(enum, p[3]) p[0] = ListFromConcat(enum, p[2])
def p_EnumValueListComma(self, p): def p_EnumValueListComma(self, p):
"""EnumValueListComma : ',' EnumValueListString """EnumValueListComma : ',' EnumValueListString
...@@ -475,11 +475,11 @@ class IDLParser(object): ...@@ -475,11 +475,11 @@ class IDLParser(object):
p[0] = p[2] p[0] = p[2]
def p_EnumValueListString(self, p): def p_EnumValueListString(self, p):
"""EnumValueListString : ExtendedAttributeList string EnumValueListComma """EnumValueListString : string EnumValueListComma
|""" |"""
if len(p) > 1: if len(p) > 1:
enum = self.BuildNamed('EnumItem', p, 2, p[1]) enum = self.BuildNamed('EnumItem', p, 1)
p[0] = ListFromConcat(enum, p[3]) p[0] = ListFromConcat(enum, p[2])
def p_CallbackRest(self, p): def p_CallbackRest(self, p):
"""CallbackRest : identifier '=' ReturnType '(' ArgumentList ')' ';'""" """CallbackRest : identifier '=' ReturnType '(' ArgumentList ')' ';'"""
......
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