This commit is contained in:
Бондарев Иван 2017-11-27 21:01:49 +01:00
parent a817e9d4a7
commit efa9bdc366
3 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,5 @@
begin
var l := Lst(1,2,3);
l.Reverse();
assert(l[0]=3);
end.

View file

@ -527,6 +527,14 @@ namespace PascalABCCompiler.TreeConverter
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)
{
if (list != null)

View file

@ -5284,6 +5284,19 @@ namespace PascalABCCompiler.TreeConverter
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)
{