public MixinWeaveProcess(TypeDefinition target, AspectDefinition aspect, MixinEffect effect)
 {
     _target = target;
     _aspect = aspect;
     _effect = effect;
     _ts     = target.Module.GetTypeSystem();
 }
        public AdviceWeaveProcessBase(ILogger log, MethodDefinition target, TEffect effect, AspectDefinition aspect)
        {
            _log    = log;
            _target = target;
            _effect = effect;
            _aspect = aspect;

            _ts = target.Module.GetTypeSystem();
        }
示例#3
0
        public AdviceWeaveProcessBase(BaseModuleWeaver weaver, MethodDefinition target, TEffect effect, AspectDefinition aspect)
        {
            _weaver = weaver;
            _target = target;
            _effect = effect;
            _aspect = aspect;

            _ts = target.Module.GetTypeSystem();
        }
示例#4
0
        public AdviceWeaveProcessBase(ILogger log, MethodDefinition target, InjectionDefinition injection)
        {
            _log       = log;
            _target    = target;
            _effect    = (TEffect)injection.Effect;
            _injection = injection;
            _aspect    = injection.Source;

            _ts = target.Module.GetTypeSystem();
        }
示例#5
0
        public static ExtendedTypeSystem GetTypeSystem(this ModuleDefinition md)
        {
            lock (TypeSystems)
            {
                ExtendedTypeSystem result;

                if (!TypeSystems.TryGetValue(md, out result))
                {
                    result = new ExtendedTypeSystem(md);
                    TypeSystems.Add(md, result);
                }

                return(result);
            }
        }
        public MixinWeaveProcess(ILogger log, IMemberDefinition target, AspectDefinition aspect, MixinEffect effect)
        {
            switch (target)
            {
            case TypeDefinition td: _target = td; break;

            case MethodDefinition md: _target = md.DeclaringType; break;

            case PropertyDefinition pd: _target = pd.DeclaringType; break;

            case EventDefinition ed: _target = ed.DeclaringType; break;

            default: log.Log(GeneralRules.UnexpectedCompilerBehaviour, _target, $"Unexpected mixin target '{target.ToString()}'"); break;
            }

            _aspect = aspect;
            _effect = effect;
            _ts     = _target.Module.GetTypeSystem();
        }
示例#7
0
 public PointCut(ILProcessor proc, Instruction instruction)
 {
     _proc       = proc;
     _refInst    = instruction;
     _typeSystem = proc.Body.Method.Module.GetTypeSystem();
 }
示例#8
0
        public static GenericParameter Clone(this GenericParameter gparam, IGenericParameterProvider target, ExtendedTypeSystem ts)
        {
            var ngp = new GenericParameter(gparam.Name, target)
            {
                HasDefaultConstructorConstraint   = gparam.HasDefaultConstructorConstraint,
                HasReferenceTypeConstraint        = gparam.HasReferenceTypeConstraint,
                HasNotNullableValueTypeConstraint = gparam.HasNotNullableValueTypeConstraint,
                IsNonVariant    = gparam.IsNonVariant,
                IsContravariant = gparam.IsContravariant,
                IsCovariant     = gparam.IsCovariant,
                //Namespace = gparam.Namespace,
                IsValueType = gparam.IsValueType
            };

            foreach (var gc in gparam.Constraints)
            {
                ngp.Constraints.Add(ts.Import(gc));
            }

            foreach (var subgp in gparam.GenericParameters)
            {
                ngp.GenericParameters.Add(subgp.Clone(target, ts));
            }

            return(ngp);
        }
示例#9
0
 private ModuleContext(ModuleDefinition module)
 {
     ModuleDefinition = module;
     TypeSystem       = new ExtendedTypeSystem(module);
 }
示例#10
0
 internal MethodEditor(MethodDefinition md)
 {
     _md = md;
     _md.Body?.SimplifyMacros();
     _typeSystem = md.Module.GetTypeSystem();
 }