/// <summary> /// Checks whether the static arguments and number of dynamic arguments are valid for the CIL extension. /// /// <para>Returning false means that the CIL extension cannot provide a CIL implementation for the set of arguments at hand. In that case the CIL compiler will fall back to <see /// cref = "ICilCompilerAware" /> and finally the built-in mechanisms.</para> /// <para>Returning true means that the CIL extension can provide a CIL implementation for the set of arguments at hand. In that case the CIL compiler may subsequently call <see /// cref = "ICilExtension.Implement" /> with the same set of arguments.</para> /// </summary> /// <param name = "staticArgv">The suffix of compile-time constant arguments, starting after the last dynamic (not compile-time constant) argument. An empty array means that there were no compile-time constant arguments at the end.</param> /// <param name = "dynamicArgc">The number of dynamic arguments preceding the supplied static arguments. The total number of arguments is determined by <code>(staticArgv.Length + dynamicArgc)</code></param> /// <returns>true if the extension can provide a CIL implementation for the set of arguments; false otherwise</returns> public bool ValidateArguments(CompileTimeValue[] staticArgv, int dynamicArgc) { return dynamicArgc <= 0 && staticArgv.All(ctv => !ctv.IsReference); }
bool ICilExtension.ValidateArguments(CompileTimeValue[] staticArgv, int dynamicArgc) { return dynamicArgc == 0 && staticArgv.All( arg => arg.Interpretation == CompileTimeInterpretation.LocalVariableReference); }