Browse Source

Update to Boo 0.7.6.2175, adapted NRefactoryToBooConverter.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1225 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
cc81b04a03
  1. 3
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 4
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs
  3. 7
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorTypeMembers.cs
  4. 2
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs
  5. 10
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs
  6. 5
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs

3
AddIns/ICSharpCode.SharpDevelop.addin

@ -631,12 +631,11 @@ @@ -631,12 +631,11 @@
</Path>
<Path name = "/SharpDevelop/Pads/CompilerMessageView/ContextMenu">
<Include id = "Cut" item = "/SharpDevelop/Workbench/MainMenu/Edit/Cut"/>
<Include id = "Copy" item = "/SharpDevelop/Workbench/MainMenu/Edit/Copy"/>
<Include id = "SelectAll" item = "/SharpDevelop/Workbench/MainMenu/Edit/SelectAll"/>
<MenuItem id = "Clear"
icon = "OutputPad.Toolbar.ClearOutputWindow"
label = "Clear All"
label = "${res:MainWindow.Windows.CompilerMessageView.ClearAllButton.ToolTip}"
class = "ICSharpCode.SharpDevelop.Gui.ClearOutputWindow"/>
</Path>

4
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs

@ -146,9 +146,7 @@ namespace NRefactoryToBooConverter @@ -146,9 +146,7 @@ namespace NRefactoryToBooConverter
if ((m & Modifier.Default) != 0) {
ParametrizedNode parametrizedNode = node as ParametrizedNode;
string name = null;
if (node is IndexerDeclaration) {
name = DefaultIndexerName;
} else if (parametrizedNode != null) {
if (parametrizedNode != null) {
name = parametrizedNode.Name;
} else {
AddError(node, "Default modifier is not supported on this member.");

7
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorTypeMembers.cs

@ -213,13 +213,10 @@ namespace NRefactoryToBooConverter @@ -213,13 +213,10 @@ namespace NRefactoryToBooConverter
return m;
}
public const string DefaultIndexerName = "Indexer";
public object Visit(IndexerDeclaration indexerDeclaration, object data)
{
indexerDeclaration.Modifier |= Modifier.Default;
B.Property m = new B.Property(GetLexicalInfo(indexerDeclaration));
m.Modifiers = ConvertModifier(indexerDeclaration, B.TypeMemberModifiers.Private);
ConvertAttributes(indexerDeclaration.Attributes, m.Attributes);
if (currentType != null) currentType.Members.Add(m);
@ -228,7 +225,7 @@ namespace NRefactoryToBooConverter @@ -228,7 +225,7 @@ namespace NRefactoryToBooConverter
m.Type = ConvertTypeReference(indexerDeclaration.TypeReference);
m.Name = "this";
m.ExplicitInfo = ConvertInterfaceImplementations(indexerDeclaration.InterfaceImplementations, indexerDeclaration, m);
m.Name = DefaultIndexerName;
m.Name = "self";
if (!indexerDeclaration.IsWriteOnly) {
m.Getter = new B.Method(GetLexicalInfo(indexerDeclaration.GetRegion));
if (indexerDeclaration.GetRegion != null) {

2
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs

@ -220,7 +220,7 @@ namespace NRefactoryToBooConverter.Tests @@ -220,7 +220,7 @@ namespace NRefactoryToBooConverter.Tests
[Test]
public void CreateArrayWithOneElement()
{
TestExpr("new int[] { 1 }", "(of System.Int32: 1,)");
TestExpr("new int[] { 1 }", "(of System.Int32: 1)");
}
[Test]

10
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs

@ -217,26 +217,26 @@ namespace NRefactoryToBooConverter.Tests @@ -217,26 +217,26 @@ namespace NRefactoryToBooConverter.Tests
[Test]
public void ReadOnlyIndexer()
{
TestInClassWithIndexer("public string this[int index] { get { } }", "public Indexer(index as System.Int32) as System.String:\n\tget:\n\t\tpass");
TestInClass("public string this[int index] { get { } }", "public self[index as System.Int32] as System.String:\n\tget:\n\t\tpass");
}
[Test]
public void WriteOnlyIndexer()
{
TestInClassWithIndexer("public string this[int index] { set { } }", "public Indexer(index as System.Int32) as System.String:\n\tset:\n\t\tpass");
TestInClass("public string this[int index] { set { } }", "public self[index as System.Int32] as System.String:\n\tset:\n\t\tpass");
}
[Test]
public void Indexer()
{
TestInClassWithIndexer("public string this[int index] { get {} set { } }", "public Indexer(index as System.Int32) as System.String:\n\tget:\n\t\tpass\n\tset:\n\t\tpass");
TestInClass("public string this[int index] { get {} set { } }", "public self[index as System.Int32] as System.String:\n\tget:\n\t\tpass\n\tset:\n\t\tpass");
}
[Test]
public void IndexerWithAttributes()
{
TestInClassWithIndexer("[AA] public string this[int index] { [BB] get {} [CC] set { } }",
"[AA]\npublic Indexer(index as System.Int32) as System.String:\n\t[BB]\n\tget:\n\t\tpass\n\t[CC]\n\tset:\n\t\tpass");
TestInClass("[AA] public string this[int index] { [BB] get {} [CC] set { } }",
"[AA]\npublic self[index as System.Int32] as System.String:\n\t[BB]\n\tget:\n\t\tpass\n\t[CC]\n\tset:\n\t\tpass");
}
[Test]

5
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs

@ -75,11 +75,6 @@ namespace NRefactoryToBooConverter.Tests @@ -75,11 +75,6 @@ namespace NRefactoryToBooConverter.Tests
TestVB("Public Class ClassName\n" + input + "\nEnd Class\n", "public class ClassName:\n\t" + output.Replace("\n", "\n\t"));
}
protected void TestInClassWithIndexer(string input, string output)
{
Test("public class ClassName {\n" + input + "\n}", "[System.Reflection.DefaultMember('Indexer')]\npublic class ClassName:\n\t" + output.Replace("\n", "\n\t"));
}
protected void TestStatement(string input, string output)
{
ConverterSettings dummySet = new ConverterSettings("dummy.cs");

Loading…
Cancel
Save