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 override IList<Inferred> Resolve(Engine engine, Scope scope)
 {
     return null;
 }
 public override IList<Inferred> Resolve(Engine engine, Scope scope)
 {
     return engine.Infer(this.expression, this.scope);
 }
 public IndirectDefinition(Expression expression, Scope scope)
 {
     this.expression = expression;
     this.scope = scope;
 }
        public override IList<Inferred> Resolve(Engine engine, Scope scope)
        {
            Inferred import = engine.Import(name.Names[0]);
            IList<Inferred> previous = null;

            if (import != null)
            {
                previous = Engine.MakeList(import);

                for (int i = 1; i < name.Names.Count; i++)
                {
                    IList<Inferred> next = null;
                    foreach (Inferred inf in previous)
                    {
                        IList<Inferred> n2 = inf.InferName(name.Names[i], engine);
                        next = Engine.Union(next, n2);
                    }
                    previous = next;
                }
            }
            return previous;
        }
 public override IList<Inferred> Resolve(Engine engine, Scope scope)
 {
     return Engine.MakeList<Inferred>(new FunctionDefinitionInfo(function));
 }
Exemplo n.º 7
0
 protected Scope(Module module, Scope parent)
 {
     this.module = module;
     this.parent = parent;
 }
        public bool Locate(int line, int column, out Node node, out Scope scope)
        {
            Locator locator = new Locator(line, column);
            global.Walk(locator);

            node = locator.Candidate;
            scope = locator.Scope != null ? scopes[locator.Scope] : null;

            #if DEBUG
            if (node != null)
            {
                Debug.Print("Located {0} at {1}:{2}-{3}:{4}",
                    node,
                    node.Start.Line, node.Start.Column,
                    node.End.Line, node.End.Column
                );
            }
            #endif

            return node != null;
        }
 public override IList<Inferred> Resolve(Engine engine, Scope scope)
 {
     return engine.Infer(@class, scope);
 }
Exemplo n.º 10
0
 public FieldAssignment(FieldExpression fe, Expression rhs, Scope anchor)
 {
     this.fe = fe;
     this.rhs = rhs;
     this.anchor = anchor;
 }
Exemplo n.º 11
0
 private void PushScope(Scope scope)
 {
     Debug.Assert(!scopes.ContainsKey(scope.Statement));
     scope.Statement.Parent = current != null ? current.Statement : null;
     scopes[scope.Statement] = scope;
     current = scope;
 }
Exemplo n.º 12
0
 private void PopScope()
 {
     current = current.Parent;
     Debug.Assert(scopes.ContainsKey(current.Statement));
 }
Exemplo n.º 13
0
 public FunctionScope(Module module, Scope parent, IronPython.Compiler.Ast.FunctionDefinition statement)
     : base(module, parent)
 {
     this.statement = statement;
 }
Exemplo n.º 14
0
 public ClassScope(Module module, Scope parent, IronPython.Compiler.Ast.ClassDefinition statement)
     : base(module, parent)
 {
     this.statement = statement;
 }
 public abstract IList<Inferred> Resolve(Engine engine, Scope scope);
 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.MakeList(engine.InferType(type));
 }
        private bool Locate(Type contextType, int line, int column, out Node node, out Scope scope, out Node context)
        {
            Locator locator = new Locator(contextType, line, column);
            global.Walk(locator);
            node = locator.Candidate;
            scope = locator.Scope != null ? scopes[locator.Scope] : null;
            context = locator.Context;

            #if DEBUG
            if (node != null)
            {
                Debug.Print("Located {0} in {1} at {2}:{3}-{4}:{5}",
                    node, context != null ? (object)context : (object)"<unknown>",
                    node.Start.Line, node.Start.Column,
                    node.End.Line, node.End.Column
                );
            }
            #endif

            return node != null && context != null;
        }
Exemplo n.º 19
0
 public ModuleScope(Module module, Scope parent, GlobalSuite statement)
     : base(module, parent)
 {
     this.statement = statement;
 }