Example #1
0
 /// <summary>
 /// Run analysis of program loaded via given loader. Execution starts from entryMethod.
 /// </summary>
 /// <param name="loader">Loader which provides instruction generation and type/methods resolving.</param>
 /// <param name="entryMethod">Identifier entry method of analysis.</param>
 /// <param name="arguments">Arguments pasted to entry method.</param>
 /// <returns>Result of analysis.</returns>
 public AnalyzingResult Run(LoaderBase loader, MethodID entryMethod, params Instance[] arguments)
 {
     return(contextInvoker(loader, (context) =>
     {
         foreach (var argument in arguments)
         {
             if (argument != null)
             {
                 argument.IsEntryInstance = true;
                 _createdInstances.Add(argument.ID, argument);
             }
         }
         context.FetchCall(entryMethod, arguments);
     }));
 }
Example #2
0
 /// <summary>
 /// Emit call on given object with given arguments.
 /// <remarks>Notice that thisObject is only syntax sugar. It is passed as method argument 0.</remarks>
 /// </summary>
 /// <param name="method">The called method.</param>
 /// <param name="thisObjVariable">Variable with called object.</param>
 /// <param name="arguments">The arguments.</param>
 /// <returns>CallBuilder.</returns>
 public abstract CallBuilder Call(MethodID method, string thisObjVariable, Arguments arguments);
Example #3
0
 /// <summary>
 /// Emit static call on shared instance with given information.
 /// </summary>
 /// <param name="sharedInstanceInfo">The shared instance information.</param>
 /// <param name="method">The method.</param>
 /// <param name="arguments">The arguments.</param>
 /// <returns>CallBuilder.</returns>
 public abstract CallBuilder StaticCall(InstanceInfo sharedInstanceInfo, MethodID method, Arguments arguments);
Example #4
0
 /// <summary>
 /// Determine that given method has been used during interpretation.
 /// </summary>
 /// <param name="method">Tested method.</param>
 /// <returns><c>true</c> if method has been used, <c>false</c> otherwise.</returns>
 public bool Uses(MethodID method)
 {
     return(_methods.Contains(method));
 }
Example #5
0
 /// <summary>
 /// When overridden it can inject any generator for any method. Injected generator
 /// wont be binded with <see cref="MethodID"/> in methods cache.
 /// </summary>
 /// <param name="name">Name of resolved method</param>
 /// <param name="argumentValues">Arguments of resolved method</param>
 /// <returns><c>null</c> if there is no injected generator, injected generator otherwise</returns>
 public virtual GeneratorBase GetOverridingGenerator(MethodID name, Instance[] argumentValues)
 {
     //by default we don't have any overriding generator
     return(null);
 }
Example #6
0
 /// <summary>
 /// Resolve method with dynamic argument info
 /// </summary>
 /// <param name="method">Resolved method</param>
 /// <param name="dynamicArgumentInfo">Dynamic argument info, collected from argument instances</param>
 /// <returns>Resolved method which will be asked for generator by StaticResolve</returns>
 public abstract MethodID DynamicResolve(MethodID method, InstanceInfo[] dynamicArgumentInfo);
Example #7
0
 /// <summary>
 /// Resolve method with static argument info
 /// </summary>
 /// <param name="method">Resolved method</param>
 /// <returns>Resolved method name</returns>
 public abstract GeneratorBase StaticResolve(MethodID method);