Browse Source

Fixed SD2-950: SharpDevelop Project Cconverter doesn't show correct line/column status.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1890 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
3010494a64
  1. 29
      src/AddIns/Misc/SubversionAddIn/Project/Src/SubversionStateCondition.cs
  2. 55
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

29
src/AddIns/Misc/SubversionAddIn/Project/Src/SubversionStateCondition.cs

@ -93,23 +93,28 @@ namespace ICSharpCode.Svn
if (fileName == lastTestFileName) { if (fileName == lastTestFileName) {
status = lastTestStatus; status = lastTestStatus;
} else { } else {
status = SvnClient.Instance.Client.SingleStatus(fileName).TextStatus.ToString(); try {
if (status == "Unversioned") { status = SvnClient.Instance.Client.SingleStatus(fileName).TextStatus.ToString();
PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(fileName), Revision.Working, Recurse.None); if (status == "Unversioned") {
if (pd != null) { PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(fileName), Revision.Working, Recurse.None);
string shortFileName = Path.GetFileName(fileName); if (pd != null) {
foreach (Property p in pd.Values) { string shortFileName = Path.GetFileName(fileName);
using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) { foreach (Property p in pd.Values) {
string line; using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) {
while ((line = r.ReadLine()) != null) { string line;
if (string.Equals(line, shortFileName, StringComparison.InvariantCultureIgnoreCase)) { while ((line = r.ReadLine()) != null) {
status = "Ignored"; if (string.Equals(line, shortFileName, StringComparison.InvariantCultureIgnoreCase)) {
break; status = "Ignored";
break;
}
} }
} }
} }
} }
} }
} catch (SvnClientException ex) {
LoggingService.Warn("Error getting status of " + fileName, ex);
status = "Unversioned";
} }
LoggingService.Debug("Status of " + fileName + " is " + status); LoggingService.Debug("Status of " + fileName + " is " + status);
lastTestFileName = fileName; lastTestFileName = fileName;

