/// <summary> /// Initializes a new <see cref="PascalScriptVisitorContext"/>, inheriting values from the supplied /// context <paramref name="inherited"/> when not explicitly supplied to the constructor /// </summary> /// <param name="inherited">A context that this context should mirror</param> /// <param name="installation">Instance of the class containing the code being visited</param> /// <param name="codeWriter">Reference to a <see cref="ICodeWriter"/> used to generate code</param> /// <param name="localVariables">A collection of local variables, keyed by the variable name</param> /// <param name="namespaces">A list of namespaces visible to the current node</param> /// <param name="methodSyntaxTreeFactory">Factory for returning a <see cref="SyntaxTree"/> from a <see cref="MethodInfo"/></param> /// <param name="aliasFactory">Factory for generating aliases for a method name</param> /// <param name="typeWriter">An <see cref="ICodeWriter"/> used for declaring types</param> /// <param name="declaredMembers">A list of members that have been scripted</param> /// <param name="methodDeclWriterFactory">Factory for creating <see cref="ICodeWriter"/> when scripting a method</param> /// <param name="baseInstallationType">The class type from which <paramref name="installation"/> is derived</param> /// <param name="definedMethods">A list of method names that have been scripted</param> public PascalScriptVisitorContext( PascalScriptVisitorContext inherited, ICodeWriter codeWriter = null, Installation installation = null, IDictionary <string, LoadedType> localVariables = null, HashSet <string> namespaces = null, Func <MethodInfo, SyntaxTree> methodSyntaxTreeFactory = null, Func <string, string> aliasFactory = null, ICodeWriter typeWriter = null, HashSet <MemberInfo> declaredMembers = null, Func <ICodeWriter> methodDeclWriterFactory = null, Type baseInstallationType = null, HashSet <string> definedMethods = null) : this( installation ?? inherited._installation, codeWriter ?? inherited._codeWriter, localVariables ?? inherited.LocalVariables, namespaces ?? inherited.Namespaces, methodSyntaxTreeFactory ?? inherited._methodSyntaxTreeFactory, inherited._referencedGlobalVariables, aliasFactory ?? inherited._aliasFactory, typeWriter ?? inherited.TypeWriter, declaredMembers ?? inherited._declaredMembers, methodDeclWriterFactory ?? inherited._methodDeclWriterFactory, baseInstallationType ?? inherited._baseInstallationType, definedMethods ?? inherited._definedMethods) { }
public static MethodInfo GetMethodToEval( InvocationExpression syntax, PascalScriptVisitorContext context, Func <Type, bool> declaringTypeFilter) { var target = syntax.Target.ToString(); var targetParts = target.Split("."); var methodName = targetParts[^ 1];
/// <summary> /// Initializes a new <see cref="InvocationExpressionEvaluator"/> /// </summary> /// <param name="context">The visitor context</param> /// <param name="visitedMethods">A list that is populated with visited methods</param> /// <param name="declaringTypeFilter">Predicate that determines whether a type's methods should be considered</param> public InvocationExpressionEvaluator( PascalScriptVisitorContext context, List <MethodInfo> visitedMethods, Func <Type, bool> declaringTypeFilter = null) { _context = context; _visitedMethods = visitedMethods; _declaringTypeFilter = declaringTypeFilter ?? (t => true); }
public EvaluationVisitor(PascalScriptVisitorContext context, List <MethodInfo> visitedMethods, Func <Type, bool> declaringTypeFilter = null) { _context = context; _declaringTypeFilter = declaringTypeFilter ?? InstallationOnlyMethods; _visitedMethods = visitedMethods; }
public ExceptionVisitor(PascalScriptVisitorContext context) : base(context) { }