Browse Source

Renamed InvocationExpression.Parameters to InvocationExpression.Arguments.

Fixed bug that caused SharpDevelop to add byte order marks to plain ASCII files when UTF-8 was chosen as default encoding.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@473 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
a3cca20f00
  1. 9
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs
  2. 26
      src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs
  3. 12
      src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs
  4. 20
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  5. 4
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/Enums.cs
  6. 30
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/Expressions/InvocationExpression.cs
  7. 12
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/GlobalScope/TypeDeclaration.cs
  8. 14
      src/Libraries/NRefactory/Project/Src/Parser/AST/VBNet/Statements/RaiseEventStatement.cs
  9. 2057
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  10. 1
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  11. 10
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  12. 10
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  13. 8
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/AbstractASTVisitor.cs
  14. 4
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/VBNetToCSharpConvertVisitor.cs
  15. 16
      src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
  16. 8
      src/Libraries/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs
  17. 2
      src/Libraries/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs
  18. 36
      src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
  19. 10
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
  20. 2
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
  21. 6
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs

9
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs

@ -728,14 +728,17 @@ namespace ICSharpCode.TextEditor @@ -728,14 +728,17 @@ namespace ICSharpCode.TextEditor
fs.Position = 0;
switch (state) {
case ASCII:
// when the file seems to be ASCII, we read it using the user-specified encoding
// so it is saved again using that encoding.
return new StreamReader(fs, this.TextEditorProperties.Encoding);
case Error:
// when the file seems to be ASCII or non-UTF8,
// we read it using the user-specified encoding so it is saved again
// using that encoding.
Encoding defaultEncoding = this.TextEditorProperties.Encoding;
if (IsUnicode(defaultEncoding)) {
// the file is not Unicode, so don't read it using Unicode even if the
// user has choosen Unicode as the default encoding.
// If we don't do this, SD will end up always adding a Byte Order Mark
// to ASCII files.
defaultEncoding = Encoding.Default; // use system encoding instead
}
return new StreamReader(fs, defaultEncoding);

26
src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs

@ -329,16 +329,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -329,16 +329,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
OutputModifier(typeDeclaration.Modifier);
switch (typeDeclaration.Type) {
case Types.Class:
case ClassType.Class:
outputFormatter.PrintToken(Tokens.Class);
break;
case Types.Enum:
case ClassType.Enum:
outputFormatter.PrintToken(Tokens.Enum);
break;
case Types.Interface:
case ClassType.Interface:
outputFormatter.PrintToken(Tokens.Interface);
break;
case Types.Struct:
case ClassType.Struct:
outputFormatter.PrintToken(Tokens.Struct);
break;
}
@ -364,23 +364,23 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -364,23 +364,23 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
switch (typeDeclaration.Type) {
case Types.Class:
case ClassType.Class:
outputFormatter.BeginBrace(this.prettyPrintOptions.ClassBraceStyle);
break;
case Types.Enum:
case ClassType.Enum:
outputFormatter.BeginBrace(this.prettyPrintOptions.EnumBraceStyle);
break;
case Types.Interface:
case ClassType.Interface:
outputFormatter.BeginBrace(this.prettyPrintOptions.InterfaceBraceStyle);
break;
case Types.Struct:
case ClassType.Struct:
outputFormatter.BeginBrace(this.prettyPrintOptions.StructBraceStyle);
break;
}
TypeDeclaration oldType = currentType;
currentType = typeDeclaration;
if (typeDeclaration.Type == Types.Enum) {
if (typeDeclaration.Type == ClassType.Enum) {
OutputEnumMembers(typeDeclaration, data);
} else {
nodeTracker.TrackedVisitChildren(typeDeclaration, data);
@ -856,7 +856,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -856,7 +856,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
outputFormatter.PrintToken(Tokens.OpenParenthesis);
this.AppendCommaSeparatedList(raiseEventStatement.Parameters);
this.AppendCommaSeparatedList(raiseEventStatement.Arguments);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
outputFormatter.PrintToken(Tokens.Semicolon);
outputFormatter.NewLine();
@ -1886,9 +1886,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1886,9 +1886,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{
nodeTracker.TrackedVisit(invocationExpression.TargetObject, data);
if (invocationExpression.TypeParameters != null && invocationExpression.TypeParameters.Count > 0) {
if (invocationExpression.TypeArguments != null && invocationExpression.TypeArguments.Count > 0) {
OutputFormatter.PrintToken(Tokens.LessThan);
AppendCommaSeparatedList(invocationExpression.TypeParameters);
AppendCommaSeparatedList(invocationExpression.TypeArguments);
OutputFormatter.PrintToken(Tokens.GreaterThan);
}
@ -1897,7 +1897,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1897,7 +1897,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.OpenParenthesis);
AppendCommaSeparatedList(invocationExpression.Parameters);
AppendCommaSeparatedList(invocationExpression.Arguments);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
return null;
}

12
src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs

@ -200,10 +200,10 @@ namespace ICSharpCode.NRefactory.Parser @@ -200,10 +200,10 @@ namespace ICSharpCode.NRefactory.Parser
{
this.currentTypeDeclaration = typeDeclaration;
CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(typeDeclaration.Name);
codeTypeDeclaration.IsClass = typeDeclaration.Type == Types.Class;
codeTypeDeclaration.IsEnum = typeDeclaration.Type == Types.Enum;
codeTypeDeclaration.IsInterface = typeDeclaration.Type == Types.Interface;
codeTypeDeclaration.IsStruct = typeDeclaration.Type == Types.Struct;
codeTypeDeclaration.IsClass = typeDeclaration.Type == ClassType.Class;
codeTypeDeclaration.IsEnum = typeDeclaration.Type == ClassType.Enum;
codeTypeDeclaration.IsInterface = typeDeclaration.Type == ClassType.Interface;
codeTypeDeclaration.IsStruct = typeDeclaration.Type == ClassType.Struct;
if (typeDeclaration.BaseTypes != null) {
foreach (TypeReference typeRef in typeDeclaration.BaseTypes) {
@ -646,7 +646,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -646,7 +646,7 @@ namespace ICSharpCode.NRefactory.Parser
methodName = fRef.FieldName;
// HACK for : Microsoft.VisualBasic.ChrW(NUMBER)
if (methodName == "ChrW") {
return new CodeCastExpression("System.Char", GetExpressionList(invocationExpression.Parameters)[0]);
return new CodeCastExpression("System.Char", GetExpressionList(invocationExpression.Arguments)[0]);
}
} else if (target is IdentifierExpression) {
targetExpr = new CodeThisReferenceExpression();
@ -654,7 +654,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -654,7 +654,7 @@ namespace ICSharpCode.NRefactory.Parser
} else {
targetExpr = (CodeExpression)target.AcceptVisitor(this, data);
}
return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Parameters));
return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Arguments));
}
public override object Visit(IdentifierExpression expression, object data)

