Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1344)

Unified Diff: tools/idl_parser/idl_parser.py

Issue 653343002: Support Promise<T> syntax in the IDL parser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/idl_parser/idl_parser.py
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py
index a19785bfb1b54792ab99cd2fdfad7d25aaabb726..a39d6bce9223354b5ccb3b8100d8444c8d60e383 100755
--- a/tools/idl_parser/idl_parser.py
+++ b/tools/idl_parser/idl_parser.py
@@ -729,6 +729,7 @@ class IDLParser(object):
# both cases.
def p_NonAnyType(self, p):
"""NonAnyType : PrimitiveType TypeSuffix
+ | PromiseType Null
| identifier TypeSuffix
| SEQUENCE '<' Type '>' Null"""
if len(p) == 3:
@@ -901,6 +902,20 @@ class IDLParser(object):
# [96] NOT IMPLEMENTED (ExtendedAttributeTypePair)
+ # [97]
Jens Widell 2014/10/15 07:22:17 Supposed to be [87]. Looks like a lot of these pro
noelallen1 2014/10/15 18:12:32 Agreed to both. If you change to a different vers
yhirano 2014/10/16 05:25:47 Done. I removed numbers from idl_ppapi_parser.py,
+ def p_PromiseType(self, p):
+ """PromiseType : PROMISE '<' ReturnType '>'
+ | PROMISE"""
+ if len(p) == 2:
+ # Promise without resolution type is not specified in the Web IDL spec.
+ # As it is used in some specs and in the blink implementation,
+ # we allow that here.
+ type = self.BuildAttribute('ResolutionType',
+ self.BuildProduction('Any', p, 1))
+ else:
+ type = self.BuildAttribute('ResolutionType', p[3])
+ p[0] = self.BuildNamed('Promise', p, 1, type)
+
#
# Parser Errors
#

Powered by Google App Engine
This is Rietveld 408576698