protected TokenDeclInline(VarDict ifd,
            bool doCheckRun,
            MethodInfo methInfo)
            : base(null, null, null)
        {
            isTaggedCallsCheckRun = IsTaggedCallsCheckRun(methInfo);
            name = new TokenName(null, methInfo.Name);
            retType = GetRetType(methInfo, TokenType.FromSysType(null, methInfo.ReturnType));
            argDecl = GetArgDecl(methInfo.GetParameters());
            triviality = (doCheckRun || isTaggedCallsCheckRun) ? Triviality.complex : Triviality.trivial;
            location = new CompValuInline(this);

            if(ifd == null)
                ifd = inlineFunctions;
            ifd.AddEntry(this);
        }
Exemplo n.º 2
0
        /**
         * @brief Add an inline function definition to the dictionary.
         * @param ifd        = dictionary to add inline definition to
         * @param doCheckRun = true iff the generated code or the function itself can possibly call CheckRun()
         * @param nameArgSig = inline function signature string, in form <name>(<arglsltypes>,...)
         * @param retType    = return type, use TokenTypeVoid if no return value
         */
        protected TokenDeclInline(VarDict ifd,
                                  bool doCheckRun,
                                  string nameArgSig,
                                  TokenType retType)
            : base(null, null, null)
        {
            this.retType    = retType;
            this.triviality = doCheckRun ? Triviality.complex : Triviality.trivial;

            int j = nameArgSig.IndexOf('(');

            this.name = new TokenName(null, nameArgSig.Substring(0, j++));

            this.argDecl = new TokenArgDecl(null);
            if (nameArgSig[j] != ')')
            {
                int       i;
                TokenName name;
                TokenType type;

                for (i = j; nameArgSig[i] != ')'; i++)
                {
                    if (nameArgSig[i] == ',')
                    {
                        type = TokenType.FromLSLType(null, nameArgSig.Substring(j, i - j));
                        name = new TokenName(null, "arg" + this.argDecl.varDict.Count);
                        this.argDecl.AddArg(type, name);
                        j = i + 1;
                    }
                }

                type = TokenType.FromLSLType(null, nameArgSig.Substring(j, i - j));
                name = new TokenName(null, "arg" + this.argDecl.varDict.Count);
                this.argDecl.AddArg(type, name);
            }

            this.location = new CompValuInline(this);
            if (ifd == null)
            {
                ifd = inlineFunctions;
            }
            ifd.AddEntry(this);
        }