Permalink
Browse files

Fixing index generations

  • Loading branch information...
1 parent 3064d31 commit 5b3cb4096c746179bb381af98966b1d876f0e389 @ayende ayende committed Sep 19, 2011
@@ -1332,7 +1332,9 @@ protected override Expression VisitNewArray(NewArrayExpression node)
switch (node.NodeType)
{
case ExpressionType.NewArrayInit:
- Out("new [] ");
+ Out("new ");
+ Out(node.Type.GetElementType().FullName);
+ Out(" []");
VisitExpressions('{', node.Expressions, '}');
return node;
@@ -141,14 +141,15 @@ public static VariableDeclaration GetVariableDeclarationForLinqMethods(string qu
if (lambdaExpression == null)
throw new InvalidOperationException("Variable initializer select must have a lambda expression");
+ variable.AcceptVisitor(new TransformNullCoalasingOperatorTransformer(), null);
+
var objectCreateExpression = lambdaExpression.ExpressionBody as ObjectCreateExpression;
- if (objectCreateExpression == null)
+ if (objectCreateExpression == null && requiresSelectNewAnonymousType)
throw new InvalidOperationException("Variable initializer select must have a lambda expression with an object create expression");
- if (objectCreateExpression.IsAnonymousType == false && objectCreateExpression.CreateType.Type.Contains("Anonymous") == false && requiresSelectNewAnonymousType)
+ if (objectCreateExpression != null && objectCreateExpression.IsAnonymousType == false && objectCreateExpression.CreateType.Type.Contains("Anonymous") == false && requiresSelectNewAnonymousType)
throw new InvalidOperationException("Variable initializer select must have a lambda expression creating an anonymous type but returning " + objectCreateExpression.CreateType.Type);
- variable.AcceptVisitor(new TransformNullCoalasingOperatorTransformer(), null);
return variable;
}
@@ -31,17 +31,17 @@ public MyTestIndex1()
{
AddMap<MyEntity1>(docs => from corpusDoc in docs
select
- new ReduceResult
+ new
{
DocumentId = corpusDoc.Id,
CorpusId = corpusDoc.CorpusId,
- Topics = (string[]) new string[0]
+ Topics = new string[0]
}
);
AddMap<MyEntity2>(judgments => from j in judgments
select
- new ReduceResult
+ new
{
DocumentId = j.DocumentId,
CorpusId = string.Empty,
@@ -51,7 +51,7 @@ public MyTestIndex1()
Reduce = results => from result in results
group result by result.DocumentId
into g
- select new ReduceResult
+ select new
{
DocumentId = g.Key,
CorpusId = g.Select(x => x.CorpusId).FirstOrDefault(),
@@ -147,7 +147,7 @@ public MyTestIndex3_UsingNestedClass()
{
AddMap<MyEntity1>(docs => from corpusDoc in docs
select
- new MyReduceResult
+ new
{
DocumentId = corpusDoc.Id,
CorpusId = corpusDoc.CorpusId,
@@ -157,7 +157,7 @@ public MyTestIndex3_UsingNestedClass()
AddMap<MyEntity2>(judgments => from j in judgments
select
- new MyReduceResult
+ new
{
DocumentId = j.DocumentId,
CorpusId = string.Empty,
@@ -167,7 +167,7 @@ public MyTestIndex3_UsingNestedClass()
Reduce = results => from result in results
group result by result.DocumentId
into g
- select new MyReduceResult
+ select new
{
DocumentId = g.Key,
CorpusId = g.Select(x => x.CorpusId).FirstOrDefault(),

0 comments on commit 5b3cb40

Please sign in to comment.