Browse Source

webidl: allow func arg name callback

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

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

@@ -361,7 +361,7 @@ begin
       Result.HasEllipsis:=True;
       GetToken;
       end;
-    CheckCurrentTokens([tkIdentifier,tkOther]);
+    CheckCurrentTokens([tkIdentifier,tkOther,tkCallback]);
     Result.Name:=CurrentTokenString;
     ok:=true;
   finally

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

@@ -232,6 +232,7 @@ Type
     Procedure TestAttrFunctionFunction;
     Procedure TestOptionalDefaultArgFunction;
     Procedure TestFunction_ClampArg;
+    Procedure TestFunction_ArgNameCallback;
   end;
 
   { TTestDictionaryParser }
@@ -507,6 +508,11 @@ begin
   AssertEquals('optional arg is Clamp',true,Arg.HasSimpleAttribute('Clamp'));
 end;
 
+procedure TTestOperationInterfaceParser.TestFunction_ArgNameCallback;
+begin
+  ParseFunction('void getAsString(FunctionStringCallback? callback)','getAsString','void',['FunctionStringCallback','callback']);
+end;
+
 { TTestSerializerInterfaceParser }
 
 function TTestSerializerInterfaceParser.ParseSerializer(ADef: UTF8String; Attrs: array of UTF8String): TIDLSerializerDefinition;