20
src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs

@ -269,16 +269,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -269,16 +269,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
int GetTypeToken(TypeDeclaration typeDeclaration)
{
switch (typeDeclaration.Type) {
case Types.Class:
case ClassType.Class:
return Tokens.Class;
case Types.Enum:
case ClassType.Enum:
return Tokens.Enum;
case Types.Interface:
case ClassType.Interface:
return Tokens.Interface;
case Types.Struct:
case ClassType.Struct:
// FIXME: This should be better in VBNetRefactory class because it is an AST transformation, but currently I'm too lazy
if (TypeHasOnlyStaticMembers(typeDeclaration)) {
goto case Types.Class;
goto case ClassType.Class;
}
return Tokens.Structure;
}
@ -319,7 +319,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -319,7 +319,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
string baseType = baseTypeRef.Type;
bool baseTypeIsInterface = baseType.StartsWith("I") && (baseType.Length <= 1 || Char.IsUpper(baseType[1]));
if (!baseTypeIsInterface || typeDeclaration.Type == Types.Interface) {
if (!baseTypeIsInterface || typeDeclaration.Type == ClassType.Interface) {
outputFormatter.PrintToken(Tokens.Inherits);
} else {
outputFormatter.PrintToken(Tokens.Implements);
@ -1002,7 +1002,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1002,7 +1002,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space();
outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
outputFormatter.PrintToken(Tokens.OpenParenthesis);
AppendCommaSeparatedList(raiseEventStatement.Parameters);
AppendCommaSeparatedList(raiseEventStatement.Arguments);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
return null;
}
@ -1859,15 +1859,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1859,15 +1859,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(InvocationExpression invocationExpression, object data)
{
nodeTracker.TrackedVisit(invocationExpression.TargetObject, data);
if (invocationExpression.TypeParameters != null && invocationExpression.TypeParameters.Count > 0) {
if (invocationExpression.TypeArguments != null && invocationExpression.TypeArguments.Count > 0) {
outputFormatter.PrintToken(Tokens.OpenParenthesis);
outputFormatter.PrintToken(Tokens.Of);
outputFormatter.Space();
AppendCommaSeparatedList(invocationExpression.TypeParameters);
AppendCommaSeparatedList(invocationExpression.TypeArguments);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
}
outputFormatter.PrintToken(Tokens.OpenParenthesis);
AppendCommaSeparatedList(invocationExpression.Parameters);
AppendCommaSeparatedList(invocationExpression.Arguments);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
return null;
}

4
src/Libraries/NRefactory/Project/Src/Parser/AST/General/Enums.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="none" email=""/>
@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
Extern | Volatile | Unsafe | Overloads | WithEvents
}
public enum Types // TODO: Rename to ClassType
public enum ClassType
{
Class,
Module,

30
src/Libraries/NRefactory/Project/Src/Parser/AST/General/Expressions/InvocationExpression.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="none" email=""/>
@ -15,9 +15,9 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -15,9 +15,9 @@ namespace ICSharpCode.NRefactory.Parser.AST {
public class InvocationExpression : Expression
{
Expression targetObject;
// List<Expression> parameters;
ArrayList parameters;
List<TypeReference> typeParameters;
// List<Expression> arguments;
ArrayList arguments;
List<TypeReference> typeArguments;
public Expression TargetObject {
get {
@ -28,41 +28,41 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -28,41 +28,41 @@ namespace ICSharpCode.NRefactory.Parser.AST {
}
}
public ArrayList Parameters {
public ArrayList Arguments {
get {
return parameters;
return arguments;
}
set {
parameters = value == null ? new ArrayList(1) : value;
arguments = value == null ? new ArrayList(1) : value;
}
}
public List<TypeReference> TypeParameters {
public List<TypeReference> TypeArguments {
get {
return typeParameters;
return typeArguments;
}
set {
typeParameters = value == null ? new List<TypeReference>(1) : value;
typeArguments = value == null ? new List<TypeReference>(1) : value;
}
}
public InvocationExpression(Expression targetObject, ArrayList parameters)
{
this.TargetObject = targetObject;
this.Parameters = parameters;
this.Arguments = parameters;
}
public InvocationExpression(Expression targetObject, ArrayList parameters, List<TypeReference> typeParameters)
{
this.TargetObject = targetObject;
this.Parameters = parameters;
this.TypeParameters = typeParameters;
this.Arguments = parameters;
this.TypeArguments = typeParameters;
}
public InvocationExpression(Expression targetObject)
{
this.TargetObject = targetObject;
this.parameters = new ArrayList(1);
this.arguments = new ArrayList(1);
}
public override object AcceptVisitor(IASTVisitor visitor, object data)
@ -74,7 +74,7 @@ namespace ICSharpCode.NRefactory.Parser.AST { @@ -74,7 +74,7 @@ namespace ICSharpCode.NRefactory.Parser.AST {
{
return String.Format("[InvocationExpression: TargetObject={0}, parameters={1}]",
TargetObject,
GetCollectionString(Parameters));
GetCollectionString(Arguments));
}
}
}

12
src/Libraries/NRefactory/Project/Src/Parser/AST/General/GlobalScope/TypeDeclaration.cs

@ -21,8 +21,8 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -21,8 +21,8 @@ namespace ICSharpCode.NRefactory.Parser.AST
// Children of Interface: MethodDeclaration, PropertyDeclaration, IndexerDeclaration, EventDeclaration, in VB: TypeDeclaration(Enum) too
// Children of Enum: FieldDeclaration
string name = "";
Types type = Types.Class; // Class | Interface | Struct | Enum
List<TypeReference> bases = new List<TypeReference>();
ClassType type = ClassType.Class; // Class | Interface | Struct | Enum
List<TypeReference> baseTypes = new List<TypeReference>();
List<TemplateDefinition> templates = new List<TemplateDefinition>();
public string Name {
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public Types Type {
public ClassType Type {
get {
return type;
}
@ -45,11 +45,11 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -45,11 +45,11 @@ namespace ICSharpCode.NRefactory.Parser.AST
public List<TypeReference> BaseTypes {
get {
return bases;
return baseTypes;
}
set {
Debug.Assert(value != null);
bases = value;
baseTypes = value;
}
}
@ -103,7 +103,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -103,7 +103,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
name,
modifier,
type,
GetCollectionString(bases),
GetCollectionString(baseTypes),
GetCollectionString(attributes),
GetCollectionString(Children));
}

14
src/Libraries/NRefactory/Project/Src/Parser/AST/VBNet/Statements/RaiseEventStatement.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="none" email=""/>
@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
{
string eventName = "";
// List<Expression> parameters = new List<Expression>(1);
ArrayList parameters = new ArrayList(1);
ArrayList arguments = new ArrayList(1);
public string EventName {
get {
@ -26,13 +26,13 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -26,13 +26,13 @@ namespace ICSharpCode.NRefactory.Parser.AST
eventName = value;
}
}
public ArrayList Parameters {
public ArrayList Arguments {
get {
return parameters;
return arguments;
}
set {
Debug.Assert(value != null);
parameters = value;
arguments = value;
}
}
@ -41,7 +41,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -41,7 +41,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
Debug.Assert(eventName != null);
this.eventName = eventName;
Debug.Assert(parameters != null);
this.parameters = parameters;
this.arguments = parameters;
}
public override object AcceptVisitor(IASTVisitor visitor, object data)
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
{
return String.Format("[RaiseEventStatement: EventName={0}, Parameters={1}]",
EventName,
GetCollectionString(parameters));
GetCollectionString(arguments));
}
}
}

2057
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

File diff suppressed because it is too large Load Diff

1
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -6,6 +6,7 @@ using System.Text; @@ -6,6 +6,7 @@ using System.Text;
using ICSharpCode.NRefactory.Parser;
using ICSharpCode.NRefactory.Parser.AST;
using ASTAttribute = ICSharpCode.NRefactory.Parser.AST.Attribute;
using Types = ICSharpCode.NRefactory.Parser.AST.ClassType;
COMPILER CS /* AW 2002-12-30 renamed from CompilationUnit to CS */

10
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

@ -731,7 +731,7 @@ Modifiers m, List<AttributeSection> attributes) { @@ -731,7 +731,7 @@ Modifiers m, List<AttributeSection> attributes) {
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Class;
newType.Type = ClassType.Class;
Identifier();
@ -775,7 +775,7 @@ newType); @@ -775,7 +775,7 @@ newType);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Module;
newType.Type = ClassType.Module;
Identifier();
@ -800,7 +800,7 @@ newType); @@ -800,7 +800,7 @@ newType);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Struct;
newType.Type = ClassType.Struct;
Identifier();
@ -837,7 +837,7 @@ newType); @@ -837,7 +837,7 @@ newType);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Enum;
newType.Type = ClassType.Enum;
Identifier();
@ -871,7 +871,7 @@ newType); @@ -871,7 +871,7 @@ newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Interface;
newType.Type = ClassType.Interface;
Identifier();

10
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -607,7 +607,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes> @@ -607,7 +607,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes>
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Class;
newType.Type = ClassType.Class;
.)
Identifier (. newType.Name = t.val; .)
TypeParameterList<newType.Templates>
@ -625,7 +625,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes> @@ -625,7 +625,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes>
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Module;
newType.Type = ClassType.Module;
.)
Identifier (. newType.Name = t.val; .)
EOL
@ -640,7 +640,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes> @@ -640,7 +640,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes>
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Struct;
newType.Type = ClassType.Struct;
.)
Identifier (. newType.Name = t.val; .)
TypeParameterList<newType.Templates>
@ -658,7 +658,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes> @@ -658,7 +658,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes>
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Enum;
newType.Type = ClassType.Enum;
.)
Identifier (. newType.Name = t.val; .)
[ "As" PrimitiveTypeName<out name> (. newType.BaseTypes.Add(new TypeReference(name)); .) ]
@ -675,7 +675,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes> @@ -675,7 +675,7 @@ NonModuleDeclaration<Modifiers m, List<AttributeSection> attributes>
newType.StartLocation = m.GetDeclarationLocation(t.Location);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Interface;
newType.Type = ClassType.Interface;
.)
Identifier (. newType.Name = t.val; .)
TypeParameterList<newType.Templates>

