public DisposeMethod(IteratorStorey host) : base(host, TypeManager.system_void_expr, Modifiers.PUBLIC, new MemberName("Dispose", host.Location)) { host.AddMethod(this); Block = new ToplevelBlock(host.Iterator.Container, Parameters.EmptyReadOnlyParameters, Location); Block.AddStatement(new DisposeMethodStatement(host.Iterator)); }
public static GetEnumeratorMethod Create(IteratorStorey host, FullNamedExpression returnType, MemberName name, Statement statement) { var m = new GetEnumeratorMethod(host, returnType, name); var stmt = statement ?? new GetEnumeratorStatement(host, m); m.block.AddStatement(stmt); return(m); }
public DisposeMethod(IteratorStorey host) : base(host, null, new TypeExpression(host.Compiler.BuiltinTypes.Void, host.Location), Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN, new MemberName("Dispose", host.Location), ToplevelBlock.Flags.CompilerGenerated | ToplevelBlock.Flags.NoFlowAnalysis) { host.Members.Add(this); Block.AddStatement(new DisposeMethodStatement(host.Iterator)); }
public DisposeMethod(IteratorStorey host) : base(host, new TypeExpression(host.Compiler.BuiltinTypes.Void, host.Location), Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN, new MemberName("Dispose", host.Location)) { host.AddMethod(this); Block.AddStatement(new DisposeMethodStatement(host.Iterator)); }
public IteratorMethod(IteratorStorey host, FullNamedExpression returnType, Modifiers mod, MemberName name) : base(host, null, returnType, mod | Modifiers.COMPILER_GENERATED, name, ParametersCompiled.EmptyReadOnlyParameters, null) { this.host = host; Block = new ToplevelBlock(host.Compiler, ParametersCompiled.EmptyReadOnlyParameters, Location); }
public IteratorMethod(IteratorStorey host, FullNamedExpression returnType, int mod, MemberName name) : base(host, null, returnType, mod | Modifiers.DEBUGGER_HIDDEN | Modifiers.COMPILER_GENERATED, name, Parameters.EmptyReadOnlyParameters, null) { this.host = host; Block = new ToplevelBlock(host.Iterator.Container.Toplevel, Parameters.EmptyReadOnlyParameters, Location); }
// // Our constructor // private Iterator(CompilerContext ctx, IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable) : base(new ToplevelBlock (ctx, method.Block, ParametersCompiled.EmptyReadOnlyParameters, method.Block.StartLocation), TypeManager.bool_type, method.Location) { this.OriginalMethod = method; this.OriginalIteratorType = iterator_type; this.IsEnumerable = is_enumerable; this.Host = host; this.type = method.ReturnType; IteratorHost = Block.ChangeToIterator (this, method.Block); }
// // Our constructor // private Iterator(IMethodData method, TypeContainer host, Type iterator_type, bool is_enumerable) : base( new ToplevelBlock(method.Block, Parameters.EmptyReadOnlyParameters, method.Block.StartLocation), TypeManager.bool_type, method.Location) { this.OriginalMethod = method; this.OriginalIteratorType = iterator_type; this.IsEnumerable = is_enumerable; this.Host = host; IteratorHost = Block.ChangeToIterator(this, method.Block); }
protected override Expression DoResolve(ResolveContext ec) { IteratorHost = (IteratorStorey)block.TopBlock.AnonymousMethodStorey; BlockContext ctx = new BlockContext(ec, block, ReturnType); ctx.CurrentAnonymousMethod = this; ctx.StartFlowBranching(this, ec.CurrentBranching); Block.Resolve(ctx); ctx.EndFlowBranching(); var move_next = new IteratorMethod(IteratorHost, new TypeExpression(ec.BuiltinTypes.Bool, loc), Modifiers.PUBLIC, new MemberName("MoveNext", Location)); move_next.Block.AddStatement(new MoveNextMethodStatement(this)); IteratorHost.AddMethod(move_next); eclass = ExprClass.Value; return(this); }
public void WrapIntoIterator (IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable) { ParametersBlock pb = new ParametersBlock (this, ParametersCompiled.EmptyReadOnlyParameters, StartLocation); pb.EndLocation = EndLocation; pb.statements = statements; var iterator = new Iterator (pb, method, host, iterator_type, is_enumerable); am_storey = new IteratorStorey (iterator); statements = new List<Statement> (1); AddStatement (new Return (iterator, iterator.Location)); }
public GetEnumeratorMethod(IteratorStorey host, FullNamedExpression returnType, MemberName name) : base(host, returnType, Modifiers.DEBUGGER_HIDDEN, name) { Block.AddStatement(new GetEnumeratorStatement(host, this)); }
public DisposeMethod (IteratorStorey host) : base (host, new TypeExpression (TypeManager.void_type, host.Location), Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN, new MemberName ("Dispose", host.Location)) { host.AddMethod (this); Block.AddStatement (new DisposeMethodStatement (host.Iterator)); }
public GetEnumeratorStatement(IteratorStorey host, IteratorMethod host_method) { this.host = host; this.host_method = host_method; loc = host_method.Location; }
public static GetEnumeratorMethod Create(IteratorStorey host, FullNamedExpression returnType, MemberName name) { return(Create(host, returnType, name, null)); }
GetEnumeratorMethod(IteratorStorey host, FullNamedExpression returnType, MemberName name) : base(host, null, returnType, Modifiers.DEBUGGER_HIDDEN, name, ToplevelBlock.Flags.CompilerGenerated | ToplevelBlock.Flags.NoFlowAnalysis) { }
// // Reformats this block to be top-level iterator block // public IteratorStorey ChangeToIterator (Iterator iterator, ToplevelBlock source) { IsIterator = true; // Creates block with original statements AddStatement (new IteratorStatement (iterator, new Block (this, source))); source.statements = new List<Statement> (1); source.AddStatement (new Return (iterator, iterator.Location)); source.IsIterator = false; IteratorStorey iterator_storey = new IteratorStorey (iterator); source.am_storey = iterator_storey; return iterator_storey; }
GetEnumeratorMethod(IteratorStorey host, FullNamedExpression returnType, MemberName name) : base(host, null, returnType, Modifiers.DEBUGGER_HIDDEN, name) { }
protected override Expression DoResolve (ResolveContext ec) { IteratorHost = (IteratorStorey) block.TopBlock.AnonymousMethodStorey; BlockContext ctx = new BlockContext (ec, block, ReturnType); ctx.CurrentAnonymousMethod = this; ctx.StartFlowBranching (this, ec.CurrentBranching); Block.Resolve (ctx); ctx.EndFlowBranching (); var move_next = new IteratorMethod (IteratorHost, new TypeExpression (TypeManager.bool_type, loc), Modifiers.PUBLIC, new MemberName ("MoveNext", Location)); move_next.Block.AddStatement (new MoveNextMethodStatement (this)); IteratorHost.AddMethod (move_next); eclass = ExprClass.Value; return this; }
public DisposeMethod(IteratorStorey host) : base(host, TypeManager.system_void_expr, Modifiers.PUBLIC, new MemberName ("Dispose", host.Location)) { host.AddMethod (this); Block = new ToplevelBlock (Compiler, host.Iterator.Container, ParametersCompiled.EmptyReadOnlyParameters, Location); Block.AddStatement (new DisposeMethodStatement (host.Iterator)); }
public GetEnumeratorMethod(IteratorStorey host, FullNamedExpression returnType, MemberName name) : base(host, returnType, 0, name) { Block.AddStatement (new GetEnumeratorStatement (host, this)); }
public IteratorMethod(IteratorStorey host, FullNamedExpression returnType, Modifiers mod, MemberName name) : base(host, null, returnType, mod | Modifiers.DEBUGGER_HIDDEN | Modifiers.COMPILER_GENERATED, name, ParametersCompiled.EmptyReadOnlyParameters, null) { this.host = host; Block = new ToplevelBlock (Compiler, host.Iterator.Container.Toplevel, ParametersCompiled.EmptyReadOnlyParameters, Location); }
// // Our constructor // private Iterator (IMethodData method, TypeContainer host, Type iterator_type, bool is_enumerable) : base ( new ToplevelBlock (method.Block, Parameters.EmptyReadOnlyParameters, method.Block.StartLocation), TypeManager.bool_type, method.Location) { this.OriginalMethod = method; this.OriginalIteratorType = iterator_type; this.IsEnumerable = is_enumerable; this.Host = host; IteratorHost = Block.ChangeToIterator (this, method.Block); }