Yield helper methods remove speedup
This commit is contained in:
parent
0801ab860c
commit
8b6fbc3edf
|
|
@ -557,6 +557,10 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
public partial class procedure_definition
|
||||
{
|
||||
public bool has_yield = false;
|
||||
// frninja 20/05/16 - для методов хелперов yield
|
||||
public bool is_yield_helper = false;
|
||||
// end frninja
|
||||
|
||||
public procedure_definition(procedure_header proc_header, proc_block proc_body, SourceContext sc)
|
||||
{
|
||||
this.proc_header = proc_header;
|
||||
|
|
|
|||
|
|
@ -3699,6 +3699,13 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
if (cmn != null)
|
||||
{
|
||||
// frninja 20/05/16 - ставим флаг is_yield_helper
|
||||
if (sd is SyntaxTree.procedure_definition)
|
||||
{
|
||||
cmn.is_yield_helper = (sd as SyntaxTree.procedure_definition).is_yield_helper;
|
||||
}
|
||||
// end frninja
|
||||
|
||||
context.push_function(cmn);
|
||||
if (!cmn.IsStatic)
|
||||
{
|
||||
|
|
@ -9645,7 +9652,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
// frninja 28/04/16 - режем мусорные методы хелперы yield
|
||||
{
|
||||
var toRemove = cnsn.functions.Where(m => m.name.StartsWith(YieldHelpers.YieldConsts.YieldHelperMethodPrefix)).ToArray();
|
||||
var toRemove = cnsn.functions.Where(m => m.is_yield_helper).ToArray();
|
||||
foreach (var m in toRemove)
|
||||
{
|
||||
cnsn.functions.remove(m);
|
||||
|
|
@ -10345,7 +10352,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
// frninja 28/04/16 - режем мусорные методы хелперы yield
|
||||
{
|
||||
var toRemove = ctn.methods.Where(m => m.name.StartsWith(YieldHelpers.YieldConsts.YieldHelperMethodPrefix)).ToArray();
|
||||
var toRemove = ctn.methods.Where(m => m.is_yield_helper).ToArray();
|
||||
foreach (var m in toRemove)
|
||||
{
|
||||
ctn.methods.remove(m);
|
||||
|
|
@ -11246,6 +11253,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// frninja 20/05/16 - ставим флаг is_yield_helper
|
||||
if (context.top_function is common_namespace_function_node)
|
||||
{
|
||||
(context.top_function as common_namespace_function_node).is_yield_helper = _procedure_definition.is_yield_helper;
|
||||
}
|
||||
// end frninja
|
||||
|
||||
if (context.converted_explicit_interface_type != null)
|
||||
(context.top_function as common_method_node).explicit_interface = context.converted_explicit_interface_type;
|
||||
if (has_dll_import_attribute(context.top_function))
|
||||
|
|
|
|||
|
|
@ -1086,6 +1086,22 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public type_node ConnectedToType = null;
|
||||
|
||||
// frninja 20/05/16
|
||||
private bool _is_yield_helper = false;
|
||||
|
||||
public bool is_yield_helper
|
||||
{
|
||||
get
|
||||
{
|
||||
return _is_yield_helper;
|
||||
}
|
||||
set
|
||||
{
|
||||
_is_yield_helper = value;
|
||||
}
|
||||
}
|
||||
// end frninja
|
||||
|
||||
public override bool is_extension_method
|
||||
{
|
||||
get
|
||||
|
|
@ -1325,6 +1341,24 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
}
|
||||
|
||||
// frninja 20/05/16
|
||||
|
||||
private bool _is_yield_helper = false;
|
||||
|
||||
public bool is_yield_helper
|
||||
{
|
||||
get
|
||||
{
|
||||
return _is_yield_helper;
|
||||
}
|
||||
set
|
||||
{
|
||||
_is_yield_helper = value;
|
||||
}
|
||||
}
|
||||
// end frninja
|
||||
|
||||
|
||||
public override bool is_final
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -471,6 +471,8 @@ namespace SyntaxVisitors
|
|||
|
||||
// Добавляем в класс метод с обертками для локальных переменных
|
||||
pdCloned.proc_header.name.meth_name = new ident(YieldConsts.YieldHelperMethodPrefix+ "_locals_type_detector>" + pd.proc_header.name.meth_name.name); // = new method_name("<yield_helper_locals_type_detector>" + pd.proc_header.className.meth_name.className);
|
||||
pdCloned.is_yield_helper = true;
|
||||
|
||||
if (IsClassMethod(pd))
|
||||
{
|
||||
var cd = UpperTo<class_definition>();
|
||||
|
|
@ -770,7 +772,8 @@ namespace SyntaxVisitors
|
|||
// Вставляем классы-хелперы
|
||||
InsertYieldHelpers(pd, cct);
|
||||
|
||||
|
||||
// frninja 20/05/16 - фикс для повторного обхода
|
||||
pd.has_yield = false;
|
||||
|
||||
//mids = null; // вдруг мы выйдем из процедуры, не зайдем в другую, а там - оператор! Такого конечно не может быть
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue