コード例 #1
0
        public virtual CodeExpression ReturnCodeExpression(IMethodCompile method)
        {
            string s      = method.GetParameterCodeNameById(this.ID);
            bool   bFound = !string.IsNullOrEmpty(s);

            if (bFound)
            {
                if (_code != null)
                {
                    return(_code);
                }
                _actualCompiledType = null;
                return(new CodeArgumentReferenceExpression(Variable.CodeVariableName));
            }
            else
            {
                _actualCompiledType = new RaisDataType(this.DataType.Type);
                return(ValueTypeUtil.GetDefaultCodeByType(this.DataType.Type));
            }
        }
コード例 #2
0
        public override CodeExpression ExportCode(MethodType method)
        {
            CodeStatementCollection supprtStatements = method.MethodCode.Statements;

            if (!MathNodeVariable.VariableDeclared(supprtStatements, this.CodeVariableName))
            {
                MathNode.Trace("Declare variable {0}", this.TraceInfo);
                supprtStatements.Add(new CodeVariableDeclarationStatement(new CodeTypeReference(VariableType.ObjectType), CodeVariableName, ValueTypeUtil.GetDefaultCodeByType(VariableType.ObjectType)));
            }
            MathNode.Trace("MathNodeVar.ExportCode returns variable reference to {0}", this.CodeVariableName);
            return(new CodeVariableReferenceExpression(this.CodeVariableName));
        }