Browse Source

Fixed SD2-512: Form Designer cannot load "Color.FromArgb" definitions

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@668 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
c7500d9f59
  1. 21
      src/AddIns/DisplayBindings/FormDesigner/Project/FormDesigner.csproj
  2. 17
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/NRefactoryDesignerLoader.cs
  3. 2
      src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin
  4. 15
      src/Libraries/NRefactory/Project/NRefactory.csproj
  5. 28
      src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs
  6. 16
      src/Libraries/NRefactory/Test/NRefactoryTests.csproj
  7. 16
      src/Libraries/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs
  8. 8
      src/Main/StartUp/Project/StartUp.csproj

21
src/AddIns/DisplayBindings/FormDesigner/Project/FormDesigner.csproj

@ -13,20 +13,23 @@ @@ -13,20 +13,23 @@
<RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.FormDesigner</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<Optimize>False</Optimize>
<DebugType>Full</DebugType>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<PlatformTarget>AnyCPU</PlatformTarget>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\FormDesigner\</OutputPath>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>True</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\FormDesigner\</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

17
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/NRefactoryDesignerLoader.cs

@ -119,6 +119,13 @@ namespace ICSharpCode.FormDesigner @@ -119,6 +119,13 @@ namespace ICSharpCode.FormDesigner
// Try to fix the type names to fully qualified ones
ParseInformation parseInfo = ParserService.GetParseInformation(textEditorControl.FileName);
#if DEBUG
if ((Control.ModifierKeys & (Keys.Alt | Keys.Control)) == (Keys.Alt | Keys.Control)) {
System.Diagnostics.Debugger.Break();
}
#endif
bool foundInitMethod = false;
FixTypeNames(p.CompilationUnit, parseInfo.BestCompilationUnit, ref foundInitMethod);
if (!foundInitMethod)
@ -128,9 +135,13 @@ namespace ICSharpCode.FormDesigner @@ -128,9 +135,13 @@ namespace ICSharpCode.FormDesigner
visitor.Visit(p.CompilationUnit, null);
// output generated CodeDOM to the console :
// CodeDOMVerboseOutputGenerator outputGenerator = new CodeDOMVerboseOutputGenerator();
// outputGenerator.GenerateCodeFromMember(visitor.codeCompileUnit.Namespaces[0].Types[0], Console.Out, null);
// provider.GenerateCodeFromCompileUnit(visitor.codeCompileUnit, Console.Out, null);
#if DEBUG
if ((Control.ModifierKeys & Keys.Control) == Keys.Control) {
CodeDOMVerboseOutputGenerator outputGenerator = new CodeDOMVerboseOutputGenerator();
outputGenerator.GenerateCodeFromMember(visitor.codeCompileUnit.Namespaces[0].Types[0], Console.Out, null);
provider.GenerateCodeFromCompileUnit(visitor.codeCompileUnit, Console.Out, null);
}
#endif
LoggingService.Debug("NRefactoryDesignerLoader.Parse() finished");
return visitor.codeCompileUnit;

2
src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "MbUnitPad"
category = "Tools"
title = "MbUnit Tests"
title = "Unit Tests"
icon = "PadIcons.MbUnitTest"
shortcut = "Control|Alt|T"
class = "ICSharpCode.MbUnitPad.MbUnitPadContent"/>

15
src/Libraries/NRefactory/Project/NRefactory.csproj

@ -17,23 +17,26 @@ @@ -17,23 +17,26 @@
<AssemblyOriginatorKeyFile>Resources\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<Optimize>False</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>TEST; DEBUG</DefineConstants>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TEST</DefineConstants>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
@ -204,4 +207,4 @@ @@ -204,4 +207,4 @@
<Folder Include="Src\Parser\AST\VBNet\Tests\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

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

