public override void VisitAccessorDeclaration(AccessorDeclarationSyntax node)
    {
        if (currentProperty != null)
        {
            var methodSymbol = importer.model.GetDeclaredSymbol(node);

            Net.PropertyAccessor aMethod = importer.EnsureMethod(methodSymbol) as Net.PropertyAccessor;
            if (methodSymbol.MethodKind == MethodKind.PropertyGet)
            {
                currentProperty.getter = aMethod as Net.PropertyAccessor;
            }
            else
            {
                currentProperty.setter = aMethod as Net.PropertyAccessor;
            }

            if (currentTypeStack.Count > 0)
            {
                aMethod.property   = currentProperty;
                aMethod.parentType = currentTypeStack.Peek() as FAMIX.Type;
                aMethod.parentType.AddMethod(aMethod);
            }

            currentMethod = aMethod;

            var returnType = importer.EnsureType(methodSymbol.ReturnType);
            currentMethod.declaredType = returnType;
            importer.CreateSourceAnchor(aMethod, node);
            currentMethod.isStub = false;
        }
        base.VisitAccessorDeclaration(node);
    }
 private Net.PropertyAccessor CreateAndRegisterAccessor(IMethodSymbol accessorSymbol)
 {
     if (accessorSymbol.MethodKind != MethodKind.PropertyGet && accessorSymbol.MethodKind != MethodKind.PropertySet)
     {
         throw new System.Exception("The given method symbol do not belongs to a property accessor!");
     }
     Net.PropertyAccessor Accessor = repository.New <Net.PropertyAccessor>(typeof(Net.PropertyAccessor).FullName);
     Accessor.isStub    = true;
     Accessor.name      = accessorSymbol.Name;
     Accessor.signature = helper.MethodSignature(accessorSymbol);
     this.RegisterMethod(Accessor, helper.FullMethodName(accessorSymbol));
     return(Accessor);
 }
Beispiel #3
0
 private Net.PropertyAccessor CreateNewAccessor(IMethodSymbol method, Net.Property Owner)
 {
     Net.PropertyAccessor NetAccessor = this.CreateNewEntity <Net.PropertyAccessor>(typeof(Net.PropertyAccessor).FullName);
     ConfigureMethodWith(NetAccessor, method);
     NetAccessor.property = Owner;
     if (method.MethodKind == MethodKind.PropertySet)
     {
         Owner.setter = NetAccessor;
     }
     else if (method.MethodKind == MethodKind.PropertyGet)
     {
         Owner.getter = NetAccessor;
     }
     else
     {
         throw new System.Exception("Unexpected non accessor method in accessor statement ");
     }
     return(NetAccessor);
 }