bug fix #568
This commit is contained in:
parent
a817e9d4a7
commit
efa9bdc366
5
TestSuite/extensionmethods25.pas
Normal file
5
TestSuite/extensionmethods25.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
begin
|
||||||
|
var l := Lst(1,2,3);
|
||||||
|
l.Reverse();
|
||||||
|
assert(l[0]=3);
|
||||||
|
end.
|
||||||
|
|
@ -527,6 +527,14 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasOnlyExtensionMethods()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < list.Count; ++i)
|
||||||
|
if (!(list[i].sym_info is function_node && (list[i].sym_info as function_node).is_extension_method))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void Insert(int index, SymbolInfo item)
|
public void Insert(int index, SymbolInfo item)
|
||||||
{
|
{
|
||||||
if (list != null)
|
if (list != null)
|
||||||
|
|
|
||||||
|
|
@ -5284,6 +5284,19 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
throw LastError();
|
throw LastError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (fn != null && skip_first_parameter && sil.Count() > 1 && !sil.HasOnlyExtensionMethods())
|
||||||
|
{
|
||||||
|
function_node tmp_fn = fn;
|
||||||
|
exprs.remove_at(0);
|
||||||
|
sil = tmp_sil;
|
||||||
|
fn = convertion_data_and_alghoritms.select_function(exprs, sil, subloc, syntax_nodes_parameters);
|
||||||
|
if (fn == null)
|
||||||
|
{
|
||||||
|
fn = tmp_fn;
|
||||||
|
RemoveLastError();
|
||||||
|
exprs.AddElementFirst(exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue