Browse Source

Fixed BOO-347 (BooBinding does not detect methods generated by AST Attributes)

Fixed bug when switching layout configurations.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@585 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
738f985f03
  1. 4
      src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj
  2. 1
      src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat
  3. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/AssemblyInfo.cs
  4. 3
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs
  5. 1
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooParser.cs
  6. 39
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs
  7. 10
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs
  8. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Templates/FormsProject.xpt
  9. 4
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Templates/Library.xpt
  10. 2
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/AssemblyInfo.cs
  11. 2
      src/AddIns/BackendBindings/Boo/StandaloneConverter/AssemblyInfo.cs
  12. 2
      src/Libraries/ICSharpCode.Build.Tasks/Test/AssemblyInfo.cs
  13. 2
      src/Main/Base/Project/Src/Dom/XmlDoc.cs
  14. 9
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

4
src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj

@ -55,6 +55,10 @@
<HintPath>..\..\RequiredLibraries\Boo.Lang.CodeDom.dll</HintPath> <HintPath>..\..\RequiredLibraries\Boo.Lang.CodeDom.dll</HintPath>
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
</Reference> </Reference>
<Reference Include="Boo.Lang.Useful">
<HintPath>..\..\RequiredLibraries\Boo.Lang.Useful.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Resources\Boo.xshd"> <EmbeddedResource Include="Resources\Boo.xshd">

1
src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat

@ -9,6 +9,5 @@ popd
:copyFiles :copyFiles
copy "%1\..\..\RequiredLibraries\booc.*" . copy "%1\..\..\RequiredLibraries\booc.*" .
copy "%1\..\..\RequiredLibraries\*.targets" . copy "%1\..\..\RequiredLibraries\*.targets" .
copy "%1\..\..\RequiredLibraries\Boo.Lang.Useful.dll" .
copy "%1\..\..\RequiredLibraries\Boo.Microsoft.Build.Tasks.dll" . copy "%1\..\..\RequiredLibraries\Boo.Microsoft.Build.Tasks.dll" .
:BooPostBuildEventEnd :BooPostBuildEventEnd

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/AssemblyInfo.cs

@ -1,4 +1,4 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>

3
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs

@ -57,8 +57,7 @@ namespace Grunwald.BooBinding
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(systemItem)); pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(systemItem));
ReferenceProjectItem booLangItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Builtins).Assembly.Location); ReferenceProjectItem booLangItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Builtins).Assembly.Location);
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(booLangItem)); pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(booLangItem));
string booDir = Path.GetDirectoryName(typeof(Boo.Lang.Builtins).Assembly.Location); ReferenceProjectItem booUsefulItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Useful.Attributes.SingletonAttribute).Assembly.Location);
ReferenceProjectItem booUsefulItem = new ReferenceProjectItem(this, Path.Combine(booDir, "Boo.Lang.Useful.dll"));
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(booUsefulItem)); pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(booUsefulItem));
pc.DefaultImports = new DefaultUsing(pc); pc.DefaultImports = new DefaultUsing(pc);
pc.DefaultImports.Usings.Add("Boo.Lang.Builtins"); pc.DefaultImports.Usings.Add("Boo.Lang.Builtins");

1
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooParser.cs

