/// <summary> /// Creates a closure type in the closest appropriate scope. /// </summary> private TypeEntity createClosureType(Context ctx, Scope scope = null) { var cscope = findScope(s => s.Kind != ScopeKind.Unclosured, scope ?? this); if (cscope.ClosureType == null) { cscope.ClosureType = ctx.CreateType(ctx.Unique.ClosureName()); cscope.ClosureType.Kind = TypeEntityKind.Closure; } return(cscope.ClosureType); }
/// <summary> /// Creates a closure type for current closure. /// </summary> public void CreateClosureType(Context ctx) { var id = ctx.GetClosureId(); var closureName = string.Format(EntityNames.ClosureTypeNameTemplate, id); ClosureTypeId = id; ClosureType = ctx.CreateType(closureName, isSealed: true, prepare: true); ClosureType.Kind = TypeEntityKind.Closure; }