Browse Source

Merged missing SharpReport resources from Corsavy.

Fixed some bugs in code analysis-AddIn.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1603 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
a5ec465e77
  1. 1
      data/resources/image/BitmapResources/BitmapResources.res
  2. BIN
      data/resources/image/BitmapResources/SharpReportIcons/Icons.16x16.SharpReport.Rectangle.png
  3. BIN
      data/resources/image/BitmapResources/SharpReportIcons/Icons.16x16.SharpReport.Table.gif
  4. 4
      src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs
  5. 2
      src/AddIns/Misc/CodeAnalysis/Src/SuppressMessageCommand.cs
  6. 6
      src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs
  7. 1
      src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs
  8. 51
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  9. 4
      src/Libraries/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
  10. 1
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
  11. 25
      src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs
  12. 8
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  13. 1
      src/Libraries/NRefactory/Project/Src/Parser/AbstractParser.cs
  14. 2
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  15. 4
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  16. BIN
      src/Main/StartUp/Project/Resources/BitmapResources.resources

1
data/resources/image/BitmapResources/BitmapResources.res

@ -489,6 +489,7 @@ Icons.16x16.SharpReport.Descending = SharpReportIcons\Icons.16x16.SharpReport.De
Icons.16x16.SharpReport.Function = SharpReportIcons\Icons.16x16.SharpReport.Function.ico Icons.16x16.SharpReport.Function = SharpReportIcons\Icons.16x16.SharpReport.Function.ico
Icons.16.16.SharpReport.Textbox = SharpReportIcons\Icons.16.16.SharpReport.Textbox.ico Icons.16.16.SharpReport.Textbox = SharpReportIcons\Icons.16.16.SharpReport.Textbox.ico
Icons.16.16.SharpReport.Line = SharpReportIcons\Icons.16.16.SharpReport.Line.ico Icons.16.16.SharpReport.Line = SharpReportIcons\Icons.16.16.SharpReport.Line.ico
Icons.16x16.SharpReport.Rectangle = SharpReportIcons\Icons.16x16.SharpReport.Rectangle.png
#ViewNavigation icons #ViewNavigation icons
Icons.16x16.NavigateBack = NavigationIcons\Icons.16x16.NavigateBack.png Icons.16x16.NavigateBack = NavigationIcons\Icons.16x16.NavigateBack.png

BIN
data/resources/image/BitmapResources/SharpReportIcons/Icons.16x16.SharpReport.Rectangle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
data/resources/image/BitmapResources/SharpReportIcons/Icons.16x16.SharpReport.Table.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

4
src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.CodeAnalysis
public void Initialize(IEventSource eventSource) public void Initialize(IEventSource eventSource)
{ {
this.eventSource = eventSource; this.eventSource = eventSource;
engine.MessageView.AppendText("Running FxCop...\r\n"); engine.MessageView.AppendText("Running FxCop on " + Path.GetFileNameWithoutExtension(engine.CurrentProjectFile) + "\r\n");
eventSource.ErrorRaised += OnError; eventSource.ErrorRaised += OnError;
eventSource.WarningRaised += OnWarning; eventSource.WarningRaised += OnWarning;
} }
@ -99,6 +99,8 @@ namespace ICSharpCode.CodeAnalysis
err.FileName = pos.Cu.FileName ?? ""; err.FileName = pos.Cu.FileName ?? "";
err.Line = pos.Line; err.Line = pos.Line;
err.Column = pos.Column; err.Column = pos.Column;
} else {
err.FileName = null;
} }
} }

2
src/AddIns/Misc/CodeAnalysis/Src/SuppressMessageCommand.cs

@ -55,6 +55,8 @@ namespace ICSharpCode.CodeAnalysis
string code = codegen.GenerateCode(CreateSuppressAttribute(p.Cu, tag), indentation.ToString()); string code = codegen.GenerateCode(CreateSuppressAttribute(p.Cu, tag), indentation.ToString());
if (!code.EndsWith("\n")) code += Environment.NewLine; if (!code.EndsWith("\n")) code += Environment.NewLine;
document.Insert(line.Offset, code); document.Insert(line.Offset, code);
provider.TextEditorControl.ActiveTextAreaControl.Caret.Line = p.Line - 1;
provider.TextEditorControl.ActiveTextAreaControl.ScrollToCaret();
TaskService.Remove(t); TaskService.Remove(t);
ParserService.ParseViewContent(window.ViewContent); ParserService.ParseViewContent(window.ViewContent);
} }

