protected override EV3Type CalculateType()
        {
            string propertyName      = ParentExpression.FullName().ToUpper();
            EV3SubDefinitionBase sub = Context.FindMethod(propertyName);

            if (sub != null)
            {
                return(sub.ReturnType);
            }

            return(EV3Type.Unknown);
        }
示例#2
0
        public override string Compile(TextWriter writer, IEV3Variable variable)
        {
            EV3SubDefinitionBase sub = Context.FindMethod(Value);

            if (sub != null)
            {
                return(CompileMethodCall(writer, variable, sub));
            }

            AddError($"Unknown method call to {ParentExpression.FullName()}");
            return("");
        }
        public override string Compile(TextWriter writer, IEV3Variable variable)
        {
            EV3SubDefinitionBase sub = Context.FindMethod(Value);

            if (sub != null)
            {
                using (var tempVariables = Context.UseTempVariables())
                {
                    if (variable.Type.IsArray() && !sub.ReturnType.IsArray())
                    {
                        variable = tempVariables.CreateVariable(variable.Type.BaseType());
                    }
                    return(sub.Compile(writer, Context, new string[0], variable.Ev3Name));
                }
            }
            else
            {
                AddError($"Unknown property {ParentExpression.FullName()}");
            }

            return(variable.Ev3Name);
        }
 protected override string CalculateValue()
 {
     return(ParentExpression.FullName().ToUpper());
 }