@ -109,6 +109,7 @@ namespace Grunwald.BooBinding.CodeCompletion
compilePipe.BreakOnErrors = false; compilePipe.BreakOnErrors = false;
compiler.Parameters.Pipeline = compilePipe; compiler.Parameters.Pipeline = compilePipe;
compiler.Parameters.References.Add(typeof(Boo.Lang.Useful.Attributes.SingletonAttribute).Assembly);
int errorCount = 0; int errorCount = 0;
compilePipe.AfterStep += delegate(object sender, CompilerStepEventArgs args) { compilePipe.AfterStep += delegate(object sender, CompilerStepEventArgs args) {

39
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs

@ -73,23 +73,41 @@ namespace Grunwald.BooBinding.CodeCompletion
return false; return false;
} }
this.cu = parseInfo.MostRecentCompilationUnit; this.cu = parseInfo.MostRecentCompilationUnit;
if (cu == null) {
return false;
}
this.pc = cu.ProjectContent; this.pc = cu.ProjectContent;
this.caretLine = caretLine; this.caretLine = caretLine;
this.caretColumn = caretColumn; this.caretColumn = caretColumn;
this.callingClass = cu.GetInnermostClass(caretLine, caretColumn); this.callingClass = GetCallingClass(pc);
callingMember = ResolveCurrentMember(callingClass);
if (callingMember == null) {
if (cu != parseInfo.BestCompilationUnit) {
IClass olderClass = GetCallingClass(parseInfo.BestCompilationUnit.ProjectContent);
if (olderClass != null && callingClass == null) {
this.callingClass = olderClass;
}
callingMember = ResolveCurrentMember(olderClass);
}
}
return true;
}
IClass GetCallingClass(IProjectContent pc)
{
IClass callingClass = cu.GetInnermostClass(caretLine, caretColumn);
if (callingClass == null) { if (callingClass == null) {
if (cu.Classes.Count == 0) return false; if (cu.Classes.Count == 0) return null;
callingClass = cu.Classes[cu.Classes.Count - 1]; callingClass = cu.Classes[cu.Classes.Count - 1];
if (!callingClass.Region.IsEmpty) { if (!callingClass.Region.IsEmpty) {
if (callingClass.Region.BeginLine > caretLine) if (callingClass.Region.BeginLine > caretLine)
return false; callingClass = null;
} }
} }
callingMember = ResolveCurrentMember(); return callingClass;
return true;
} }
IMember ResolveCurrentMember() IMember ResolveCurrentMember(IClass callingClass)
{ {
LoggingService.DebugFormatted("Getting current method... caretLine = {0}, caretColumn = {1}", caretLine, caretColumn); LoggingService.DebugFormatted("Getting current method... caretLine = {0}, caretColumn = {1}", caretLine, caretColumn);
if (callingClass == null) return null; if (callingClass == null) return null;
@ -120,7 +138,14 @@ namespace Grunwald.BooBinding.CodeCompletion
#region GetTypeOfExpression #region GetTypeOfExpression
public IReturnType GetTypeOfExpression(AST.Expression expr) public IReturnType GetTypeOfExpression(AST.Expression expr)
{ {
if (!Initialize(expr.LexicalInfo.FileName, expr.LexicalInfo.Line, expr.LexicalInfo.Column)) AST.Node node = expr;
AST.LexicalInfo lexInfo;
do {
if (node == null) return null;
lexInfo = node.LexicalInfo;
node = node.ParentNode;
} while (lexInfo == null || lexInfo.FileName == null);
if (!Initialize(lexInfo.FileName, lexInfo.Line, lexInfo.Column))
return null; return null;
ResolveVisitor visitor = new ResolveVisitor(this); ResolveVisitor visitor = new ResolveVisitor(this);
visitor.Visit(expr); visitor.Visit(expr);

10
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs

@ -162,10 +162,10 @@ namespace Grunwald.BooBinding.CodeCompletion
} }
} }
} }
if (callingClass == null) if (callingClass != null) {
return false;
if (ResolveMember(callingClass.DefaultReturnType, identifier)) if (ResolveMember(callingClass.DefaultReturnType, identifier))
return true; return true;
}
string namespaceName = projectContent.SearchNamespace(identifier, callingClass, cu, resolver.CaretLine, resolver.CaretColumn); string namespaceName = projectContent.SearchNamespace(identifier, callingClass, cu, resolver.CaretLine, resolver.CaretColumn);
if (namespaceName != null && namespaceName.Length > 0) { if (namespaceName != null && namespaceName.Length > 0) {
@ -488,11 +488,17 @@ namespace Grunwald.BooBinding.CodeCompletion
public override void OnSelfLiteralExpression(SelfLiteralExpression node) public override void OnSelfLiteralExpression(SelfLiteralExpression node)
{ {
if (callingClass == null)
resolveResult = null;
else
MakeResult(callingClass.DefaultReturnType); MakeResult(callingClass.DefaultReturnType);
} }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) public override void OnSuperLiteralExpression(SuperLiteralExpression node)
{ {
if (callingClass == null)
resolveResult = null;
else
MakeResult(callingClass.BaseType); MakeResult(callingClass.BaseType);
} }

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Templates/FormsProject.xpt

@ -86,7 +86,7 @@ import System.Runtime.CompilerServices
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")]
]]></File> ]]></File>
</Files> </Files>

4
src/AddIns/BackendBindings/Boo/BooBinding/Project/Templates/Library.xpt

@ -36,7 +36,7 @@ class MyClass:
def constructor(): def constructor():
pass pass
}]]></File> ]]></File>
<File name="AssemblyInfo.boo"> <File name="AssemblyInfo.boo">
<![CDATA[import System.Reflection <![CDATA[import System.Reflection
import System.Runtime.CompilerServices import System.Runtime.CompilerServices
@ -63,7 +63,7 @@ import System.Runtime.CompilerServices
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")]
]]></File> ]]></File>
</Files> </Files>

2
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/AssemblyInfo.cs

@ -1,4 +1,4 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>

2
src/AddIns/BackendBindings/Boo/StandaloneConverter/AssemblyInfo.cs

@ -1,4 +1,4 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>

2
src/Libraries/ICSharpCode.Build.Tasks/Test/AssemblyInfo.cs

@ -1,4 +1,4 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="none" email=""/> // <owner name="none" email=""/>

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

@ -68,6 +68,8 @@ namespace ICSharpCode.SharpDevelop.Dom
public string GetDocumentation(string key) public string GetDocumentation(string key)
{ {
if (xmlDescription == null)
throw new ObjectDisposedException("XmlDoc");
lock (xmlDescription) { lock (xmlDescription) {
string result; string result;
if (xmlDescription.TryGetValue(key, out result)) if (xmlDescription.TryGetValue(key, out result))

9
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

@ -113,6 +113,8 @@ namespace ICSharpCode.SharpDevelop.Gui
LoadLayoutConfiguration(); LoadLayoutConfiguration();
ShowPads(); ShowPads();
// ShowPads could create new pads if new addins have been installed, so we
// need to call AllowInitialize again
foreach (PadContentWrapper content in contentHash.Values) { foreach (PadContentWrapper content in contentHash.Values) {
content.AllowInitialize(); content.AllowInitialize();
} }
@ -187,6 +189,9 @@ namespace ICSharpCode.SharpDevelop.Gui
} catch { } catch {
// ignore errors loading configuration // ignore errors loading configuration
} }
foreach (PadContentWrapper content in contentHash.Values) {
content.AllowInitialize();
}
} }
void LoadDefaultLayoutConfiguration() void LoadDefaultLayoutConfiguration()
@ -378,6 +383,10 @@ namespace ICSharpCode.SharpDevelop.Gui
ActivateContent(); ActivateContent();
} }
/// <summary>
/// Enables initializing the content. This is used to prevent initializing all view
/// contents when the layout configuration is changed.
/// </summary>
public void AllowInitialize() public void AllowInitialize()
{ {
allowInitialize = true; allowInitialize = true;

Loading…
Cancel
Save