@ -626,23 +626,15 @@ namespace ICSharpCode.NRefactory.Parser @@ -626,23 +626,15 @@ namespace ICSharpCode.NRefactory.Parser
targetExpr = new CodeThisReferenceExpression();
} else if (target is FieldReferenceExpression) {
FieldReferenceExpression fRef = (FieldReferenceExpression)target;
targetExpr = (CodeExpression)fRef.TargetObject.AcceptVisitor(this, data);
// Commented out because of SD2-428: Form designer does not load child controls in panels
//
// if (fRef.TargetObject is FieldReferenceExpression) {
// FieldReferenceExpression fRef2 = (FieldReferenceExpression)fRef.TargetObject;
// if (fRef2.FieldName != null && Char.IsUpper(fRef2.FieldName[0])) {
// // an exception is thrown if it doesn't end in an indentifier exception
// // for example for : this.MyObject.MyMethod() leads to an exception, which
// // is correct in this case ... I know this is really HACKY :)
// try {
// CodeExpression tExpr = ConvertToIdentifier(fRef2);
// if (tExpr != null) {
// targetExpr = tExpr;
// }
// } catch (Exception) {}
// }
// }
targetExpr = null;
if (fRef.TargetObject is FieldReferenceExpression) {
if (IsQualIdent((FieldReferenceExpression)fRef.TargetObject)) {
targetExpr = ConvertToIdentifier((FieldReferenceExpression)fRef.TargetObject);
}
}
if (targetExpr == null)
targetExpr = (CodeExpression)fRef.TargetObject.AcceptVisitor(this, data);
methodName = fRef.FieldName;
// HACK for : Microsoft.VisualBasic.ChrW(NUMBER)
if (methodName == "ChrW") {
@ -914,6 +906,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -914,6 +906,8 @@ namespace ICSharpCode.NRefactory.Parser
bool IsField(string identifier)
{
if (currentTypeDeclaration == null) // e.g. in unit tests
return false;
foreach (INode node in currentTypeDeclaration.Children) {
if (node is FieldDeclaration) {
FieldDeclaration fd = (FieldDeclaration)node;

16
src/Libraries/NRefactory/Test/NRefactoryTests.csproj

@ -12,22 +12,26 @@ @@ -12,22 +12,26 @@
<NoConfig>False</NoConfig>
<RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
<OutputType>Library</OutputType>
<OutputPath>..\..\..\..\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG</DefineConstants>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<Optimize>False</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />

16
src/Libraries/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs

@ -42,5 +42,21 @@ namespace ICSharpCode.NRefactory.Tests.Output.CodeDom.Tests @@ -42,5 +42,21 @@ namespace ICSharpCode.NRefactory.Tests.Output.CodeDom.Tests
Assert.AreEqual("InitializeComponents", mie.Method.MethodName);
Assert.IsTrue(mie.Method.TargetObject is CodeThisReferenceExpression);
}
[Test]
public void InvocationOfStaticMethod()
{
// System.Drawing.Color.FromArgb();
FieldReferenceExpression field = new FieldReferenceExpression(new IdentifierExpression("System"), "Drawing");
field = new FieldReferenceExpression(field, "Color");
field = new FieldReferenceExpression(field, "FromArgb");
InvocationExpression invocation = new InvocationExpression(field, new ArrayList());
object output = invocation.AcceptVisitor(new CodeDOMVisitor(), null);
Assert.IsTrue(output is CodeMethodInvokeExpression);
CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)output;
Assert.AreEqual("FromArgb", mie.Method.MethodName);
Assert.IsTrue(mie.Method.TargetObject is CodeTypeReferenceExpression);
Assert.AreEqual("System.Drawing.Color", (mie.Method.TargetObject as CodeTypeReferenceExpression).Type.BaseType);
}
}
}

8
src/Main/StartUp/Project/StartUp.csproj

@ -15,19 +15,21 @@ @@ -15,19 +15,21 @@
<PreBuildEvent>..\src\Tools\UpdateAssemblyInfo\bin\Debug\UpdateAssemblyInfo.exe StartupOnly</PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<DefineConstants>DEBUG</DefineConstants>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath>
<OutputType>Exe</OutputType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath>
<OutputType>WinExe</OutputType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -69,4 +71,4 @@ @@ -69,4 +71,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

Loading…
Cancel
Save