/// <summary>
        /// Gets additional flags of the caller routine.
        /// </summary>
        public static RoutineFlags InvocationFlags(this IPhpRoutineSymbol routine)
        {
            RoutineFlags f = RoutineFlags.None;

            var ps = routine.Parameters;

            foreach (var p in ps)
            {
                if (p.IsImplicitlyDeclared)
                {
                    if (SpecialParameterSymbol.IsLocalsParameter(p))
                    {
                        f |= RoutineFlags.UsesLocals;
                    }
                    else if (SpecialParameterSymbol.IsCallerArgsParameter(p))
                    {
                        f |= RoutineFlags.UsesArgs;
                    }
                    else if (SpecialParameterSymbol.IsCallerStaticClassParameter(p))
                    {
                        f |= RoutineFlags.UsesLateStatic;
                    }
                }
                else
                {
                    break;
                }
            }

            return(f);
        }
Exemple #2
0
        /// <summary>
        /// Gets additional flags of the caller routine.
        /// </summary>
        public static RoutineFlags InvocationFlags(this IPhpRoutineSymbol routine)
        {
            RoutineFlags f = RoutineFlags.None;

            var ps = routine.Parameters;

            foreach (var p in ps)
            {
                if (p.IsImplicitlyDeclared)
                {
                    if (SpecialParameterSymbol.IsQueryValueParameter(p, out var ctor, out var container))
                    {
                        switch (container)
                        {
                        case SpecialParameterSymbol.QueryValueTypes.CallerArgs:
                            f |= RoutineFlags.UsesArgs;
                            break;

                        case SpecialParameterSymbol.QueryValueTypes.LocalVariables:
                            f |= RoutineFlags.UsesLocals;
                            break;
                        }
                    }
                    else if (SpecialParameterSymbol.IsCallerStaticClassParameter(p))
                    {
                        f |= RoutineFlags.UsesLateStatic;
                    }
                }
Exemple #3
0
    CoroutineHandle StartInternal(IEnumerator enumerator, Component attachTo, RoutineFlags flags = RoutineFlags.None)
    {
        if (enumerator == null)
        {
            throw new ArgumentNullException("routine");
        }

        if (attachTo != null && !attachTo.gameObject.activeInHierarchy)
        {
            Dbg.LogError(
                attachTo,
                "Coroutine couldn't be started because the the game object '{0}' is inactive!",
                GarbageCache.GetName(attachTo.gameObject)
                );

            return(new CoroutineHandle());
        }

        var routine = new Routine(
            id: ++idCounter,
            flags: flags,
            enumerator: enumerator,
            attachedTo: attachTo
            );

        bool started = Resolve(ref routine, cameFromPostRender: false);

        return(new CoroutineHandle(
                   id: started?routine.id: 0
                   ));
    }
Exemple #4
0
 public ZilRoutine([CanBeNull] ZilAtom name, [CanBeNull] ZilAtom activationAtom,
                   [NotNull] IEnumerable <ZilObject> argspec, [ItemNotNull][NotNull] IEnumerable <ZilObject> body, RoutineFlags flags)
 {
     Name      = name;
     ArgSpec   = ArgSpec.Parse("ROUTINE", name, activationAtom, argspec);
     this.body = body.ToArray();
     Flags     = flags;
 }
Exemple #5
0
 public Routine(int id, RoutineFlags flags, IEnumerator enumerator, Component attachedTo)
 {
     this.id         = id;
     this.flags      = flags;
     this.enumerator = enumerator;
     this.attachedTo = attachedTo;
     this.lastFrame  = -1;
     this.delay      = -1.0f;
 }