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()); }
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()); }
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)); } } }
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 }); }