Example #1
0
File: Scope.cs Project: taekun/lens
        /// <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);
        }
Example #2
0
 /// <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;
 }