コード例 #1
0
ファイル: ClrInteropBindings.cs プロジェクト: dbremner/irony
 public ClrFieldBindingTargetInfo(FieldInfo field, object instance)
     : base(field.Name, ClrTargetType.Field)
 {
     Field = field;
       Instance = instance;
       _binding = new Binding(this);
       _binding.GetValueRef = GetPropertyValue;
       _binding.SetValueRef = SetPropertyValue;
 }
コード例 #2
0
ファイル: IdentifierNode.cs プロジェクト: MarcusTheBold/Irony
 //Executed only once, on the first call
 protected override object DoEvaluate(ScriptThread thread)
 {
     thread.CurrentNode = this;  //standard prolog
       _accessor = thread.Bind(Symbol, BindingRequestFlags.Read);
       this.Evaluate = _accessor.GetValueRef; // Optimization - directly set method ref to accessor's method. EvaluateReader;
       var result = this.Evaluate(thread);
       thread.CurrentNode = Parent; //standard epilog
       return result;
 }
コード例 #3
0
ファイル: IdentifierNode.cs プロジェクト: MarcusTheBold/Irony
 public override void DoSetValue(ScriptThread thread, object value)
 {
     thread.CurrentNode = this;  //standard prolog
       if (_accessor == null) {
     _accessor = thread.Bind(Symbol, BindingRequestFlags.Write | BindingRequestFlags.ExistingOrNew);
       }
       _accessor.SetValueRef(thread, value);
       thread.CurrentNode = Parent;  //standard epilog
 }
コード例 #4
0
 public ClrMethodBindingTargetInfo(Type declaringType, string methodName, object instance = null) : base(methodName,  ClrTargetType.Method) {
   DeclaringType = declaringType;
   Instance = instance;
   _invokeFlags = BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.NonPublic;
   if (Instance == null)
     _invokeFlags |= BindingFlags.Static;
   else
     _invokeFlags |= BindingFlags.Instance;
   _binding = new ConstantBinding(target: this as ICallTarget, targetInfo: this); 
     //The object works as CallTarget itself; the "as" conversion is not needed in fact, we do it just to underline the role
 }
コード例 #5
0
 public ClrPropertyBindingTargetInfo(PropertyInfo property, object instance) : base(property.Name, ClrTargetType.Property) {
   Property = property;
   Instance = instance;
   _binding = new Binding(this);
   _binding.GetValueRef = GetPropertyValue;
   _binding.SetValueRef = SetPropertyValue;
 }
コード例 #6
0
 public BuiltInCallableTargetInfo(BuiltInCallTarget target)  : base(target.Name, BindingTargetType.BuiltInObject) {
   BindingInstance = new ConstantBinding(target, this); 
 }