예제 #1
0
 public virtual void VisitInclude(BoundIncludeEx x)
 {
     VisitRoutineCall(x);
 }
예제 #2
0
 public virtual void VisitInclude(BoundIncludeEx x)
 {
     VisitRoutineCall(x);
 }
 public virtual TResult VisitInclude(BoundIncludeEx x) => VisitRoutineCall(x);
예제 #4
0
        public override void VisitInclude(BoundIncludeEx x)
        {
            this.Routine.Flags |= RoutineFlags.HasInclude;

            VisitRoutineCall(x);

            // resolve target script
            Debug.Assert(x.ArgumentsInSourceOrder.Length == 1);
            var targetExpr = x.ArgumentsInSourceOrder[0].Value;

            //
            x.Target = null;

            if (targetExpr.ConstantValue.HasValue)
            {
                var value = targetExpr.ConstantValue.Value as string;
                if (value != null)
                {
                    var targetFile = _model.GetFile(value);
                    if (targetFile != null)
                    {
                        x.Target = targetFile.MainMethod;
                    }
                }
            }

            // resolve result type
            if (x.Access.IsRead)
            {
                var target = x.Target;
                if (target != null)
                {
                    x.ResultType = target.ReturnType;
                    x.TypeRefMask = target.GetResultType(TypeCtx);

                    if (x.IsOnceSemantic)
                    {
                        // include_once, require_once returns TRUE in case the script was already included
                        x.TypeRefMask |= TypeCtx.GetBooleanTypeMask();
                    }
                }
                else
                {
                    x.TypeRefMask = TypeRefMask.AnyType;
                }
            }
            else
            {
                x.TypeRefMask = 0;
            }

            //
            VisitRoutineCallEpilogue(x);
        }