Beispiel #1
0
        /// <summary>
        /// Builds an invocation expression using this expression as target.
        /// </summary>
        public InvocationExpression Invoke(object annotation, string methodName, IEnumerable <AstType> typeArguments, IEnumerable <Expression> arguments)
        {
            InvocationExpression   ie  = new InvocationExpression();
            MemberAccessExpression mre = new MemberAccessExpression();

            mre.Target     = this;
            mre.MemberName = Identifier.Create(TextTokenType.InstanceMethod, methodName);
            mre.TypeArguments.AddRange(typeArguments);
            ie.Target = mre;
            ie.Arguments.AddRange(arguments);
            return(ie);
        }
Beispiel #2
0
        public static AstType FromName(string fullName, TextTokenType tokenType)
        {
            if (string.IsNullOrEmpty(fullName))
            {
                throw new ArgumentNullException("fullName");
            }
            fullName = fullName.Trim();
            if (!fullName.Contains("."))
            {
                return(new SimpleType(tokenType, fullName));
            }
            string[] parts = fullName.Split('.');

            AstType type = new SimpleType(TextTokenType.NamespacePart, parts.First());

            for (int i = 1; i < parts.Length; i++)
            {
                var part = parts[i];
                var tt   = i + 1 == parts.Length ? tokenType : TextTokenType.NamespacePart;
                type = new QualifiedType(type, Identifier.Create(tt, part));
            }

            return(type);
        }
Beispiel #3
0
 /// <summary>
 /// Builds an member reference expression using this expression as target.
 /// </summary>
 public MemberAccessExpression Member(object annotation, string memberName)
 {
     return(new MemberAccessExpression {
         Target = this, MemberName = Identifier.Create(annotation, memberName)
     });
 }
Beispiel #4
0
 public InterfaceMemberSpecifier(AstType target, string member, IEnumerable <object> annotations)
 {
     Target = new TypeReferenceExpression(target);
     Member = Identifier.Create(annotations, member);
 }