mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Merge parameter extraction between methods and function pointers
This commit is contained in:
@@ -99,16 +99,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
yield return Tuples.cil_function_pointer_calling_conventions(this, signature.Header.CallingConvention);
|
||||
|
||||
var i = 0;
|
||||
foreach (var p in signature.ParameterTypes)
|
||||
foreach (var p in Method.GetParameterExtractionProducts(signature.ParameterTypes, this, this, Cx, 0))
|
||||
{
|
||||
var t = p;
|
||||
if (t is ModifiedType mtparam)
|
||||
{
|
||||
t = mtparam.Unmodified;
|
||||
yield return Tuples.cil_custom_modifiers(this, mtparam.Modifier, mtparam.IsRequired);
|
||||
}
|
||||
yield return Cx.Populate(new Parameter(Cx, this, i++, t));
|
||||
yield return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,15 +86,24 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
yield return Cx.Populate(new Parameter(Cx, this, i++, DeclaringType));
|
||||
}
|
||||
|
||||
foreach (var p in GetParameterExtractionProducts(parameterTypes, this, this, Cx, i))
|
||||
{
|
||||
yield return p;
|
||||
}
|
||||
}
|
||||
|
||||
internal static IEnumerable<IExtractionProduct> GetParameterExtractionProducts(IEnumerable<Type> parameterTypes, IParameterizable parameterizable, ICustomModifierReceiver receiver, Context cx, int firstChildIndex)
|
||||
{
|
||||
var i = firstChildIndex;
|
||||
foreach (var p in parameterTypes)
|
||||
{
|
||||
var t = p;
|
||||
if (t is ModifiedType mt)
|
||||
{
|
||||
t = mt.Unmodified;
|
||||
yield return Tuples.cil_custom_modifiers(this, mt.Modifier, mt.IsRequired);
|
||||
yield return Tuples.cil_custom_modifiers(receiver, mt.Modifier, mt.IsRequired);
|
||||
}
|
||||
yield return Cx.Populate(new Parameter(Cx, this, i++, t));
|
||||
yield return cx.Populate(new Parameter(cx, parameterizable, i++, t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user