Exemplo n.º 1
0
 public void ProcessCode()
 {
     Context.RunPasses();
     Generator.Process();
 }
Exemplo n.º 2
0
 public List <GeneratorOutput> GenerateCode()
 {
     return(Generator.Generate());
 }
Exemplo n.º 3
0
        public void SetupPasses(ILibrary library)
        {
            var TranslationUnitPasses = Context.TranslationUnitPasses;

            TranslationUnitPasses.AddPass(new ResolveIncompleteDeclsPass());
            TranslationUnitPasses.AddPass(new IgnoreSystemDeclarationsPass());

            if (Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new EqualiseAccessOfOverrideAndBasePass());
            }

            TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());

            if (Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new TrimSpecializationsPass());
                TranslationUnitPasses.AddPass(new CheckAmbiguousFunctions());
                TranslationUnitPasses.AddPass(new GenerateSymbolsPass());
                TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
            }

            library.SetupPasses(this);

            TranslationUnitPasses.AddPass(new FindSymbolsPass());
            TranslationUnitPasses.AddPass(new CheckMacroPass());
            TranslationUnitPasses.AddPass(new CheckStaticClass());

            if (Options.IsCLIGenerator || Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new MoveFunctionToClassPass());
            }

            TranslationUnitPasses.AddPass(new CheckAmbiguousFunctions());
            TranslationUnitPasses.AddPass(new ConstructorToConversionOperatorPass());
            TranslationUnitPasses.AddPass(new MarshalPrimitivePointersAsRefTypePass());

            if (Options.IsCLIGenerator || Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new CheckOperatorsOverloadsPass());
            }

            TranslationUnitPasses.AddPass(new CheckVirtualOverrideReturnCovariance());
            TranslationUnitPasses.AddPass(new CleanCommentsPass());

            Generator.SetupPasses();

            TranslationUnitPasses.AddPass(new FlattenAnonymousTypesToFields());
            TranslationUnitPasses.AddPass(new CleanInvalidDeclNamesPass());
            TranslationUnitPasses.AddPass(new FieldToPropertyPass());
            TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
            TranslationUnitPasses.AddPass(new CheckFlagEnumsPass());
            TranslationUnitPasses.AddPass(new MakeProtectedNestedTypesPublicPass());

            if (Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new GenerateAbstractImplementationsPass());
                TranslationUnitPasses.AddPass(new MultipleInheritancePass());
            }

            if (Options.IsCLIGenerator || Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new DelegatesPass());
            }

            TranslationUnitPasses.AddPass(new GetterSetterToPropertyPass());
            TranslationUnitPasses.AddPass(new StripUnusedSystemTypesPass());

            if (Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.AddPass(new SpecializationMethodsWithDependentPointersPass());
                TranslationUnitPasses.AddPass(new ParamTypeToInterfacePass());
            }

            TranslationUnitPasses.AddPass(new CheckDuplicatedNamesPass());

            TranslationUnitPasses.AddPass(new MarkUsedClassInternalsPass());

            if (Options.IsCLIGenerator || Options.IsCSharpGenerator)
            {
                TranslationUnitPasses.RenameDeclsUpperCase(RenameTargets.Any & ~RenameTargets.Parameter);
                TranslationUnitPasses.AddPass(new CheckKeywordNamesPass());
            }
        }