示例#1
0
        public static TypeMember Lift(Statement stmt)
        {
            var typeMemberStatement = stmt as TypeMemberStatement;

            if (null != typeMemberStatement)
            {
                return(TypeMember.Lift(typeMemberStatement));
            }

            var declaration = stmt as DeclarationStatement;

            if (null != declaration)
            {
                return(TypeMember.Lift(declaration));
            }

            var expressionStatement = stmt as ExpressionStatement;

            if (null != expressionStatement)
            {
                return(TypeMember.Lift(expressionStatement));
            }

            throw new NotImplementedException(stmt.ToCodeString());
        }
示例#2
0
        public static TypeMember Lift(ExpressionStatement stmt)
        {
            var e       = stmt.Expression;
            var closure = e as BlockExpression;

            if (closure != null)
            {
                return(TypeMember.Lift(closure));
            }

            throw new NotImplementedException(stmt.ToCodeString());
        }
示例#3
0
 private static void LiftBlockInto(TypeMemberCollection collection, Block block)
 {
     foreach (var stmt in block.Statements)
     {
         var childBlock = stmt as Block;
         if (childBlock != null)
         {
             LiftBlockInto(collection, childBlock);
         }
         else
         {
             collection.Add(TypeMember.Lift(stmt));
         }
     }
 }
示例#4
0
        public static TypeMember Lift(DeclarationStatement stmt)
        {
            var closure = stmt.Initializer as BlockExpression;

            if (closure != null && closure.ContainsAnnotation(BlockExpression.ClosureNameAnnotation))
            {
                return(TypeMember.Lift(closure));
            }

            return(new Field(stmt.LexicalInfo)
            {
                Name = stmt.Declaration.Name,
                Type = stmt.Declaration.Type,
                Initializer = stmt.Initializer
            });
        }