55
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -66,6 +66,17 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker = new NodeTracker(this); nodeTracker = new NodeTracker(this);
} }
void Error(INode node, string message)
{
outputFormatter.PrintText(" // ERROR: " + message + Environment.NewLine);
errors.Error(node.StartLocation.Y, node.StartLocation.X, message);
}
void NotSupported(INode node)
{
Error(node, "Not supported in C#: " + node.GetType().Name);
}
#region ICSharpCode.NRefactory.Parser.IASTVisitor interface implementation #region ICSharpCode.NRefactory.Parser.IASTVisitor interface implementation
public object VisitCompilationUnit(CompilationUnit compilationUnit, object data) public object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
{ {
@ -470,7 +481,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) public object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
{ {
errors.Error(-1, -1, String.Format("OptionDeclaration is unsupported")); NotSupported(optionDeclaration);
return null; return null;
} }
#endregion #endregion
@ -611,13 +622,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) public object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data)
{ {
// VB.NET only // VB.NET only
NotSupported(eventRaiseRegion);
return null; return null;
} }
public object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) public object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
{ {
VisitAttributes(parameterDeclarationExpression.Attributes, data); VisitAttributes(parameterDeclarationExpression.Attributes, data);
OutputModifier(parameterDeclarationExpression.ParamModifier); OutputModifier(parameterDeclarationExpression.ParamModifier, parameterDeclarationExpression);
nodeTracker.TrackedVisit(parameterDeclarationExpression.TypeReference, data); nodeTracker.TrackedVisit(parameterDeclarationExpression.TypeReference, data);
outputFormatter.Space(); outputFormatter.Space();
outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName); outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName);
@ -757,7 +769,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Minus); outputFormatter.PrintToken(Tokens.Minus);
break; break;
default: default:
errors.Error(-1, -1, operatorDeclaration.OverloadableOperator.ToString() + " is not supported as overloadable operator"); Error(operatorDeclaration, operatorDeclaration.OverloadableOperator.ToString() + " is not supported as overloadable operator");
break; break;
} }
} }
@ -868,7 +880,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) public object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
{ {
errors.Error(-1, -1, "DeclareDeclaration is unsupported"); NotSupported(declareDeclaration);
return null; return null;
} }
#endregion #endregion
@ -971,30 +983,22 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitErrorStatement(ErrorStatement errorStatement, object data) public object VisitErrorStatement(ErrorStatement errorStatement, object data)
{ {
errors.Error(-1, -1, String.Format("ErrorStatement is unsupported")); NotSupported(errorStatement);
return null; return null;
} }
public object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) public object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data)
{ {
errors.Error(-1, -1, String.Format("OnErrorStatement is unsupported")); NotSupported(onErrorStatement);
return null; return null;
} }
public object VisitReDimStatement(ReDimStatement reDimStatement, object data) public object VisitReDimStatement(ReDimStatement reDimStatement, object data)
{ {
// TODO: implement me NotSupported(reDimStatement);
errors.Error(-1, -1, String.Format("ReDimStatement is unsupported"));
return null; return null;
} }
// public object VisitReDimClause(ReDimClause reDimClause, object data)
// {
// // TODO: implement me
// errors.Error(-1, -1, String.Format("ReDimClause is unsupported"));
// return null;
// }
public object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) public object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
{ {
nodeTracker.TrackedVisit(expressionStatement.Expression, data); nodeTracker.TrackedVisit(expressionStatement.Expression, data);
@ -1247,7 +1251,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Case); outputFormatter.PrintToken(Tokens.Case);
outputFormatter.Space(); outputFormatter.Space();
if (caseLabel.BinaryOperatorType != BinaryOperatorType.None) { if (caseLabel.BinaryOperatorType != BinaryOperatorType.None) {
errors.Error(-1, -1, String.Format("Case labels with binary operators are unsupported : {0}", caseLabel.BinaryOperatorType)); Error(caseLabel, String.Format("Case labels with binary operators are unsupported : {0}", caseLabel.BinaryOperatorType));
} }
nodeTracker.TrackedVisit(caseLabel.Label, data); nodeTracker.TrackedVisit(caseLabel.Label, data);
} }
@ -1296,7 +1300,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitResumeStatement(ResumeStatement resumeStatement, object data) public object VisitResumeStatement(ResumeStatement resumeStatement, object data)
{ {
errors.Error(-1, -1, String.Format("Resume statement is unsupported.")); NotSupported(resumeStatement);
return null; return null;
} }
@ -1357,7 +1361,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) public object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
{ {
if (doLoopStatement.ConditionPosition == ConditionPosition.None) { if (doLoopStatement.ConditionPosition == ConditionPosition.None) {
errors.Error(-1, -1, String.Format("Unknown condition position for loop : {0}.", doLoopStatement)); Error(doLoopStatement, String.Format("Unknown condition position for loop : {0}.", doLoopStatement));
} }
if (doLoopStatement.ConditionPosition == ConditionPosition.Start) { if (doLoopStatement.ConditionPosition == ConditionPosition.Start) {
@ -1591,8 +1595,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
#region Expressions #region Expressions
public object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) public object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data)
{ {
// TODO: implement me (if possible) NotSupported(classReferenceExpression);
errors.Error(-1, -1, String.Format("Unsupported expression : {0}", classReferenceExpression));
return null; return null;
} }
@ -1938,7 +1941,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
break; break;
default: default:
errors.Error(-1, -1, String.Format("Unknown binary operator {0}", binaryOperatorExpression.Op)); Error(binaryOperatorExpression, String.Format("Unknown binary operator {0}", binaryOperatorExpression.Op));
return null; return null;
} }
nodeTracker.TrackedVisit(binaryOperatorExpression.Right, data); nodeTracker.TrackedVisit(binaryOperatorExpression.Right, data);
@ -2021,7 +2024,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.BitwiseAnd); outputFormatter.PrintToken(Tokens.BitwiseAnd);
break; break;
default: default:
errors.Error(-1, -1, String.Format("Unknown unary operator {0}", unaryOperatorExpression.Op)); Error(unaryOperatorExpression, String.Format("Unknown unary operator {0}", unaryOperatorExpression.Op));
return null; return null;
} }
nodeTracker.TrackedVisit(unaryOperatorExpression.Expression, data); nodeTracker.TrackedVisit(unaryOperatorExpression.Expression, data);
@ -2080,7 +2083,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
assignmentExpression.Right), data); assignmentExpression.Right), data);
return null; return null;
default: default:
errors.Error(-1, -1, String.Format("Unknown assignment operator {0}", assignmentExpression.Op)); Error(assignmentExpression, String.Format("Unknown assignment operator {0}", assignmentExpression.Op));
return null; return null;
} }
if (this.prettyPrintOptions.AroundAssignmentParentheses) { if (this.prettyPrintOptions.AroundAssignmentParentheses) {
@ -2357,7 +2360,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
#endregion #endregion
#endregion #endregion
void OutputModifier(ParameterModifiers modifier) void OutputModifier(ParameterModifiers modifier, INode node)
{ {
switch (modifier) { switch (modifier) {
case ParameterModifiers.None: case ParameterModifiers.None:
@ -2376,10 +2379,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space(); outputFormatter.Space();
break; break;
case ParameterModifiers.Optional: case ParameterModifiers.Optional:
errors.Error(-1, -1, String.Format("Optional parameters aren't supported in C#")); Error(node, String.Format("Optional parameters aren't supported in C#"));
break; break;
default: default:
errors.Error(-1, -1, String.Format("Unsupported modifier : {0}", modifier)); Error(node, String.Format("Unsupported modifier : {0}", modifier));
break; break;
} }
} }

Loading…
Cancel
Save