Fixed closure upvalue scoping
This commit is contained in:
@@ -13,11 +13,6 @@ uses
|
|||||||
Myc.Ast.Analyzer,
|
Myc.Ast.Analyzer,
|
||||||
Myc.Ast;
|
Myc.Ast;
|
||||||
|
|
||||||
//TODO Es gibt hier einen fundamentalen Fehler. Der Binder ist ist in einem Durchlauf nicht in der Lage, Upvalues zu erkennen.
|
|
||||||
// Wenn in TransformVariableDeclaration eine Variable definiert wird, ist sie grundsätzlich lokal, obwohl sie in einer nested lambda als upvalue benutzt werden könnte.
|
|
||||||
// Deshalb muss eigentlich zunächst ermittelt werden, wleche variablen später zur upvalue werden.
|
|
||||||
// Dafür ist Myc.Ast.Analyzer möglicherweise nützlich.
|
|
||||||
|
|
||||||
type
|
type
|
||||||
// The binder is a transformer that enriches the AST with semantic information
|
// The binder is a transformer that enriches the AST with semantic information
|
||||||
// like resolved addresses, scopes, and tail-call annotations.
|
// like resolved addresses, scopes, and tail-call annotations.
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Capture(const Address: TResolvedAddress): IValueCell;
|
function Capture(const Address: TResolvedAddress): IValueCell;
|
||||||
|
|
||||||
|
function GetNameID(const Name: String): Integer;
|
||||||
|
|
||||||
function CreateDescriptor: IScopeDescriptor;
|
function CreateDescriptor: IScopeDescriptor;
|
||||||
|
|
||||||
property Values[const Address: TResolvedAddress]: TDataValue read GetValues write SetValues; default;
|
property Values[const Address: TResolvedAddress]: TDataValue read GetValues write SetValues; default;
|
||||||
@@ -101,7 +103,6 @@ type
|
|||||||
|
|
||||||
procedure DumpScope(const ABuilder: TStringBuilder; AIndent: Integer);
|
procedure DumpScope(const ABuilder: TStringBuilder; AIndent: Integer);
|
||||||
procedure NeedNameToIndex;
|
procedure NeedNameToIndex;
|
||||||
function GetNameID(const Name: String): Integer;
|
|
||||||
function GetParent: IExecutionScope;
|
function GetParent: IExecutionScope;
|
||||||
function GetNameToIndex: TDictionary<Integer, Integer>;
|
function GetNameToIndex: TDictionary<Integer, Integer>;
|
||||||
function GetValues(const Address: TResolvedAddress): TDataValue;
|
function GetValues(const Address: TResolvedAddress): TDataValue;
|
||||||
@@ -110,6 +111,7 @@ type
|
|||||||
constructor Create(AParent: IExecutionScope; const ADescriptor: IScopeDescriptor; const ACapturedUpvalues: TArray<IValueCell>);
|
constructor Create(AParent: IExecutionScope; const ADescriptor: IScopeDescriptor; const ACapturedUpvalues: TArray<IValueCell>);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
|
function GetNameID(const Name: String): Integer;
|
||||||
function Dump: string;
|
function Dump: string;
|
||||||
procedure Define(const Name: string; const Value: TDataValue);
|
procedure Define(const Name: string; const Value: TDataValue);
|
||||||
procedure DefineBoxed(const Address: TResolvedAddress; const Value: TDataValue);
|
procedure DefineBoxed(const Address: TResolvedAddress; const Value: TDataValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user