Exemple #1
0
        /// <summary>
        /// Generates variations of the search text based on known namespaces.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private IEnumerable <string> AddScopedNamespaces(string text)
        {
            yield return(text);

            foreach (string ns in ImportedNamespaces.Select(ns => ns + "." + text))
            {
                yield return(ns);
            }
        }
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            foreach (Assembly asm in ReferencedAssemblies)
            {
                compiler.Parameters.AddAssembly(asm);
            }

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(StateMachineBuilder), "Prepare",
                                                                 ImportedNamespaces.ToArray()));
            pipeline.Insert(2, new UseSymbolsStep());
        }
Exemple #3
0
        public Type[] MatchTypes(string name, int gen)
        {
            if (gen > 0)
            {
                name += "`" + gen;
            }

            if (TypesUtil.PRIMITIVE_TYPES.ContainsKey(name))
            {
                return new[] { TypesUtil.PRIMITIVE_TYPES[name] }
            }
            ;
            var t1 = KnownTypes.Where(i => i.FullName == name).ToArray();

            if (t1.Length == 1)
            {
                return(t1);
            }
            if (t1.Length > 1)
            {
                throw new Exception("pink sparrow");
            }

            var fullNames = ImportedNamespaces.Select(i => i.Name + "." + name).Distinct().ToList();

            if (!string.IsNullOrEmpty(_currentNamespace))
            {
                fullNames.Add(_currentNamespace + "." + name);
            }
            var types = (from fullname in fullNames.Distinct()
                         join type in KnownTypes
                         on fullname equals type.FullName
                         select type).ToArray();

            return(types);
        }
 public void AddImport(string nameSpace)
 => ImportedNamespaces = ImportedNamespaces.Add(nameSpace);
 //TODO Also look in imports.
 public TypeInformation[] FindSymbol(string symbol)
 {
     return(ImportedNamespaces.FindSymbol(symbol));
 }
Exemple #6
0
 public bool IsNamespaceImported(INamedTypeSymbol typeSymbol)
 {
     return(ImportedNamespaces.Contains(typeSymbol.GetNamespace()) ||
            typeSymbol.ContainingNamespace.IsGlobalNamespace);
 }