bug fix #631
This commit is contained in:
parent
23c17a9e5a
commit
2d6dc82dda
|
|
@ -1005,7 +1005,7 @@ namespace CodeCompletion
|
|||
ps = new ProcScope(meth_name, topScope);
|
||||
ps.head_loc = loc;
|
||||
bool ext = false;
|
||||
if (topScope is CompiledScope || topScope is ArrayScope || topScope is TypeSynonim && ((topScope as TypeSynonim).actType is CompiledScope || (topScope as TypeSynonim).actType is ArrayScope || (topScope as TypeSynonim).actType is DiapasonScope))
|
||||
if (topScope is CompiledScope || topScope is ArrayScope || topScope is TypeSynonim /*&& ((topScope as TypeSynonim).actType is CompiledScope || (topScope as TypeSynonim).actType is ArrayScope || (topScope as TypeSynonim).actType is DiapasonScope)*/)
|
||||
ext = true;
|
||||
else if (!(topScope is TypeSynonim) && !(topScope is PointerScope) && !(topScope is SetScope) && !(topScope is FileScope))
|
||||
ext = true;
|
||||
|
|
@ -1019,7 +1019,7 @@ namespace CodeCompletion
|
|||
if (topScope is TypeSynonim)
|
||||
ts = (ts as TypeSynonim).actType;
|
||||
this.entry_scope.AddExtensionMethod(meth_name, ps, ts);
|
||||
topScope.AddExtensionMethod(meth_name, ps, ts);
|
||||
ts.AddExtensionMethod(meth_name, ps, ts);
|
||||
}
|
||||
}
|
||||
//while (ps != null && ps.already_defined) ps = ps.nextProc;
|
||||
|
|
@ -1307,7 +1307,7 @@ namespace CodeCompletion
|
|||
|
||||
ps.head_loc = loc;
|
||||
bool ext = false;
|
||||
if (topScope is CompiledScope || topScope is ArrayScope || topScope is TypeSynonim && ((topScope as TypeSynonim).actType is CompiledScope || (topScope as TypeSynonim).actType is ArrayScope || (topScope as TypeSynonim).actType is DiapasonScope))
|
||||
if (topScope is CompiledScope || topScope is ArrayScope || topScope is TypeSynonim /*&& ((topScope as TypeSynonim).actType is CompiledScope || (topScope as TypeSynonim).actType is ArrayScope || (topScope as TypeSynonim).actType is DiapasonScope)*/)
|
||||
ext = true;
|
||||
else if (!(topScope is TypeSynonim) && !(topScope is PointerScope) && !(topScope is SetScope) && !(topScope is FileScope))
|
||||
ext = true;
|
||||
|
|
@ -1321,7 +1321,7 @@ namespace CodeCompletion
|
|||
if (topScope is TypeSynonim)
|
||||
ts = (ts as TypeSynonim).actType;
|
||||
this.entry_scope.AddExtensionMethod(meth_name, ps, ts);
|
||||
topScope.AddExtensionMethod(meth_name, ps, ts);
|
||||
ts.AddExtensionMethod(meth_name, ps, ts);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -931,6 +931,11 @@ namespace CodeCompletion
|
|||
{
|
||||
for (int i = 0; i < good_procs.Count; i++)
|
||||
{
|
||||
if (good_procs[i].parameters.Count == 0)
|
||||
{
|
||||
ind = i;
|
||||
break;
|
||||
}
|
||||
TypeScope param_type = good_procs[i].parameters[0].sc as TypeScope;
|
||||
if (param_type.original_type != null)
|
||||
param_type = param_type.original_type;
|
||||
|
|
|
|||
|
|
@ -367,6 +367,8 @@ namespace CodeCompletion
|
|||
|
||||
public List<ProcScope> GetExtensionMethods(TypeScope ts)
|
||||
{
|
||||
if (ts is TypeSynonim)
|
||||
return GetExtensionMethods((ts as TypeSynonim).actType);
|
||||
List<ProcScope> lst = new List<ProcScope>();
|
||||
List<ProcScope> meths = null;
|
||||
TypeScope tmp_ts = ts;
|
||||
|
|
|
|||
37
TestSuite/intellisense_tests/extensionmethods5.pas
Normal file
37
TestSuite/intellisense_tests/extensionmethods5.pas
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
type TClass = class
|
||||
procedure Test2;
|
||||
end;
|
||||
|
||||
type TClass2 = TClass;
|
||||
|
||||
procedure TClass2.Test;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TClass2.Test3: integer;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TClass.Test2;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
type myarr = array of integer;
|
||||
|
||||
procedure MyProc(self: myarr); extensionmethod;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var o: TClass2;
|
||||
var o2: TClass;
|
||||
o.Test{@(расширение) procedure TClass2.Test();@}();
|
||||
o2.Test{@(расширение) procedure TClass2.Test();@}();
|
||||
o.Test3{@(расширение) function TClass2.Test3(): integer;@}();
|
||||
var arr1 := new integer[10];
|
||||
arr1.MyProc{@(расширение) procedure myarr.MyProc();@}();
|
||||
end.
|
||||
Loading…
Reference in a new issue