public override Yarn.Type VisitValueFunc(YarnSpinnerV1Parser.ValueFuncContext context)
            {
                // In Yarn Spinner 1, we don't know the return type OR the
                // parameter types of functions. This means that we can't
                // use return type information, and we'll always return
                // Undefined. We will, however, make sure we visit all
                // parameters, since it contain expressions that result in
                // a variable being bound to a type.

                // Check each parameter of the function
                var suppliedParameters = context.function().expression();

                for (int i = 0; i < suppliedParameters.Length; i++)
                {
                    var suppliedParameter = suppliedParameters[i];

                    this.Visit(suppliedParameter);
                }

                return(Type.Undefined);
            }
Beispiel #2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>valueFunc</c>
 /// labeled alternative in <see cref="YarnSpinnerV1Parser.value"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitValueFunc([NotNull] YarnSpinnerV1Parser.ValueFuncContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by the <c>valueFunc</c>
 /// labeled alternative in <see cref="YarnSpinnerV1Parser.value"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitValueFunc([NotNull] YarnSpinnerV1Parser.ValueFuncContext context)
 {
     return(VisitChildren(context));
 }