8
src/Libraries/NRefactory/Project/Src/Parser/Visitors/AbstractASTVisitor.cs

@ -479,8 +479,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -479,8 +479,8 @@ namespace ICSharpCode.NRefactory.Parser
public virtual object Visit(RaiseEventStatement raiseEventStatement, object data)
{
Debug.Assert(raiseEventStatement != null);
Debug.Assert(raiseEventStatement.Parameters != null);
foreach (Expression e in raiseEventStatement.Parameters) {
Debug.Assert(raiseEventStatement.Arguments != null);
foreach (Expression e in raiseEventStatement.Arguments) {
Debug.Assert(e != null);
e.AcceptVisitor(this, data);
}
@ -937,10 +937,10 @@ namespace ICSharpCode.NRefactory.Parser @@ -937,10 +937,10 @@ namespace ICSharpCode.NRefactory.Parser
{
Debug.Assert(invocationExpression != null);
Debug.Assert(invocationExpression.TargetObject != null);
Debug.Assert(invocationExpression.Parameters != null);
Debug.Assert(invocationExpression.Arguments != null);
invocationExpression.TargetObject.AcceptVisitor(this, data);
foreach (Expression e in invocationExpression.Parameters) {
foreach (Expression e in invocationExpression.Arguments) {
Debug.Assert(e != null);
e.AcceptVisitor(this, data);
}

4
src/Libraries/NRefactory/Project/Src/Parser/Visitors/VBNetToCSharpConvertVisitor.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.Parser
if (fre.TargetObject is BaseReferenceExpression || fre.TargetObject is ClassReferenceExpression) {
body.Children.RemoveAt(0);
ConstructorInitializer ci = new ConstructorInitializer();
ci.Arguments = ie.Parameters;
ci.Arguments = ie.Arguments;
if (fre.TargetObject is BaseReferenceExpression)
ci.ConstructorInitializerType = ConstructorInitializerType.Base;
else

16
src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs

@ -18,18 +18,18 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -18,18 +18,18 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
void CheckSimpleInvoke(InvocationExpression ie)
{
Assert.AreEqual(0, ie.Parameters.Count);
Assert.AreEqual(0, ie.Arguments.Count);
Assert.IsTrue(ie.TargetObject is IdentifierExpression);
Assert.AreEqual("myMethod", ((IdentifierExpression)ie.TargetObject).Identifier);
}
void CheckGenericInvoke(InvocationExpression expr)
{
Assert.AreEqual(1, expr.Parameters.Count);
Assert.AreEqual(1, expr.Arguments.Count);
Assert.IsTrue(expr.TargetObject is IdentifierExpression);
Assert.AreEqual("myMethod", ((IdentifierExpression)expr.TargetObject).Identifier);
Assert.AreEqual(1, expr.TypeParameters.Count);
Assert.AreEqual("System.Char", expr.TypeParameters[0].SystemType);
Assert.AreEqual(1, expr.TypeArguments.Count);
Assert.AreEqual("System.Char", expr.TypeArguments[0].SystemType);
}
@ -55,10 +55,10 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -55,10 +55,10 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.IsTrue(expr.TargetObject is IdentifierExpression);
Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
Assert.AreEqual(1, expr.Parameters.Count); // here a second null parameter was added incorrectly
Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
Assert.IsTrue(expr.Parameters[0] is InvocationExpression);
CheckSimpleInvoke((InvocationExpression)expr.Parameters[0]);
Assert.IsTrue(expr.Arguments[0] is InvocationExpression);
CheckSimpleInvoke((InvocationExpression)expr.Arguments[0]);
}
#endregion
@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
public void PrimitiveExpression1Test()
{
InvocationExpression ie = (InvocationExpression)ParseUtilVBNet.ParseExpression("546.ToString()", typeof(InvocationExpression));
Assert.AreEqual(0, ie.Parameters.Count);
Assert.AreEqual(0, ie.Arguments.Count);
}
#endregion

8
src/Libraries/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
@ -42,10 +42,10 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -42,10 +42,10 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.IsTrue(expr.TargetObject is IdentifierExpression);
Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
Assert.AreEqual(1, expr.Parameters.Count); // here a second null parameter was added incorrectly
Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
Assert.IsTrue(expr.Parameters[0] is ObjectCreateExpression);
CheckSimpleObjectCreateExpression((ObjectCreateExpression)expr.Parameters[0]);
Assert.IsTrue(expr.Arguments[0] is ObjectCreateExpression);
CheckSimpleObjectCreateExpression((ObjectCreateExpression)expr.Arguments[0]);
}
#endregion

2
src/Libraries/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs

@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -21,7 +21,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
public void CSharpHexIntegerTest1()
{
InvocationExpression invExpr = (InvocationExpression)ParseUtilCSharp.ParseExpression("0xAFFE.ToString()", typeof(InvocationExpression));
Assert.AreEqual(0, invExpr.Parameters.Count);
Assert.AreEqual(0, invExpr.Arguments.Count);
Assert.IsTrue(invExpr.TargetObject is FieldReferenceExpression);
FieldReferenceExpression fre = invExpr.TargetObject as FieldReferenceExpression;
Assert.AreEqual("ToString", fre.FieldName);

36
src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("class MyClass : My.Base.Class { }", typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("MyClass", td.Name);
Assert.AreEqual("My.Base.Class", td.BaseTypes[0].Type);
Assert.AreEqual(Modifier.None, td.Modifier);
@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("partial class MyClass { }", typeof(TypeDeclaration));
Assert.IsNotNull(td);
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("MyClass", td.Name);
Assert.AreEqual(Modifier.Partial, td.Modifier);
}
@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("static class MyClass { }", typeof(TypeDeclaration));
Assert.IsNotNull(td);
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("MyClass", td.Name);
Assert.AreEqual(Modifier.Static, td.Modifier);
}
@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("public class G<T> {}", typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("G", td.Name);
Assert.AreEqual(Modifier.Public, td.Modifier);
Assert.AreEqual(0, td.BaseTypes.Count);
@ -75,7 +75,7 @@ public class Test<T> where T : IMyInterface @@ -75,7 +75,7 @@ public class Test<T> where T : IMyInterface
";
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Test", td.Name);
Assert.AreEqual(1, td.Templates.Count);
@ -93,7 +93,7 @@ public class Generic<T, S> : System.IComparable where S : G<T[]> where T : MyNa @@ -93,7 +93,7 @@ public class Generic<T, S> : System.IComparable where S : G<T[]> where T : MyNa
";
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Generic", td.Name);
Assert.AreEqual(Modifier.Public, td.Modifier);
Assert.AreEqual(1, td.BaseTypes.Count);
@ -122,7 +122,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -122,7 +122,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
";
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("MyClass", td.Name);
Assert.AreEqual(Modifier.Public | Modifier.Abstract, td.Modifier);
Assert.AreEqual(1, td.Attributes.Count);
@ -137,7 +137,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -137,7 +137,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("struct MyStruct {}", typeof(TypeDeclaration));
Assert.AreEqual(Types.Struct, td.Type);
Assert.AreEqual(ClassType.Struct, td.Type);
Assert.AreEqual("MyStruct", td.Name);
}
@ -146,7 +146,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -146,7 +146,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("interface MyInterface {}", typeof(TypeDeclaration));
Assert.AreEqual(Types.Interface, td.Type);
Assert.AreEqual(ClassType.Interface, td.Type);
Assert.AreEqual("MyInterface", td.Name);
}
@ -155,7 +155,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -155,7 +155,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
{
TypeDeclaration td = (TypeDeclaration)ParseUtilCSharp.ParseGlobal("enum MyEnum {}", typeof(TypeDeclaration));
Assert.AreEqual(Types.Enum, td.Type);
Assert.AreEqual(ClassType.Enum, td.Type);
Assert.AreEqual("MyEnum", td.Name);
}
#endregion
@ -169,7 +169,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -169,7 +169,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(program, typeof(TypeDeclaration));
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual(1, td.StartLocation.Y, "start line");
Assert.AreEqual(2, td.EndLocation.Y, "end line");
}
@ -182,7 +182,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -182,7 +182,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(program, typeof(TypeDeclaration));
Assert.AreEqual("TestEnum", td.Name);
Assert.AreEqual(Types.Enum, td.Type);
Assert.AreEqual(ClassType.Enum, td.Type);
Assert.AreEqual("Byte", td.BaseTypes[0].Type);
}
@ -194,7 +194,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -194,7 +194,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(program, typeof(TypeDeclaration));
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual(1, td.StartLocation.Y, "start line");
Assert.AreEqual(2, td.EndLocation.Y, "end line");
}
@ -207,7 +207,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -207,7 +207,7 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(program, typeof(TypeDeclaration));
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual(Modifier.Partial, td.Modifier);
}
@ -221,7 +221,7 @@ End Class @@ -221,7 +221,7 @@ End Class
";
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Test", td.Name);
Assert.AreEqual(Modifier.Public, td.Modifier);
Assert.AreEqual(0, td.BaseTypes.Count);
@ -239,7 +239,7 @@ End Class @@ -239,7 +239,7 @@ End Class
";
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Test", td.Name);
Assert.AreEqual(1, td.Templates.Count);
@ -258,7 +258,7 @@ End Class @@ -258,7 +258,7 @@ End Class
";
TypeDeclaration td = (TypeDeclaration)ParseUtilVBNet.ParseGlobal(declr, typeof(TypeDeclaration));
Assert.AreEqual(Types.Class, td.Type);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Generic", td.Name);
Assert.AreEqual(Modifier.Public, td.Modifier);
Assert.AreEqual(1, td.BaseTypes.Count);

