public RoslynTranslator(IGeneratorConfiguration configuration, GeneratorType generatorType)
 {
     Configuration = configuration ??
                     throw new NullReferenceException("Configuration Cannot be null");
     Generator       = GeneratorProvider.Get(generatorType);
     CurrentFilePath = Configuration.InputPath;
     Builder         = new List <FileBuilder>();
 }
 public AssemblyTranslator(IGeneratorConfiguration configuration, GeneratorType generatorType)
 {
     Configuration = configuration ??
                     throw new ArgumentNullException(nameof(configuration));
     Generator = GeneratorProvider.Get(generatorType);
     Heads     = new List <CSharpNode>();
     Trees     = new List <ISyntaxTree>();
 }
Пример #3
0
        /// <summary>
        /// Get generator cached for given method. If it is not cached, provider is used and its result is cached
        /// </summary>
        /// <param name="method">Identifier of required method</param>
        /// <param name="provider">Provider that will be used in case of missing cached method generator</param>
        /// <returns>Generator for specified method</returns>
        internal GeneratorBase GetCachedGenerator(MethodID method, GeneratorProvider provider)
        {
            GeneratorBase cached;

            if (!_cachedMethods.TryGetValue(method, out cached))
            {
                //method is not cached yet - create it
                AssemblyProvider definingAssembly;
                cached = provider(method, out definingAssembly);
                if (cached != null)
                {
                    _methodIdIndex.Add(method);
                    _cachedMethods[method]  = cached;
                    _cachedDefiners[method] = definingAssembly;
                }
            }

            return(cached);
        }
Пример #4
0
 public Handler(CloudspoolContext db, GeneratorProvider generatorProvider)
 {
     _db = db;
     _generatorProvider = generatorProvider;
 }