fix #1880 - само исправилось

This commit is contained in:
Mikhalkovich Stanislav 2019-06-19 00:47:35 +03:00
parent 673f9bc149
commit f601f8af3d
3 changed files with 22 additions and 2 deletions

View 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.

View file

@ -747,7 +747,7 @@ namespace TreeConverter.LambdaExpressions.Closure
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");
else
base.visit(_goto_statement);

View file

@ -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"))
{
#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
context._cmn.functions.remove_at(context._cmn.functions.Count - 1);