Browse Source

webidl: fixed attribute name required

mattias 3 years ago
parent
commit
3348b9f01b
2 changed files with 6 additions and 1 deletions
  1. 1 1
      packages/webidl/src/webidlparser.pp
  2. 5 0
      packages/webidl/tests/tcidlparser.pp

+ 1 - 1
packages/webidl/src/webidlparser.pp

@@ -785,7 +785,7 @@ begin
   ok:=false;
   try
     Result.AttributeType:=ParseType(Result,True,True);
-    CheckCurrentToken(tkIdentifier);
+    CheckCurrentTokens([tkIdentifier,tkRequired]);
     Result.Name:=CurrentTokenString;
     Result.Options:=Options;
     ok:=true;

+ 5 - 0
packages/webidl/tests/tcidlparser.pp

@@ -193,6 +193,7 @@ Type
     Procedure ParseSimpleReadonlyStaticAttribute;
     Procedure ParseSimpleReadonlyStringifierAttribute;
     Procedure ParseComplexReadonlyStaticAttribute;
+    Procedure ParseSimpleAttributeRequired;
     Procedure ParseIdentifierAttribute;
     Procedure Parse2IdentifierAttributes;
   end;
@@ -712,6 +713,10 @@ begin
   ParseAttribute('static readonly attribute unsigned long long A','A','unsigned long long',[aoStatic,aoReadOnly]);
 end;
 
+procedure TTestAttributeInterfaceParser.ParseSimpleAttributeRequired;
+begin
+  ParseAttribute('attribute boolean required','required','boolean',[]);
+end;
 
 procedure TTestAttributeInterfaceParser.ParseIdentifierAttribute;
 begin