Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

no support for parameterized properties with default values #1134

Open
ironpythonbot opened this issue Dec 9, 2014 · 0 comments
Open

no support for parameterized properties with default values #1134

ironpythonbot opened this issue Dec 9, 2014 · 0 comments

Comments

@ironpythonbot
Copy link

The code in the bottom raise the exception [ ** unsupported operand type(s)
for -: 'indexer#' and 'int' ** ] if I use the expression with the call for
prop1

Option Explicit On
Option Strict On

Imports Microsoft.Scripting.Hosting
Imports IronPython.Hosting
Imports Microsoft.Scripting



Public Class TestObject
    Public ReadOnly Property prop1(Optional param As Double = 10) As Double
        Get
            Return param * 9
        End Get
    End Property
    Public ReadOnly Property prop2 As Double
        Get
            Return 999
        End Get
    End Property
End Class

Module Module1

    Sub Main()
        Dim obj As TestObject = New TestObject
        Dim engine As ScriptEngine = Python.CreateEngine()
        Dim scope As ScriptScope = engine.CreateScope()
        scope.SetVariable("obj", obj)
        Dim expression As CompiledCode = engine.CreateScriptSourceFromString("test = obj.prop1 - 11", SourceCodeKind.Statements).Compile()
        'Dim expression As CompiledCode = engine.CreateScriptSourceFromString("test = obj.prop2 - 11", SourceCodeKind.Statements).Compile()
        expression.Execute(scope)
        Dim ret As Double = CType(scope.GetVariable("test"), Double)
        Console.WriteLine("returned value from python: " & ret)
        Console.ReadLine()
    End Sub

End Module

Work Item Details

Original CodePlex Issue: Issue 35722
Status: Proposed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Dec 2 at 10:30 PM
Reported by: nsstl
Updated on: Dec 2 at 10:30 PM
Updated by: nsstl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants