public MethodItemWrapper(string key, IClass owner, IMethodWrapper method) : base(key, owner) { _type = owner.VariableWrapperType; if (_type == null) { throw new DesignerException("Cannot create MethodItemWrapper: VariableWrapperType is null"); } }
protected override LimnorContextMenuCollection GetMenuData() { IClassWrapper a = Variable; if (a == null) { throw new DesignerException("Calling GetMenuData without an array variable"); } return(LimnorContextMenuCollection.GetMenuCollection(a)); }
public static List<Type> GeneratePropertyWrappers(TypeBuilder newCWType, IClassWrapper baseWrapper, PropertyInfo[] propertiesInfo, Type dataType) { List<Type> propertyWrapperClasses = new List<Type>(); foreach (PropertyInfo propertyInfo in propertiesInfo) { if (propertyInfo.DeclaringType != dataType) continue; Type wrapper = PropertyWrapperGenerator.GeneratePropertyWrapper(newCWType, propertyInfo, dataType); propertyWrapperClasses.Add(wrapper); } return propertyWrapperClasses; }
public virtual void Compile(ActionBranch currentAction, ActionBranch nextAction, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, CodeExpressionCollection parameters, IObjectPointer returnReceiver, bool debug) { if (_method == null) { return; } CodeExpression cmi = null; if (_method != null) { _method.SetHolder(_holder); CodeMethodReferenceExpression mref = (CodeMethodReferenceExpression)_method.GetReferenceCode(methodToCompile, statements, false); CodeMethodInvokeExpression cmim = new CodeMethodInvokeExpression(); cmim.Method = mref; cmim.Parameters.AddRange(parameters); cmi = cmim; } bool useOutput = false; if (!NoReturn && nextAction != null && nextAction.UseInput) { CodeVariableDeclarationStatement output = new CodeVariableDeclarationStatement( currentAction.OutputType.TypeString, currentAction.OutputCodeName, cmi); statements.Add(output); cmi = new CodeVariableReferenceExpression(currentAction.OutputCodeName); useOutput = true; } if (HasReturn && returnReceiver != null) { CodeExpression cr = returnReceiver.GetReferenceCode(methodToCompile, statements, true); if (_method.ReturnValue != null) { Type target; IClassWrapper wrapper = returnReceiver as IClassWrapper; if (wrapper != null) { target = wrapper.WrappedType; } else { target = returnReceiver.ObjectType; } Type dt; if (useOutput) { dt = currentAction.OutputType.BaseClassType; } else { dt = _method.ReturnValue.BaseClassType; } CompilerUtil.CreateAssignment(cr, target, cmi, dt, statements, true); } else { CodeAssignStatement cas = new CodeAssignStatement(cr, cmi); statements.Add(cas); } } else { if (!useOutput) { CodeExpressionStatement ces = new CodeExpressionStatement(cmi); statements.Add(ces); } } }
public void Compile(ActionBranch currentAction, ActionBranch nextAction, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, CodeExpressionCollection parameters, IObjectPointer returnReceiver, bool debug) { if (_method == null) { return; } IObjectPointer op = _method.VariablePointer; if (op == null) { return; } ClassPointer cp = op as ClassPointer; CustomMethodPointer cmp = null; MethodClass mc = null; if (cp != null) { mc = cp.GetCustomMethodById(_method.MethodId); if (mc != null) { cmp = new CustomMethodPointer(mc, _holder); cmp.SetParameterExpressions(_parameterExpressions); cmp.Compile(currentAction, nextAction, compiler, methodToCompile, method, statements, parameters, returnReceiver, debug); return; } } CodeExpression cmi = null; if (_method != null) { CodeMethodReferenceExpression mref = (CodeMethodReferenceExpression)_method.GetReferenceCode(methodToCompile, statements, false); CodeMethodInvokeExpression cmim = new CodeMethodInvokeExpression(); cmim.Method = mref; cmim.Parameters.AddRange(parameters); cmi = cmim; } bool useOutput = false; if (!NoReturn && nextAction != null && nextAction.UseInput) { CodeVariableDeclarationStatement output = new CodeVariableDeclarationStatement( currentAction.OutputType.TypeString, currentAction.OutputCodeName, cmi); statements.Add(output); cmi = new CodeVariableReferenceExpression(currentAction.OutputCodeName); useOutput = true; } if (_method.HasReturn && returnReceiver != null) { CodeExpression cr = returnReceiver.GetReferenceCode(methodToCompile, statements, true); if (_method.ReturnType != null) { Type target; IClassWrapper wrapper = returnReceiver as IClassWrapper; if (wrapper != null) { target = wrapper.WrappedType; } else { target = returnReceiver.ObjectType; } Type dt; if (useOutput) { dt = currentAction.OutputType.BaseClassType; } else { dt = _method.ReturnType.BaseClassType; } CompilerUtil.CreateAssignment(cr, target, cmi, dt, statements, true); } else { CodeAssignStatement cas = new CodeAssignStatement(cr, cmi); statements.Add(cas); } } else { if (!useOutput) { CodeExpressionStatement ces = new CodeExpressionStatement(cmi); statements.Add(ces); } } }