diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index e6cba9556..3338c6c1d 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -1610,13 +1610,26 @@ namespace CodeCompletion public override bool IsEqual(SymScope ts) { - /*ElementScope es = ts as ElementScope; + + if (this == ts) + return true; + if (this.Name != ts.Name) + return false; + + ElementScope es = ts as ElementScope; if (es == null) return false; - if (this.ElemKind != es.ElemKind || this.param_kind != es.param_kind) + if (this.sc != es.sc) return false; - return sc.IsEqual(es.sc);*/ - return this == ts; + if (this.si.kind != SymbolKind.Parameter || ts.si.kind != SymbolKind.Parameter) + return false; + ProcScope ps1 = this.topScope as ProcScope; + ProcScope ps2 = es.topScope as ProcScope; + if (ps1 == null || ps2 == null) + return false; + if (ps1 == ps2 || ps1 is ProcRealization && (ps1 as ProcRealization).def_proc == ps2 || ps1.procRealization == ps2) + return true; + return false; } public override string ToString() diff --git a/TestSuite/refactoring_tests/rename_tests/interface_function1.pas b/TestSuite/refactoring_tests/rename_tests/interface_function1.pas new file mode 100644 index 000000000..9acfce113 --- /dev/null +++ b/TestSuite/refactoring_tests/rename_tests/interface_function1.pas @@ -0,0 +1,20 @@ +unit interface_function1; + +interface + +procedure {@}p1(a: byte); +procedure {!}p1(a: byte; b: real); + +implementation + +procedure {!}p1(a: byte); +begin + +end; + +procedure {!}p1(a: byte; b: real); +begin + {!}p1(2); +end; + +end. \ No newline at end of file diff --git a/TestSuite/refactoring_tests/rename_tests/interface_parameter.pas b/TestSuite/refactoring_tests/rename_tests/interface_parameter.pas new file mode 100644 index 000000000..1d5c57525 --- /dev/null +++ b/TestSuite/refactoring_tests/rename_tests/interface_parameter.pas @@ -0,0 +1,14 @@ +unit interface_parameter; + +interface + +procedure p1({@}a: byte); + +implementation + +procedure p1({!}a: byte); +begin + +end; + +end. \ No newline at end of file diff --git a/TestSuite/refactoring_tests/rename_tests/interface_parameter2.pas b/TestSuite/refactoring_tests/rename_tests/interface_parameter2.pas new file mode 100644 index 000000000..1d41aeadd --- /dev/null +++ b/TestSuite/refactoring_tests/rename_tests/interface_parameter2.pas @@ -0,0 +1,20 @@ +unit interface_parameter2; + +interface + +procedure p1({@}a: byte); +procedure p1(a: byte; b: real); + +implementation + +procedure p1({!}a: byte); +begin + +end; + +procedure p1(a: byte; b: real); +begin + +end; + +end. \ No newline at end of file diff --git a/VisualPlugins/CompilerController/CompilerInformation.Designer.cs b/VisualPlugins/CompilerController/CompilerInformation.Designer.cs index 73f500351..67099358a 100644 --- a/VisualPlugins/CompilerController/CompilerInformation.Designer.cs +++ b/VisualPlugins/CompilerController/CompilerInformation.Designer.cs @@ -50,6 +50,7 @@ this.button2 = new System.Windows.Forms.Button(); this.cbRunMono = new System.Windows.Forms.CheckBox(); this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PluginImage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.RunILDASMImage)).BeginInit(); @@ -70,7 +71,7 @@ // this.groupBox1.Controls.Add(this.CompilerConsole); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.groupBox1.Location = new System.Drawing.Point(0, 382); + this.groupBox1.Location = new System.Drawing.Point(0, 417); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(379, 216); this.groupBox1.TabIndex = 1; @@ -292,11 +293,22 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // + // button4 + // + this.button4.Location = new System.Drawing.Point(12, 378); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(112, 22); + this.button4.TabIndex = 21; + this.button4.Text = "Test rename"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.Button4_Click); + // // CompilerInformation // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(379, 598); + this.ClientSize = new System.Drawing.Size(379, 633); + this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.cbRunMono); this.Controls.Add(this.button2); @@ -324,10 +336,10 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FORMNAME"; this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CompilerInformation_FormClosing); + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.CompilerInformation_FormClosed); this.Load += new System.EventHandler(this.CompilerInformation_Load); this.Shown += new System.EventHandler(this.CompilerInformation_Shown); - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.CompilerInformation_FormClosed); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CompilerInformation_FormClosing); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PluginImage)).EndInit(); @@ -362,5 +374,6 @@ private System.Windows.Forms.CheckBox cbNotUseRemoteCompiler; public System.Windows.Forms.CheckBox cbRunMono; private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; } } diff --git a/VisualPlugins/CompilerController/CompilerInformation.cs b/VisualPlugins/CompilerController/CompilerInformation.cs index 1fb0be7b3..68bf92ca8 100644 --- a/VisualPlugins/CompilerController/CompilerInformation.cs +++ b/VisualPlugins/CompilerController/CompilerInformation.cs @@ -232,9 +232,9 @@ namespace VisualPascalABCPlugins void Button2Click(object sender, EventArgs e) { CodeCompletion.CodeCompletionTester.Test(); - CodeCompletion.CodeCompletionTester.TestRename(@"c:\Work\Miks\_PABCNETGitHub\TestSuite\refactoring_tests\rename_tests"); - CodeCompletion.CodeCompletionTester.TestIntellisense(Path.Combine(@"c:\Work\Miks\_PABCNETGitHub\TestSuite", "intellisense_tests")); + CodeCompletion.CodeCompletionTester.TestIntellisense(Path.Combine(@"c:\Work\Miks\_PABCNETGitHub\TestSuite", "intellisense_tests")); + CodeCompletion.CodeCompletionTester.TestRename(@"c:\Work\Miks\_PABCNETGitHub\TestSuite\refactoring_tests\rename_tests"); MessageBox.Show("Done"); } @@ -249,5 +249,10 @@ namespace VisualPascalABCPlugins CodeCompletion.FormatterTester.Test(); MessageBox.Show("Done"); } + + private void Button4_Click(object sender, EventArgs e) + { + CodeCompletion.CodeCompletionTester.TestRename(@"c:\Work\Miks\_PABCNETGitHub\TestSuite\refactoring_tests\rename_tests"); + } } } diff --git a/VisualPlugins/CompilerController/CompilerInformation.resx b/VisualPlugins/CompilerController/CompilerInformation.resx index 23277f93f..9fca14405 100644 --- a/VisualPlugins/CompilerController/CompilerInformation.resx +++ b/VisualPlugins/CompilerController/CompilerInformation.resx @@ -112,12 +112,12 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Qk3WAgAAAAAAADYAAAAoAAAAEAAAAA4AAAABABgAAAAAAAAAAAASCwAAEgsAAAAAAAAAAAAA/wD//wD/