public IList <Declaration> GetAttributesAt(int line, int column) { Node node; Scope scope; List <Declaration> attributes = new List <Declaration>(); if (Locate(line, column, out node, out scope)) { FieldExpression field = node as FieldExpression; if (null != field) { IList <Inferred> result = Engine.Infer(this, field.Target, scope); if (result != null) { foreach (Inferred s in result) { foreach (SymbolId name in s.Names) { attributes.Add(new Declaration(name.GetString())); } } } } else if (node != null && !(node is IronPython.Compiler.Ast.ConstantExpression)) { foreach (SymbolId name in scope.GetNamesCurrent()) { attributes.Add(new Declaration(name.GetString())); } for (; ;) { scope = scope.Parent; if (scope == null) { break; } IEnumerable <SymbolId> namesOuter = scope.GetNamesOuter(); if (namesOuter != null) { foreach (SymbolId name in namesOuter) { attributes.Add(new Declaration(name.GetString())); } } } AddBuiltins(attributes); } } else { foreach (SymbolId name in module.GetNamesOuter()) { attributes.Add(new Declaration(name.GetString())); } AddBuiltins(attributes); } return(attributes); }
public override IList <Inferred> Resolve(Engine engine, Scope scope) { if (argument == 0 && name == SymbolTable.StringToId("self")) { ScopeStatement parent = function.Parent; if (parent != null) { return(engine.Infer(parent, scope)); } } return(null); }
public void Infer(Module module) { Engine e = Engine.Create(module, false); IList <Inferred> left = e.Infer(fe.Target, anchor); if (left != null) { foreach (Inferred inf in left) { InferredClass ic = inf as InferredClass; if (ic != null) { ic.Define(fe.Name, new IndirectDefinition(rhs, anchor)); } } } }
public IList <FunctionInfo> GetMethodsAt(int line, int column, string name) { Node node; Scope scope; Node context; IList <Inferred> methods = null; SymbolId nodeName = SymbolTable.Empty; if (Locate(typeof(CallExpression), line, column, out node, out scope, out context)) { if (context != null) { node = ((CallExpression)context).Target; } FieldExpression fe; NameExpression ne; if ((fe = node as FieldExpression) != null) { nodeName = fe.Name; methods = Engine.Infer(this, fe, scope); } else if ((ne = node as NameExpression) != null) { nodeName = ne.Name; methods = Engine.Infer(this, node, scope); } } if (methods != null) { IList <FunctionInfo> infos = null; foreach (Inferred inf in methods) { infos = Engine.Union(infos, inf.InferMethods(nodeName)); } return(infos); } return(null); }
public override IList <Inferred> Resolve(Engine engine, Scope scope) { return(engine.Infer(assignment.Right, scope)); }
public override IList <Inferred> Resolve(Engine engine, Scope scope) { return(engine.Infer(this.expression, this.scope)); }
public override IList <Inferred> Resolve(Engine engine, Scope scope) { return(engine.Infer(@class, scope)); }