Exemple #1
0
 public Instance(MethodBodyTransformation parent, AspectWeaverInstance aspectWeaverInstance)
     : base(parent, aspectWeaverInstance)
 {
 }
		/// <summary>
		///   Transforms the <paramref name="method" />.
		/// </summary>
		private static Ssm.Method Transform(MethodMetadata method)
		{
			var transformation = new MethodBodyTransformation(method.DeclaringObject);
			var methodBody = method.MethodBody;
			var locals = methodBody == null ? Enumerable.Empty<Ssm.Var>() : methodBody.LocalVariables.Select(Transform);
			var body = methodBody == null ? Ssm.Stm.NopStm : transformation.TransformMethodBody(methodBody.Body);

			Ssm.MethodKind kind;
			if (method is RequiredPortMetadata)
				kind = Ssm.MethodKind.ReqPort;
			else if (method is ProvidedPortMetadata || method is GuardMetadata || method is ActionMetadata)
				kind = Ssm.MethodKind.ProvPort;
			else if (method is FaultEffectMetadata) // TODO: Fault effects for non-provided ports
				kind = Ssm.MethodKind.ProvPort;
            else
				kind = Ssm.MethodKind.Step;

			return Ssm.CreateMethod(method.Name, method.MethodInfo.GetParameters().Select(Transform), body,
				Transform(method.MethodInfo.ReturnType), locals, kind);
		}
 public Instance(EnhanceSetterTransformationContext transformationContext, MethodBodyTransformation parent, AspectWeaverInstance aspectWeaverInstance)
     : base(parent, aspectWeaverInstance)
 {
     if (transformationContext == null) throw new ArgumentNullException("transformationContext");
     _transformationContext = transformationContext;
 }
 public TransformationInstance(PropertyDeclaration property, MethodBodyTransformation parent, AspectWeaverInstance aspectWeaverInstance)
     : base(parent, aspectWeaverInstance)
 {
     _transformation = (GuardPropertyEqualityTransformation)parent;
     Property = property;
 }
 public Instance(MethodBodyTransformation parent, AspectWeaverInstance aspectWeaverInstance)
     : base(parent, aspectWeaverInstance)
 {
 }