public CompilationModule(UdonSharpProgramAsset sourceAsset)
        {
            programAsset           = sourceAsset;
            resolver               = new ResolverContext();
            moduleSymbols          = new SymbolTable(resolver, null);
            moduleLabels           = new LabelTable();
            fieldsWithInitializers = new HashSet <FieldDeclarationSyntax>();

            if (programAsset.sourceCsScript == null)
            {
                throw new System.ArgumentException($"Asset '{AssetDatabase.GetAssetPath(programAsset)}' does not have a valid program source to compile from");
            }

            settings = UdonSharpSettings.GetSettings();
        }
Esempio n. 2
0
        public static IEnumerable <string> GetAllFilteredSourcePaths(bool isEditorBuild)
        {
            if (_scriptPathCache.TryGetValue(isEditorBuild, out var cachedPaths))
            {
                return(cachedPaths);
            }

            HashSet <string> assemblySourcePaths = new HashSet <string>();

            foreach (UnityEditor.Compilation.Assembly asm in CompilationPipeline.GetAssemblies(isEditorBuild ? AssembliesType.Editor : AssembliesType.PlayerWithoutTestAssemblies))
            {
                if (asm.name == "Assembly-CSharp" || IsUdonSharpAssembly(asm.name))
                {
                    assemblySourcePaths.UnionWith(asm.sourceFiles);
                }
            }

            IEnumerable <string> paths = UdonSharpSettings.FilterBlacklistedPaths(assemblySourcePaths);

            _scriptPathCache.Add(isEditorBuild, paths);

            return(paths);
        }