Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        protected TokenDeclInline(VarDict ifd,
                                  bool doCheckRun,
                                  MethodInfo methInfo)
            : base(null, null, null)
        {
            TokenType retType = TokenType.FromSysType(null, methInfo.ReturnType);

            this.isTaggedCallsCheckRun = IsTaggedCallsCheckRun(methInfo);
            this.name       = new TokenName(null, methInfo.Name);
            this.retType    = GetRetType(methInfo, retType);
            this.argDecl    = GetArgDecl(methInfo.GetParameters());
            this.triviality = (doCheckRun || this.isTaggedCallsCheckRun) ? Triviality.complex : Triviality.trivial;
            this.location   = new CompValuInline(this);

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