-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0eec27
commit 715f015
Showing
8 changed files
with
120 additions
and
135 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Plugins/IronPython/IronPythonContractBasedImportDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Composition; | ||
using System.ComponentModel.Composition.Primitives; | ||
|
||
namespace Plugins.IronPython | ||
{ | ||
public class IronPythonContractBasedImportDefinition : ContractBasedImportDefinition | ||
{ | ||
public string MethodName { get; private set; } | ||
|
||
public IronPythonContractBasedImportDefinition(string methodName, string contractName, | ||
string requiredTypeIdentity, | ||
IEnumerable<KeyValuePair<string, Type>> requiredMetadata, | ||
ImportCardinality cardinality, bool isRecomposable, | ||
bool isPrerequisite, CreationPolicy requiredCreationPolicy) | ||
: base( | ||
contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, isPrerequisite, | ||
requiredCreationPolicy) | ||
{ | ||
MethodName = methodName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Runtime.Remoting; | ||
using IronPython.Runtime.Types; | ||
using Microsoft.Scripting.Hosting; | ||
|
||
namespace Plugins.IronPython | ||
{ | ||
public class IronPythonTypeWrapper | ||
{ | ||
private readonly ScriptEngine _engine; | ||
private readonly ObjectHandle _classHandle; | ||
private ObjectHandle _instanceHandle; | ||
private object _instance; | ||
|
||
public IronPythonTypeWrapper(ScriptEngine engine, string name, PythonType pythonType, ObjectHandle classHandle) | ||
{ | ||
Name = name; | ||
PythonType = pythonType; | ||
_engine = engine; | ||
_classHandle = classHandle; | ||
} | ||
|
||
public string Name { get; private set; } | ||
public PythonType PythonType { get; private set; } | ||
public Type Type { get { return PythonType; } } | ||
public object Activator() | ||
{ | ||
_instanceHandle = _engine.Operations.Invoke(_classHandle, new object[] {}); | ||
_instance = _engine.Operations.Unwrap<object>(_instanceHandle); | ||
return _instance; | ||
} | ||
|
||
public void InvokeMethodWithArgument(string methodName, object argument) | ||
{ | ||
_engine.Operations.InvokeMember(_instance, methodName, argument); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters