コード例 #1
0
    void ProcessAssembly(List <TypeDefinition> types)
    {
        var isDebug = IncludeDebugAssert && DefineConstants.Any(c => c == "DEBUG") && ReferenceFinder.DebugAssertMethod != null;

        var methodProcessor   = new MethodProcessor(ValidationFlags, isDebug);
        var propertyProcessor = new PropertyProcessor(ValidationFlags, isDebug);

        foreach (var type in types)
        {
            if (type.IsInterface || type.ContainsAllowNullAttribute() || type.IsGeneratedCode() || type.HasInterface("Windows.UI.Xaml.Markup.IXamlMetadataProvider"))
            {
                continue;
            }

            foreach (var method in type.MethodsWithBody())
            {
                methodProcessor.Process(method);
            }

            foreach (var property in type.ConcreteProperties())
            {
                propertyProcessor.Process(property);
            }
        }
    }
コード例 #2
0
ファイル: ModuleWeaver.cs プロジェクト: xuan2261/NullGuard
    void ProcessAssembly(List <TypeDefinition> types)
    {
        isDebug = IncludeDebugAssert &&
                  DefineConstants.Any(c => c == "DEBUG") &&
                  DebugAssertMethod != null;

        WriteInfo("Debug=" + isDebug);

        foreach (var type in types)
        {
            if (type.IsInterface ||
                type.ContainsAllowNullAttribute() ||
                type.IsGeneratedCode() ||
                type.HasInterface("Windows.UI.Xaml.Markup.IXamlMetadataProvider"))
            {
                continue;
            }

            foreach (var method in type.MethodsWithBody())
            {
                Process(method);
            }

            foreach (var property in type.ConcreteProperties())
            {
                Process(property);
            }
        }
    }
コード例 #3
0
        public void Execute()
        {
            IsDebugBuild = DefineConstants.Any(x => x.ToLower() == "debug");

            var references = new ReferenceContainer(ModuleDefinition, AssemblyResolver);

            WeaveMethods(references);
        }
コード例 #4
0
        public void Execute()
        {
            LogDebugOutput = DefineConstants.Any(x => x.ToLower() == "debug");
            MethodCacheEnabledByDefault   = true;
            PropertyCacheEnabledByDefault = true;

            ReadConfiguration();

            MethodsForWeaving methodToWeave = SelectMethods();

            WeaveMethods(methodToWeave.Methods);
            WeaveProperties(methodToWeave.Properties);

            RemoveReference();
        }
コード例 #5
0
        public void Execute()
        {
            LogDebugOutput = DefineConstants.Any(x => x.ToLower() == "debug");

            References = new References()
            {
                AssemblyResolver = AssemblyResolver, ModuleDefinition = ModuleDefinition
            };
            References.LoadReferences();

            MethodCacheEnabledByDefault   = true;
            PropertyCacheEnabledByDefault = true;

            ReadConfiguration();

            MethodsForWeaving methodToWeave = SelectMethods();

            WeaveMethods(methodToWeave.Methods);
            WeaveProperties(methodToWeave.Properties);

            RemoveReference();
        }