|
|
|
@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
if (nspace.Name != null) { |
|
|
|
|
nDecl = new NamespaceDeclaration (); |
|
|
|
|
nDecl.AddChild (new CSharpTokenNode (Convert (nspace.NamespaceLocation), "namespace".Length), NamespaceDeclaration.Roles.Keyword); |
|
|
|
|
nDecl.AddChild (ConvertMemberName (nspace.Name), NamespaceDeclaration.Roles.Identifier); |
|
|
|
|
nDecl.AddChild (ConvertNamespaceName (nspace.Name), NamespaceDeclaration.Roles.Identifier); |
|
|
|
|
nDecl.AddChild (new CSharpTokenNode (Convert (nspace.OpenBrace), 1), NamespaceDeclaration.Roles.LBrace); |
|
|
|
|
AddToNamespace (nDecl); |
|
|
|
|
namespaceStack.Push (nDecl); |
|
|
|
@ -91,16 +91,7 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -91,16 +91,7 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Visit (UsingsBag.Using u) |
|
|
|
|
{ |
|
|
|
|
UsingDeclaration ud = new UsingDeclaration (); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.UsingLocation), "using".Length), UsingDeclaration.Roles.Keyword); |
|
|
|
|
ud.AddChild (ConvertMemberName (u.NSpace), UsingAliasDeclaration.Roles.Identifier); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.SemicolonLocation), 1), UsingDeclaration.Roles.Semicolon); |
|
|
|
|
AddToNamespace (ud); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QualifiedIdentifier ConvertMemberName (MemberName memberName) |
|
|
|
|
QualifiedIdentifier ConvertNamespaceName (MemberName memberName) |
|
|
|
|
{ |
|
|
|
|
QualifiedIdentifier qi = new QualifiedIdentifier(); |
|
|
|
|
while (memberName != null) { |
|
|
|
@ -110,17 +101,49 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -110,17 +101,49 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
return qi; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Visit (UsingsBag.Using u) |
|
|
|
|
{ |
|
|
|
|
UsingDeclaration ud = new UsingDeclaration (); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.UsingLocation), "using".Length), UsingDeclaration.Roles.Keyword); |
|
|
|
|
ud.AddChild (ConvertImport (u.NSpace), UsingDeclaration.ImportRole); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.SemicolonLocation), 1), UsingDeclaration.Roles.Semicolon); |
|
|
|
|
AddToNamespace (ud); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Visit (UsingsBag.AliasUsing u) |
|
|
|
|
{ |
|
|
|
|
UsingAliasDeclaration ud = new UsingAliasDeclaration (); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.UsingLocation), "using".Length), UsingAliasDeclaration.Roles.Keyword); |
|
|
|
|
ud.AddChild (new Identifier (u.Identifier.Value, Convert (u.Identifier.Location)), UsingAliasDeclaration.AliasRole); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.AssignLocation), 1), UsingAliasDeclaration.Roles.Assign); |
|
|
|
|
ud.AddChild (new Identifier (u.Nspace.Name, Convert (u.Nspace.Location)), UsingAliasDeclaration.Roles.Identifier); |
|
|
|
|
ud.AddChild (ConvertImport (u.Nspace), UsingAliasDeclaration.ImportRole); |
|
|
|
|
ud.AddChild (new CSharpTokenNode (Convert (u.SemicolonLocation), 1), UsingAliasDeclaration.Roles.Semicolon); |
|
|
|
|
AddToNamespace (ud); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DomNode ConvertImport (MemberName memberName) |
|
|
|
|
{ |
|
|
|
|
if (memberName.IsDoubleColon && memberName.Left != null) { |
|
|
|
|
// left::name
|
|
|
|
|
SimpleType t = new SimpleType(); |
|
|
|
|
t.AddChild (new Identifier (memberName.Left.Name, Convert(memberName.Location)), SimpleType.AliasRole); |
|
|
|
|
t.AddChild (new Identifier (memberName.Name, Convert(memberName.Location)), SimpleType.Roles.Identifier); |
|
|
|
|
// TODO type arguments
|
|
|
|
|
return t; |
|
|
|
|
} else if (memberName.Left != null) { |
|
|
|
|
// left.name
|
|
|
|
|
MemberType t = new MemberType(); |
|
|
|
|
t.AddChild (ConvertImport (memberName.Left), MemberType.Roles.TargetExpression); |
|
|
|
|
t.AddChild (new Identifier (memberName.Name, Convert(memberName.Location)), MemberType.Roles.Identifier); |
|
|
|
|
return t; |
|
|
|
|
} else { |
|
|
|
|
SimpleType t = new SimpleType(); |
|
|
|
|
t.AddChild (new Identifier (memberName.Name, Convert(memberName.Location)), SimpleType.Roles.Identifier); |
|
|
|
|
// TODO type arguments
|
|
|
|
|
return t; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Visit (MemberCore member) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine ("Unknown member:"); |
|
|
|
@ -580,7 +603,7 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -580,7 +603,7 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
// if (m.Block is ToplevelBlock) {
|
|
|
|
|
// newMethod.AddChild (bodyBlock.FirstChild.NextSibling, MethodDeclaration.Roles.Body);
|
|
|
|
|
// } else {
|
|
|
|
|
newMethod.AddChild (bodyBlock, MethodDeclaration.Roles.Body); |
|
|
|
|
newMethod.AddChild (bodyBlock, MethodDeclaration.Roles.Body); |
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
typeStack.Peek ().AddChild (newMethod, TypeDeclaration.Roles.Member); |
|
|
|
@ -1104,7 +1127,7 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -1104,7 +1127,7 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
foreach (Statement stmt in blockStatement.Statements) { |
|
|
|
|
if (stmt == null) |
|
|
|
|
continue; |
|
|
|
|
/* if (curLocal < localVariables.Count && IsLower (localVariables[curLocal].Location, stmt.loc)) { |
|
|
|
|
/* if (curLocal < localVariables.Count && IsLower (localVariables[curLocal].Location, stmt.loc)) { |
|
|
|
|
result.AddChild (CreateVariableDeclaration (localVariables[curLocal]), AstNode.Roles.Statement); |
|
|
|
|
curLocal++; |
|
|
|
|
}*/ |
|
|
|
@ -1380,10 +1403,12 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -1380,10 +1403,12 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
var result = new PrimitiveType (); |
|
|
|
|
if (typeExpression.Type == TypeManager.void_type) { |
|
|
|
|
result.Keyword = "void"; |
|
|
|
|
} else if (typeExpression.Type == TypeManager.object_type) { |
|
|
|
|
result.Keyword = "object"; |
|
|
|
|
} else if (typeExpression.Type == TypeManager.string_type) { |
|
|
|
|
result.Keyword = "string"; |
|
|
|
|
} else if (typeExpression.Type == TypeManager.int32_type) { |
|
|
|
|
result.Keyword = "int"; |
|
|
|
|
} else if (typeExpression.Type == TypeManager.object_type) { |
|
|
|
|
result.Keyword = "object"; |
|
|
|
|
} else { |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
@ -2178,7 +2203,7 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -2178,7 +2203,7 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
public override object Visit (Mono.CSharp.Linq.SelectMany selectMany) |
|
|
|
|
{ |
|
|
|
|
var result = new QueryExpressionFromClause (); |
|
|
|
|
// TODO:
|
|
|
|
|
// TODO:
|
|
|
|
|
// Mono.CSharp.Linq.Cast cast = selectMany.Expr as Mono.CSharp.Linq.Cast;
|
|
|
|
|
var location = LocationsBag.GetLocations (selectMany); |
|
|
|
|
if (location != null) |
|
|
|
|