6
src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs

@ -141,6 +141,9 @@ namespace ICSharpCode.Build.Tasks
{ {
bool isWarning = true; bool isWarning = true;
string checkId = message.GetAttribute("CheckId"); string checkId = message.GetAttribute("CheckId");
if (message.HasAttribute("TypeName")) {
checkId = checkId + ":" + message.GetAttribute("TypeName");
}
string category = message.GetAttribute("Category"); string category = message.GetAttribute("Category");
foreach (XmlNode node in message.SelectNodes(".//Issue")) { foreach (XmlNode node in message.SelectNodes(".//Issue")) {
XmlElement issueEl = node as XmlElement; XmlElement issueEl = node as XmlElement;
@ -175,9 +178,6 @@ namespace ICSharpCode.Build.Tasks
issueFullFile = "positionof#" + memberName; issueFullFile = "positionof#" + memberName;
} }
if (message.HasAttribute("TypeName")) {
checkId = checkId + ":" + message.GetAttribute("TypeName");
}
if (message.HasAttribute("Id")) { if (message.HasAttribute("Id")) {
memberName = memberName + "|" + message.GetAttribute("Id"); memberName = memberName + "|" + message.GetAttribute("Id");
} }

1
src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs

@ -16,6 +16,7 @@ namespace ICSharpCode.NRefactory.Parser
/// <summary> /// <summary>
/// This is the base class for the C# and VB.NET lexer /// This is the base class for the C# and VB.NET lexer
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1708:IdentifiersShouldDifferByMoreThanCase")]
public abstract class AbstractLexer : ILexer public abstract class AbstractLexer : ILexer
{ {
TextReader reader; TextReader reader;

51
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -262,25 +262,28 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
string stringValue = prefix + digit + suffix; string stringValue = prefix + digit + suffix;
if (isfloat) { if (isfloat) {
try { float num;
return new Token(Tokens.Literal, x, y, stringValue, Single.Parse(digit, CultureInfo.InvariantCulture)); if (float.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { return new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse float {0}", digit)); errors.Error(y, x, String.Format("Can't parse float {0}", digit));
return new Token(Tokens.Literal, x, y, stringValue, 0f); return new Token(Tokens.Literal, x, y, stringValue, 0f);
} }
} }
if (isdecimal) { if (isdecimal) {
try { decimal num;
return new Token(Tokens.Literal, x, y, stringValue, Decimal.Parse(digit, NumberStyles.Any, CultureInfo.InvariantCulture)); if (decimal.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { return new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse decimal {0}", digit)); errors.Error(y, x, String.Format("Can't parse decimal {0}", digit));
return new Token(Tokens.Literal, x, y, stringValue, 0m); return new Token(Tokens.Literal, x, y, stringValue, 0m);
} }
} }
if (isdouble) { if (isdouble) {
try { double num;
return new Token(Tokens.Literal, x, y, stringValue, Double.Parse(digit, CultureInfo.InvariantCulture)); if (double.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { return new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse double {0}", digit)); errors.Error(y, x, String.Format("Can't parse double {0}", digit));
return new Token(Tokens.Literal, x, y, stringValue, 0d); return new Token(Tokens.Literal, x, y, stringValue, 0d);
} }
@ -310,32 +313,36 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
if (islong) { if (islong) {
if (isunsigned) { if (isunsigned) {
try { ulong num;
token = new Token(Tokens.Literal, x, y, stringValue, UInt64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number)); if (ulong.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { token = new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse unsigned long {0}", digit)); errors.Error(y, x, String.Format("Can't parse unsigned long {0}", digit));
token = new Token(Tokens.Literal, x, y, stringValue, 0UL); token = new Token(Tokens.Literal, x, y, stringValue, 0UL);
} }
} else { } else {
try { long num;
token = new Token(Tokens.Literal, x, y, stringValue, Int64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number)); if (long.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { token = new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse long {0}", digit)); errors.Error(y, x, String.Format("Can't parse long {0}", digit));
token = new Token(Tokens.Literal, x, y, stringValue, 0L); token = new Token(Tokens.Literal, x, y, stringValue, 0L);
} }
} }
} else { } else {
if (isunsigned) { if (isunsigned) {
try { uint num;
token = new Token(Tokens.Literal, x, y, stringValue, UInt32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number)); if (uint.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { token = new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse unsigned int {0}", digit)); errors.Error(y, x, String.Format("Can't parse unsigned int {0}", digit));
token = new Token(Tokens.Literal, x, y, stringValue, 0U); token = new Token(Tokens.Literal, x, y, stringValue, (uint)0);
} }
} else { } else {
try { int num;
token = new Token(Tokens.Literal, x, y, stringValue, Int32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number)); if (int.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
} catch (Exception) { token = new Token(Tokens.Literal, x, y, stringValue, num);
} else {
errors.Error(y, x, String.Format("Can't parse int {0}", digit)); errors.Error(y, x, String.Format("Can't parse int {0}", digit));
token = new Token(Tokens.Literal, x, y, stringValue, 0); token = new Token(Tokens.Literal, x, y, stringValue, 0);
} }

4
src/Libraries/NRefactory/Project/Src/Lexer/Special/ISpecial.cs

@ -34,13 +34,13 @@ namespace ICSharpCode.NRefactory.Parser
Location startPosition, endPosition; Location startPosition, endPosition;
public AbstractSpecial(Location position) protected AbstractSpecial(Location position)
{ {
this.startPosition = position; this.startPosition = position;
this.endPosition = position; this.endPosition = position;
} }
public AbstractSpecial(Location startPosition, Location endPosition) protected AbstractSpecial(Location startPosition, Location endPosition)
{ {
this.startPosition = startPosition; this.startPosition = startPosition;
this.endPosition = endPosition; this.endPosition = endPosition;

1
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

@ -250,6 +250,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
return Char.ToUpper((char)ReaderPeek(), CultureInfo.InvariantCulture); return Char.ToUpper((char)ReaderPeek(), CultureInfo.InvariantCulture);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1818:DoNotConcatenateStringsInsideLoops")]
Token ReadDigit(char ch, int x) Token ReadDigit(char ch, int x)
{ {
sb.Length = 0; sb.Length = 0;

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

@ -469,15 +469,15 @@ namespace ICSharpCode.NRefactory.Parser
} }
#region Expressions #region Expressions
public override object Visit(PrimitiveExpression expression, object data) public override object Visit(PrimitiveExpression primitiveExpression, object data)
{ {
return new CodePrimitiveExpression(expression.Value); return new CodePrimitiveExpression(primitiveExpression.Value);
} }
public override object Visit(BinaryOperatorExpression expression, object data) public override object Visit(BinaryOperatorExpression binaryOperatorExpression, object data)
{ {
CodeBinaryOperatorType op = CodeBinaryOperatorType.Add; CodeBinaryOperatorType op = CodeBinaryOperatorType.Add;
switch (expression.Op) { switch (binaryOperatorExpression.Op) {
case BinaryOperatorType.Add: case BinaryOperatorType.Add:
op = CodeBinaryOperatorType.Add; op = CodeBinaryOperatorType.Add;
break; break;
@ -544,14 +544,14 @@ namespace ICSharpCode.NRefactory.Parser
op = CodeBinaryOperatorType.BitwiseAnd; op = CodeBinaryOperatorType.BitwiseAnd;
break; break;
} }
return new CodeBinaryOperatorExpression((CodeExpression)expression.Left.AcceptVisitor(this, data), return new CodeBinaryOperatorExpression((CodeExpression)binaryOperatorExpression.Left.AcceptVisitor(this, data),
op, op,
(CodeExpression)expression.Right.AcceptVisitor(this, data)); (CodeExpression)binaryOperatorExpression.Right.AcceptVisitor(this, data));
} }
public override object Visit(ParenthesizedExpression expression, object data) public override object Visit(ParenthesizedExpression parenthesizedExpression, object data)
{ {
return expression.Expression.AcceptVisitor(this, data); return parenthesizedExpression.Expression.AcceptVisitor(this, data);
} }
public override object Visit(InvocationExpression invocationExpression, object data) public override object Visit(InvocationExpression invocationExpression, object data)
@ -586,12 +586,12 @@ namespace ICSharpCode.NRefactory.Parser
return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Arguments)); return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Arguments));
} }
public override object Visit(IdentifierExpression expression, object data) public override object Visit(IdentifierExpression identifierExpression, object data)
{ {
if (!IsLocalVariable(expression.Identifier) && IsField(expression.Identifier)) { if (!IsLocalVariable(identifierExpression.Identifier) && IsField(identifierExpression.Identifier)) {
return new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), expression.Identifier); return new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), identifierExpression.Identifier);
} }
return new CodeVariableReferenceExpression(expression.Identifier); return new CodeVariableReferenceExpression(identifierExpression.Identifier);
} }
public override object Visit(UnaryOperatorExpression unaryOperatorExpression, object data) public override object Visit(UnaryOperatorExpression unaryOperatorExpression, object data)
@ -860,7 +860,6 @@ namespace ICSharpCode.NRefactory.Parser
static CodeTypeReferenceExpression ConvertToTypeReference(FieldReferenceExpression fieldReferenceExpression) static CodeTypeReferenceExpression ConvertToTypeReference(FieldReferenceExpression fieldReferenceExpression)
{ {
FieldReferenceExpression primaryReferenceExpression = fieldReferenceExpression;
StringBuilder type = new StringBuilder(""); StringBuilder type = new StringBuilder("");
while (fieldReferenceExpression.TargetObject is FieldReferenceExpression) { while (fieldReferenceExpression.TargetObject is FieldReferenceExpression) {

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

@ -171,11 +171,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
} }
} }
public object Visit(InnerClassTypeReference typeReference, object data) public object Visit(InnerClassTypeReference innerClassTypeReference, object data)
{ {
nodeTracker.TrackedVisit(typeReference.BaseType, data); nodeTracker.TrackedVisit(innerClassTypeReference.BaseType, data);
outputFormatter.PrintToken(Tokens.Dot); outputFormatter.PrintToken(Tokens.Dot);
return Visit((TypeReference)typeReference, data); // call Visit(TypeReference, object) return Visit((TypeReference)innerClassTypeReference, data); // call Visit(TypeReference, object)
} }
#region Global scope #region Global scope
@ -183,7 +183,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{ {
outputFormatter.Indent(); outputFormatter.Indent();
outputFormatter.PrintText("<"); outputFormatter.PrintText("<");
if (attributeSection.AttributeTarget != null && attributeSection.AttributeTarget != String.Empty) { if (attributeSection.AttributeTarget != null && attributeSection.AttributeTarget.Length > 0) {
outputFormatter.PrintIdentifier(attributeSection.AttributeTarget); outputFormatter.PrintIdentifier(attributeSection.AttributeTarget);
outputFormatter.PrintToken(Tokens.Colon); outputFormatter.PrintToken(Tokens.Colon);
outputFormatter.Space(); outputFormatter.Space();

1
src/Libraries/NRefactory/Project/Src/Parser/AbstractParser.cs

@ -13,6 +13,7 @@ namespace ICSharpCode.NRefactory.Parser
/// <summary> /// <summary>
/// Description of AbstractParser. /// Description of AbstractParser.
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1708:IdentifiersShouldDifferByMoreThanCase")]
public abstract class AbstractParser : IParser public abstract class AbstractParser : IParser
{ {
protected const int minErrDist = 2; protected const int minErrDist = 2;

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

@ -6275,4 +6275,4 @@ out blockStmt);
}; };
} // end Parser } // end Parser
} }

4
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -872,7 +872,9 @@ namespace ICSharpCode.Core
firstMethod = m; firstMethod = m;
} }
} }
return firstMethod; if (firstMethod != null)
return firstMethod;
return curClass.SearchMember(memberName, LanguageProperties.CSharp);
} }
} }
} }

BIN
src/Main/StartUp/Project/Resources/BitmapResources.resources

Binary file not shown.
Loading…
Cancel
Save