TryGetFormalArgument() public method

public TryGetFormalArgument ( string name ) : Antlr4.StringTemplate.Compiler.FormalArgument
name string
return Antlr4.StringTemplate.Compiler.FormalArgument
Example #1
0
        public virtual void ReferenceAttribute(IToken templateToken, CommonTree id)
        {
            string         name = id.Text;
            FormalArgument arg  = impl.TryGetFormalArgument(name);

            if (arg != null)
            {
                int index = arg.Index;
                Emit1(id, Bytecode.INSTR_LOAD_LOCAL, index);
            }
            else
            {
                if (Interpreter.PredefinedAnonymousSubtemplateAttributes.Contains(name))
                {
                    errMgr.CompiletimeError(ErrorType.REF_TO_IMPLICIT_ATTRIBUTE_OUT_OF_SCOPE, templateToken, id.Token);
                    Emit(id, Bytecode.INSTR_NULL);
                }
                else
                {
                    Emit1(id, Bytecode.INSTR_LOAD_ATTR, name);
                }
            }
        }