Permalink
Browse files

Fix parsing of annotated types in unions

see #18
  • Loading branch information...
1 parent c3042b4 commit 8500b9d1fcdbe81c7f02f655d408182781cae867 @dontcallmedom committed Mar 31, 2017
Showing with 23 additions and 2 deletions.
  1. +3 −1 src/parse.c
  2. +3 −0 test/valid/idl/annotated-types.widl
  3. +17 −1 test/valid/xml/annotated-types.widlprocxml
View
@@ -524,10 +524,12 @@ parseunionmembertype(struct tok *tok)
addnode(node, newattr("type", "array"));
addnode(node, typenode);
node = parsetypesuffix(tok, node);
- } else if (tok->type == '(') {
+ } else if (tok->type == '(') {
node = parseuniontype(tok);
} else {
+ struct node *eal = parseextendedattributelist(tok);
node = parsenonanytype(tok);
+ if (eal) addnode(node, eal);
}
return node;
}
@@ -3,3 +3,6 @@ interface AnnotatedTypes {
attribute [EnforceRange] long thereIsALimit;
boolean isMemberOfBreed([TreatNullAs=EmptyString] DOMString breedName);
};
+
+
+typedef ([Clamp] unsigned long or ConstrainLongRange) ConstrainLong;
@@ -5,7 +5,10 @@
attribute [Clamp] long notThatLong;
attribute [EnforceRange] long thereIsALimit;
boolean isMemberOfBreed([TreatNullAs=EmptyString] DOMString breedName);
-};</webidl>
+};
+
+
+typedef ([Clamp] unsigned long or <ref>ConstrainLongRange</ref>) ConstrainLong;</webidl>
<Interface name="AnnotatedTypes" id="::AnnotatedTypes">
<webidl>interface AnnotatedTypes {
attribute [Clamp] long notThatLong;
@@ -47,4 +50,17 @@
</ArgumentList>
</Operation>
</Interface>
+ <Typedef name="ConstrainLong" id="::ConstrainLong">
+ <webidl>typedef ([Clamp] unsigned long or <ref>ConstrainLongRange</ref>) ConstrainLong;</webidl>
+ <Type type="union">
+ <Type type="unsigned long">
+ <ExtendedAttributeList>
+ <ExtendedAttribute name="Clamp">
+ <webidl>Clamp</webidl>
+ </ExtendedAttribute>
+ </ExtendedAttributeList>
+ </Type>
+ <Type name="ConstrainLongRange"/>
+ </Type>
+ </Typedef>
</Definitions>

0 comments on commit 8500b9d

Please sign in to comment.