fix #791
This commit is contained in:
parent
3b9320ab96
commit
7648ffa735
10
TestSuite/lambdas_closures_16.pas
Normal file
10
TestSuite/lambdas_closures_16.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
procedure p1(self: string);
|
||||
begin
|
||||
var p: procedure := procedure->self[1] := self[2];
|
||||
p;
|
||||
assert(self = 'bbc');
|
||||
end;
|
||||
|
||||
begin
|
||||
p1('abc');
|
||||
end.
|
||||
|
|
@ -3914,9 +3914,18 @@ namespace PascalABCCompiler.TreeConverter
|
|||
type_node self_type = cmn.cont_type;
|
||||
if (cmn.cont_type.is_generic_type_definition)
|
||||
self_type = cmn.cont_type.get_instance(cmn.cont_type.generic_params.ConvertAll<type_node>(o => (type_node)o));// new generic_instance_type_node(self_type, self_type.generic_params.ConvertAll<type_node>(o => (type_node)o), self_type.base_type, self_type.name, self_type.type_access_level, self_type.comprehensive_namespace, self_type.loc);
|
||||
local_variable lv = new local_variable(compiler_string_consts.self_word, self_type, cmn, null);
|
||||
cmn.scope.AddSymbol(compiler_string_consts.self_word, new SymbolInfo(lv));
|
||||
cmn.self_variable = lv;
|
||||
if (!(cmn.is_constructor && cmn.cont_type.name.StartsWith("<>local_variables_class")))
|
||||
{
|
||||
local_variable lv = new local_variable(compiler_string_consts.self_word, self_type, cmn, null);
|
||||
cmn.scope.AddSymbol(compiler_string_consts.self_word, new SymbolInfo(lv));
|
||||
cmn.self_variable = lv;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_variable lv = new local_variable(compiler_string_consts.self_word+"$", self_type, cmn, null);
|
||||
cmn.scope.AddSymbol(compiler_string_consts.self_word+"$", new SymbolInfo(lv));
|
||||
cmn.self_variable = lv;
|
||||
}
|
||||
}
|
||||
if ((sd as SyntaxTree.procedure_definition).proc_body != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -471,16 +471,6 @@ namespace PascalABCCompiler.TreeRealization
|
|||
public override List<SymbolInfo> findOnlyInNamespace(string name)
|
||||
{
|
||||
List<SymbolInfo> si_list = _scope.FindOnlyInScope(name);//c,cc,c,cc
|
||||
/*if (_scope is SymbolTable.UnitImplementationScope)
|
||||
{
|
||||
List<SymbolInfo> si_list2 = _scope.TopScope.FindOnlyInScope(name);
|
||||
if (si_list == null)
|
||||
return si_list2;
|
||||
if (si_list2 == null)
|
||||
return si_list;
|
||||
si_list.AddRange(si_list2);
|
||||
return si_list;
|
||||
}*/
|
||||
return si_list;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue