Esempio n. 1
0
        public override void Populate(ModuleFactory mf, IPythonType declaringType, IGlobalScope gs)
        {
            _property.SetDocumentation(Documentation);

            var o = new PythonFunctionOverload(_property, mf.DefaultLocation);

            o.SetDocumentation(Documentation);
            o.SetReturnValue(mf.ConstructMember(ReturnType), true);
            _property.AddOverload(o);
        }
Esempio n. 2
0
        public PythonLazyOverload(OverloadModel model, ModuleFactory mf, IPythonClassMember cm)
        {
            _model = model;
            _mf    = mf;

            ClassMember   = cm;
            Documentation = model.Documentation;

            _overload = new PythonFunctionOverload(cm, new Location(mf.Module, default));
            _overload.SetDocumentation(cm.Documentation);
        }
Esempio n. 3
0
        public PythonLazyPropertyType(PropertyModel model, ModuleFactory mf, IGlobalScope gs, IPythonType declaringType)
            : base(model, mf, gs, declaringType)
        {
            var location = new Location(mf.Module, model.IndexSpan.ToSpan());

            _property = new PythonPropertyType(model.Name, location, model.Documentation, declaringType,
                                               model.Attributes.HasFlag(FunctionAttributes.Abstract));

            // parameters and return type just to look at them.
            var o = new PythonFunctionOverload(_property, location);

            o.SetDocumentation(model.Documentation);
            _property.AddOverload(o);

            IsReadOnly = model.IsReadOnly;
            SetInnerType(_property);
        }
Esempio n. 4
0
        public override void Populate(ModuleFactory mf, IPythonType declaringType, IGlobalScope gs)
        {
            // Create inner functions and classes first since function may be returning one of them.
            var all = Classes.Concat <MemberModel>(Functions).ToArray();

            foreach (var model in all)
            {
                _function.AddMember(Name, model.Create(mf, _function, gs), overwrite: true);
            }
            foreach (var model in all)
            {
                model.Populate(mf, _function, gs);
            }

            foreach (var om in Overloads)
            {
                var o = new PythonFunctionOverload(_function, new Location(mf.Module, IndexSpan.ToSpan()));
                o.SetDocumentation(Documentation);
                o.SetReturnValue(mf.ConstructMember(om.ReturnType), true);
                o.SetParameters(om.Parameters.Select(p => ConstructParameter(mf, p)).ToArray());
                _function.AddOverload(o);
            }
        }