fix #1880 - само исправилось
This commit is contained in:
parent
673f9bc149
commit
f601f8af3d
20
TestSuite/lambda_capture_GenClassInheritance.pas
Normal file
20
TestSuite/lambda_capture_GenClassInheritance.pas
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
type
|
||||||
|
t0<T> = class end;
|
||||||
|
|
||||||
|
t1 = class(t0<word>)
|
||||||
|
|
||||||
|
public procedure p1;
|
||||||
|
begin
|
||||||
|
var b: byte;
|
||||||
|
|
||||||
|
var p: procedure := ()->
|
||||||
|
begin
|
||||||
|
b += 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
@ -747,7 +747,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
||||||
|
|
||||||
public override void visit(PascalABCCompiler.SyntaxTree.goto_statement _goto_statement)
|
public override void visit(PascalABCCompiler.SyntaxTree.goto_statement _goto_statement)
|
||||||
{
|
{
|
||||||
if (_goto_statement.source_context != null)
|
if (_goto_statement.source_context != null) // видимо, это сделано для того чтобы сахарные конструкции всё же можно было использовать с лямбдами. То есть, это какое-то искусственное ограничение
|
||||||
_visitor.AddError(_visitor.get_location(_goto_statement), "GOTO_AND_LAMBDAS_NOT_ALLOWED");
|
_visitor.AddError(_visitor.get_location(_goto_statement), "GOTO_AND_LAMBDAS_NOT_ALLOWED");
|
||||||
else
|
else
|
||||||
base.visit(_goto_statement);
|
base.visit(_goto_statement);
|
||||||
|
|
|
||||||
|
|
@ -2743,7 +2743,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
while (context._cmn.functions.Count > 0 && context._cmn.functions[context._cmn.functions.Count-1].function_code == null && context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda") && !context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda_initializer"))
|
while (context._cmn.functions.Count > 0 && context._cmn.functions[context._cmn.functions.Count-1].function_code == null && context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda") && !context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda_initializer"))
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
System.IO.File.AppendAllText("aa.txt", context._cmn.functions[context._cmn.functions.Count - 1].name+"\n");
|
//System.IO.File.AppendAllText("aa.txt", context._cmn.functions[context._cmn.functions.Count - 1].name+"\n");
|
||||||
#endif
|
#endif
|
||||||
context._cmn.functions.remove_at(context._cmn.functions.Count - 1);
|
context._cmn.functions.remove_at(context._cmn.functions.Count - 1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue