internal override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_tuple != null) { _tuple.Walk(walker); } if (_defaultValue != null) { _defaultValue.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_lhs != null) { _lhs.Walk(walker); } if (_list != null) { _list.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_tuple != null) { _tuple.Walk(walker); } if (_defaultValue != null) { _defaultValue.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_left != null) { _left.Walk(walker); } if (_right != null) { _right.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_test != null) { _test.Walk(walker); } if (_message != null) { _message.Walk(walker); } } walker.PostWalk(this); }
public static bool WalkIfWithSystemConditions(this IfStatement node, PythonWalker walker, PythonLanguageVersion languageVersion, bool isWindows) { // System version, platform and os.path specializations var executeElse = false; foreach (var test in node.Tests) { var result = test.TryHandleSysVersionInfo(languageVersion); if (result == ConditionTestResult.Unrecognized) { result = test.TryHandleSysPlatform(isWindows); if (result == ConditionTestResult.Unrecognized) { result = test.TryHandleOsPath(isWindows); } } // If condition is satisfied, walk the corresponding block and // return false indicating that statement should not be walked again. // If condition is false or was not recognized, continue but remember // if we need to execute final else clause. switch (result) { case ConditionTestResult.WalkBody: test.Walk(walker); return(false); // We only need to execute one of the clauses. case ConditionTestResult.DontWalkBody: // If condition is false, continue but remember // if we may need to execute the final else clause. executeElse = true; break; case ConditionTestResult.Unrecognized: continue; // See if other conditions may work. } } if (executeElse) { node.ElseStatement?.Walk(walker); return(false); } // We didn't walk anything, so me caller do their own thing. return(true); }
protected override void PostWalk(PythonWalker walker) { IPythonType boolType = null; IPythonType noneType = null; foreach (BuiltinTypeId typeId in Enum.GetValues(typeof(BuiltinTypeId))) { if (_members.TryGetValue("__{0}__".FormatInvariant(typeId), out var m) && m is AstPythonType biType && biType.IsBuiltin) { if (typeId != BuiltinTypeId.Str && typeId != BuiltinTypeId.StrIterator) { biType.TrySetTypeId(typeId); } if (biType.IsHidden) { _hiddenNames.Add(biType.Name); } _hiddenNames.Add("__{0}__".FormatInvariant(typeId)); if (typeId == BuiltinTypeId.Bool) { boolType = boolType ?? biType; } if (typeId == BuiltinTypeId.NoneType) { noneType = noneType ?? biType; } } } _hiddenNames.Add("__builtin_module_names__"); if (boolType != null) { _members["True"] = _members["False"] = new AstPythonConstant(boolType); } if (noneType != null) { _members["None"] = new AstPythonConstant(noneType); } base.PostWalk(walker); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_contextManager != null) { _contextManager.Walk(walker); } if (_var != null) { _var.Walk(walker); } if (_body != null) { _body.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_test != null) { _test.Walk(walker); } if (_body != null) { _body.Walk(walker); } if (_else != null) { _else.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_sliceStart != null) { _sliceStart.Walk(walker); } if (_sliceStop != null) { _sliceStop.Walk(walker); } if (_sliceStep != null) { _sliceStep.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_type != null) { _type.Walk(walker); } if (_value != null) { _value.Walk(walker); } if (_traceback != null) { _traceback.Walk(walker); } } walker.PostWalk(this); }
public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { if (_code != null) { _code.Walk(walker); } if (_locals != null) { _locals.Walk(walker); } if (_globals != null) { _globals.Walk(walker); } } walker.PostWalk(this); }
protected override void PostWalk(PythonWalker walker) { foreach (BuiltinTypeId typeId in Enum.GetValues(typeof(BuiltinTypeId))) { IMember m; AstPythonBuiltinType biType; if (_members.TryGetValue($"__{typeId}", out m) && (biType = m as AstPythonBuiltinType) != null) { if (typeId != BuiltinTypeId.Str && typeId != BuiltinTypeId.StrIterator) { biType.TrySetTypeId(typeId); } if (biType.IsHidden) { _hiddenNames.Add(biType.Name); } _hiddenNames.Add($"__{typeId}"); } } _hiddenNames.Add("__builtin_module_names"); }
protected override void PostWalk(PythonWalker walker) { IPythonType boolType = null; foreach (BuiltinTypeId typeId in Enum.GetValues(typeof(BuiltinTypeId))) { IMember m; AstPythonBuiltinType biType; if (_members.TryGetValue($"__{typeId}__", out m) && (biType = m as AstPythonBuiltinType) != null) { if (typeId != BuiltinTypeId.Str && typeId != BuiltinTypeId.StrIterator) { biType.TrySetTypeId(typeId); } if (biType.IsHidden) { _hiddenNames.Add(biType.Name); } _hiddenNames.Add($"__{typeId}__"); if (typeId == BuiltinTypeId.Bool) { boolType = m as IPythonType; } } } _hiddenNames.Add("__builtin_module_names__"); if (boolType != null) { _members["True"] = _members["False"] = new AstPythonConstant(boolType); } base.PostWalk(walker); }
protected virtual void PostWalk(PythonWalker walker) { (walker as AstAnalysisWalker)?.Complete(); }
protected virtual void PostWalk(PythonWalker walker) { }
public abstract void Walk(PythonWalker walker);
public override void Walk(PythonWalker walker) { _node.Walk(walker); }