本文整理汇总了C#中IronPython.Compiler.Ast.Statement.Walk方法的典型用法代码示例。如果您正苦于以下问题:C# Statement.Walk方法的具体用法?C# Statement.Walk怎么用?C# Statement.Walk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Compiler.Ast.Statement
的用法示例。
在下文中一共展示了Statement.Walk方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoAnalyze
private Module DoAnalyze(Modules modules, string name, Statement root)
{
GlobalSuite global = new GlobalSuite(root);
module = new Module(modules, name, global, scopes);
ModuleScope modsc;
module.ModuleScope = modsc = new ModuleScope(module, null, global);
PushScope(modsc);
root.Walk(this);
foreach (FieldAssignment fer in this.fields) {
fer.Infer(module);
}
return module;
}
示例2: FindControlFlow
public static bool FindControlFlow(Statement statement, out bool foundLoopControl)
{
// No return in null statement
if (statement == null) {
foundLoopControl = false;
return false;
}
// find it now.
ControlFlowFinder rf = new ControlFlowFinder();
statement.Walk(rf);
foundLoopControl = rf.foundLoopControl;
return rf.found;
}
示例3: CheckMightNeedLocalsDictionary
public static bool CheckMightNeedLocalsDictionary(Statement s)
{
MightNeedLocalsWalker w = new MightNeedLocalsWalker();
s.Walk(w);
return w.MightNeedLocals;
}
示例4: WalkClassBody
void WalkClassBody(IClass c, Statement classBody)
{
currentClass = c;
classBody.Walk(this);
currentClass = null;
}
示例5: Walk
/// <summary>
/// Walks the python statement returned from the parser.
/// </summary>
public void Walk(Statement statement)
{
statement.Walk(this);
}
示例6: WalkScopes
private ScopeNode WalkScopes(Statement Statement)
{
Statement.Walk(this);
return root;
}
示例7: DoBind
private GlobalSuite DoBind(Statement root)
{
GlobalSuite global = new GlobalSuite(root);
current = global;
// Detect all local names
root.Walk(this);
// Binding the free variables
foreach (ScopeStatement scope in processed) {
scope.BindNames(global, this);
}
// Validate
foreach (ScopeStatement scope in processed) {
if ((scope.ScopeInfo &
(ScopeStatement.ScopeAttributes.ContainsFreeVariables |
ScopeStatement.ScopeAttributes.ContainsImportStar |
ScopeStatement.ScopeAttributes.ContainsUnqualifiedExec |
ScopeStatement.ScopeAttributes.ContainsNestedFreeVariables)) == 0) {
continue;
}
FunctionDefinition func;
if ((func = scope as FunctionDefinition) != null) {
if (func.ContainsImportStar && func.IsClosure) {
ReportSyntaxError(String.Format("import * is not allowed in function '{0}' because it is a nested function", func.Name.GetString()), func);
}
if (func.ContainsImportStar && func.Parent is FunctionDefinition) {
ReportSyntaxError(String.Format("import * is not allowed in function '{0}' because it is a nested function", func.Name.GetString()), func);
}
if (func.ContainsImportStar && func.ContainsNestedFreeVariables) {
ReportSyntaxError(String.Format("import * is not allowed in function '{0}' because it contains a nested function with free variables", func.Name.GetString()), func);
}
if (func.ContainsUnqualifiedExec && func.ContainsNestedFreeVariables) {
ReportSyntaxError(String.Format("unqualified exec is not allowed in function '{0}' it contains a nested function with free variables", func.Name.GetString()), func);
}
if (func.ContainsUnqualifiedExec && func.IsClosure) {
ReportSyntaxError(String.Format("unqualified exec is not allowed in function '{0}' it is a nested function", func.Name.GetString()), func);
}
}
ClassDefinition cls;
if ((cls = scope as ClassDefinition) != null) {
if (cls.ContainsImportStar) {
// warning
}
}
}
return global;
}