Exemple #1
0
        public override bool Walk(ClassDefinition node)
        {
            var t = _scope.GetInScope(node.Name) as AstPythonType;

            if (t == null)
            {
                t = CreateType(node);
                _scope.SetInScope(node.Name, t);
            }

            var mro = node.Bases.Where(a => string.IsNullOrEmpty(a.Name))
                      .Select(a => _scope.GetNameFromExpression(a.Expression))
                      .Where(a => !string.IsNullOrEmpty(a))
                      .Select(a => new AstPythonType(a));

            if (t.Mro == null)
            {
                t.SetMro(mro);
            }

            _scope.PushScope();
            _scope.SetInScope("__class__", t);

            return(true);
        }