コード例 #1
0
ファイル: ConstantFolder.cs プロジェクト: Hsiett/galaxy-pp
        public static bool Fold(GalaxyCompiler compiler)
        {
            bool changes = false;

            for (int i = 0; i < compiler.ParsedSourceFiles.Count; i++)
            {
                SourceFileContents file = compiler.ParsedSourceFiles[i];
                foreach (VariableDescription field in file.Fields)
                {
                    if (field.Const)
                    {
                        PExp   init = field.init;
                        string typeStr;
                        if (init == null)
                        {
                            typeStr = null;
                        }
                        else
                        {
                            ConstantFolder folder = new ConstantFolder();
                            field.init.Apply(folder);
                            typeStr = folder.Value;
                        }
                        if (field.initStr != typeStr)
                        {
                            changes       = true;
                            field.initStr = typeStr;
                        }
                    }
                }
            }
            return(changes);
        }
コード例 #2
0
 private void compiler_SourceFileContentsChanged(SourceFileContents file)
 {
 }
コード例 #3
0
 void AddSourceFiles(List<Library.Item> items, List<string> sources, List<SourceFileContents> contentList)
 {
     foreach (Library.Item item in items)
     {
         if (item is Library.File)
         {
             sources.Add(((Library.File)item).Text);
             SourceFileContents c = new SourceFileContents();
             ParsedSourceFiles.Add(c);
             contentList.Add(c);
         }
         else
             AddSourceFiles(((Library.Folder)item).Items, sources, contentList);
     }
 }
コード例 #4
0
        public void AddDialogFile(DialogItem item, MyEditor text = null)
        {
            ProjectProperties.CurrentProjectPropperties.CompileStatus = ProjectProperties.ECompileStatus.Changed;
            //Check if it already exists
            foreach (SourceFileContents sourceFile in ParsedSourceFiles)
            {
                if (sourceFile.Item == item)
                    return;
            }
            SourceFileContents contents = new SourceFileContents();
            contents.Item = item;
            contents.GetSource = new ExtractDialogItemCode(item, false).Extract;
            ParsedSourceFiles.Add(contents);
            liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(contents, text));
            SourceFileContentsChanged(contents);

            contents = new SourceFileContents();
            contents.Item = item;
            contents.IsDialogDesigner = true;
            contents.GetSource = new ExtractDialogItemCode(item, true).Extract;
            ParsedSourceFiles.Add(contents);
            liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(contents, text));
            SourceFileContentsChanged(contents);
            SignalLiteCompiler();
        }
コード例 #5
0
 public void AddSourceFile(FileItem file, MyEditor text = null)
 {
     ProjectProperties.CurrentProjectPropperties.CompileStatus = ProjectProperties.ECompileStatus.Changed;
     //Check if it already exists
     foreach (SourceFileContents sourceFile in ParsedSourceFiles)
     {
         if (sourceFile.Item == file)
             return;
     }
     SourceFileContents contents = new SourceFileContents();
     contents.Item = file;
     contents.GetSource = new ExtractSourceFileCode(file).Extract;
     ParsedSourceFiles.Add(contents);
     liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(contents, text));
     SourceFileContentsChanged(contents);
     SignalLiteCompiler();
 }