10
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -243,16 +243,16 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -243,16 +243,16 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
return ret;
}
ClassType TranslateClassType(AST.Types type)
ClassType TranslateClassType(AST.ClassType type)
{
switch (type) {
case AST.Types.Enum:
case AST.ClassType.Enum:
return ClassType.Enum;
case AST.Types.Interface:
case AST.ClassType.Interface:
return ClassType.Interface;
case AST.Types.Struct:
case AST.ClassType.Struct:
return ClassType.Struct;
case AST.Types.Module:
case AST.ClassType.Module:
return ClassType.Module;
default:
return ClassType.Class;

2
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs

@ -231,7 +231,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -231,7 +231,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
ctors.Add(m);
}
TypeVisitor typeVisitor = new TypeVisitor(this);
return CreateMemberResolveResult(typeVisitor.FindOverload(ctors, null, ie.Parameters, null));
return CreateMemberResolveResult(typeVisitor.FindOverload(ctors, null, ie.Arguments, null));
}
}
return null;

6
src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs

@ -198,19 +198,19 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -198,19 +198,19 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public IMethod GetMethod(InvocationExpression invocationExpression, object data)
{
IReturnType[] typeParameters = CreateReturnTypes(invocationExpression.TypeParameters);
IReturnType[] typeParameters = CreateReturnTypes(invocationExpression.TypeArguments);
if (invocationExpression.TargetObject is FieldReferenceExpression) {
FieldReferenceExpression field = (FieldReferenceExpression)invocationExpression.TargetObject;
IReturnType type = field.TargetObject.AcceptVisitor(this, data) as IReturnType;
List<IMethod> methods = resolver.SearchMethod(type, field.FieldName);
return FindOverload(methods, typeParameters, invocationExpression.Parameters, data);
return FindOverload(methods, typeParameters, invocationExpression.Arguments, data);
} else if (invocationExpression.TargetObject is IdentifierExpression) {
string id = ((IdentifierExpression)invocationExpression.TargetObject).Identifier;
if (resolver.CallingClass == null) {
return null;
}
List<IMethod> methods = resolver.SearchMethod(id);
return FindOverload(methods, typeParameters, invocationExpression.Parameters, data);
return FindOverload(methods, typeParameters, invocationExpression.Arguments, data);
}
return null;
}

Loading…
Cancel
Save