C# Class IronPython.Compiler.Ast.WithStatement

Inheritance: Statement
显示文件 Open project: jschementi/iron Class Usage Examples

Public Methods

Method Description
Reduce ( ) : Expression

WithStatement is translated to the DLR AST equivalent to the following Python code snippet (from with statement spec): mgr = (EXPR) exit = mgr.__exit__ # Not calling it yet value = mgr.__enter__() exc = True try: VAR = value # Only if "as VAR" is present BLOCK except: # The exceptional case is handled here exc = False if not exit(*sys.exc_info()): raise # The exception is swallowed if exit() returns true finally: # The normal and non-local-goto cases are handled here if exc: exit(None, None, None)

Walk ( IronPython.Compiler.Ast.PythonWalker walker ) : void
WithStatement ( Expression contextManager, Expression var, Statement body ) : System

Private Methods

Method Description
MakeExitCall ( System.Linq.Expressions exit, System.Linq.Expressions exception ) : Expression

Method Details

Reduce() public method

WithStatement is translated to the DLR AST equivalent to the following Python code snippet (from with statement spec): mgr = (EXPR) exit = mgr.__exit__ # Not calling it yet value = mgr.__enter__() exc = True try: VAR = value # Only if "as VAR" is present BLOCK except: # The exceptional case is handled here exc = False if not exit(*sys.exc_info()): raise # The exception is swallowed if exit() returns true finally: # The normal and non-local-goto cases are handled here if exc: exit(None, None, None)
public Reduce ( ) : Expression
return System.Linq.Expressions.Expression

Walk() public method

public Walk ( IronPython.Compiler.Ast.PythonWalker walker ) : void
walker IronPython.Compiler.Ast.PythonWalker
return void

WithStatement() public method

public WithStatement ( Expression contextManager, Expression var, Statement body ) : System
contextManager Expression
var Expression
body Statement
return System