// DictionaryExpression public override bool Walk(DictionaryExpression node) { return(ShouldWalkWorker(node)); }
public override void PostWalk(DictionaryExpression node) { PostWalkWorker(node); }
// DictionaryExpression public virtual bool Walk(DictionaryExpression node) { return true; }
public IExpression CompileDictionary() { DictionaryExpression dictionaryExpression = new DictionaryExpression(); Token token = this.lexer.NextToken(); while (token != null && token.Value != "}") { if (dictionaryExpression.KeyExpressions.Count != 0) { if (token.Value != ",") throw new ExpectedTokenException(","); } else this.lexer.PushToken(token); IExpression keyExpression = this.CompileExpression(); this.CompileToken(TokenType.Separator, ":"); IExpression valueExpression = this.CompileExpression(); dictionaryExpression.Add(keyExpression, valueExpression); token = this.lexer.NextToken(); } if (token != null) this.lexer.PushToken(token); return dictionaryExpression; }
// DictionaryExpression public override bool Walk(DictionaryExpression node) { return(false); }
// DictionaryExpression public override bool Walk(DictionaryExpression node) { return false; }
// DictionaryExpression public override bool Walk(DictionaryExpression node) { return Location >= node.StartIndex && Location <= node.EndIndex; }
public virtual void PostWalk(DictionaryExpression node) { }
public override bool Walk(DictionaryExpression node) { AddTagIfNecessary(node); return(base.Walk(node)); }
public override bool Walk(DictionaryExpression node) { writer.WriteLine("Dict"); return(base.Walk(node)); }
private List <Inferred> InferDictionaryExpression(DictionaryExpression node, Scope scope) { return(MakeList(module.InferType(typeof(IronPython.Runtime.Dict)))); }
public override bool Walk(DictionaryExpression node) { return(WalkCollection(node, node.Items)); }
public override bool Walk(DictionaryExpression node) { AddTagIfNecessary(node.Items?.FirstOrDefault()?.StartIndex, node.Items?.LastOrDefault()?.EndIndex); return(base.Walk(node)); }
internal static string GetDefaultValue(PythonAnalyzer state, Parameter curParam, PythonAst tree) { if (curParam.DefaultValue != null) { // TODO: Support all possible expressions for default values, we should // probably have a PythonAst walker for expressions or we should add ToCodeString() // onto Python ASTs so they can round trip ConstantExpression defaultValue = curParam.DefaultValue as ConstantExpression; if (defaultValue != null) { return(defaultValue.GetConstantRepr(state.LanguageVersion)); } else { NameExpression nameExpr = curParam.DefaultValue as NameExpression; if (nameExpr != null) { return(nameExpr.Name); } else { DictionaryExpression dict = curParam.DefaultValue as DictionaryExpression; if (dict != null) { if (dict.Items.Count == 0) { return("{}"); } else { return("{...}"); } } else { ListExpression list = curParam.DefaultValue as ListExpression; if (list != null) { if (list.Items.Count == 0) { return("[]"); } else { return("[...]"); } } else { TupleExpression tuple = curParam.DefaultValue as TupleExpression; if (tuple != null) { if (tuple.Items.Count == 0) { return("()"); } else { return("(...)"); } } else { return(curParam.DefaultValue.ToCodeString(tree)); } } } } } } return(null); }
public override bool Walk(DictionaryExpression node) { CanComplete = true; return(base.Walk(node)); }
// DictionaryExpression public virtual bool Walk(DictionaryExpression node) { return(true); }
public override bool Walk(DictionaryExpression node) { return(UpdateLineInfo(node, true)); }
// DictionaryExpression public override bool Walk(DictionaryExpression node) { return(Location >= node.StartIndex && Location <= node.EndIndex); }
// DictionaryExpression public bool Walk(DictionaryExpression node) { return(Process(node)); }
public override void PostWalk(DictionaryExpression node) { }
public void PostWalk(DictionaryExpression node) { PostProcess(node); }
internal static ParameterResult MakeParameterResult(PythonAnalyzer state, Parameter curParam) { string name = curParam.Name; if (curParam.IsDictionary) { name = "**" + name; } else if (curParam.IsList) { name = "*" + curParam.Name; } if (curParam.DefaultValue != null) { // TODO: Support all possible expressions for default values, we should // probably have a PythonAst walker for expressions or we should add ToCodeString() // onto Python ASTs so they can round trip ConstantExpression defaultValue = curParam.DefaultValue as ConstantExpression; if (defaultValue != null) { // FIXME: Use Python Repr name = name + " = " + (defaultValue.Value == null ? "None" : defaultValue.Value.ToString()); //PythonOps.Repr(state.CodeContext, defaultValue.Value); } NameExpression nameExpr = curParam.DefaultValue as NameExpression; if (nameExpr != null) { name = name + " = " + nameExpr.Name; } DictionaryExpression dict = curParam.DefaultValue as DictionaryExpression; if (dict != null) { if (dict.Items.Count == 0) { name = name + " = {}"; } else { name = name + " = {...}"; } } ListExpression list = curParam.DefaultValue as ListExpression; if (list != null) { if (list.Items.Count == 0) { name = name + " = []"; } else { name = name + " = [...]"; } } TupleExpression tuple = curParam.DefaultValue as TupleExpression; if (tuple != null) { if (tuple.Items.Count == 0) { name = name + " = ()"; } else { name = name + " = (...)"; } } } var newParam = new ParameterResult(name); return(newParam); }
protected virtual Expression VisitDictionary(DictionaryExpression node) => base.VisitExtension(node);