public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
        {
            var name = firstMemberAccessNameVisitor.Visit(context);

            if (!name.Equals("safe", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            return(base.VisitFirstMemberAccess(context));
        }
Exemple #2
0
        public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
        {
            if (context.customMemberAccess()?.chainedMemberAccess() != null)
            {
                parentTranspiler.Visit(context.customMemberAccess()?.chainedMemberAccess());
            }
            else if (context.genericNativeMemberAccess()?.nativeMemberAccess()?.chainedMemberAccess() != null)
            {
                parentTranspiler.Visit(context.genericNativeMemberAccess()?.nativeMemberAccess()?.chainedMemberAccess());
            }

            return(true);
        }
        public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
        {
            var name = new FirstMemberAccessNameVisitor().Visit(context);

            if (name.Equals("setlocation", StringComparison.OrdinalIgnoreCase))
            {
                var arguments = new FinalChainedMemberAccessArgumentsVisitor().Visit(context);
                if (arguments != null && arguments.Length > 0)
                {
                    parentTranspiler.AppendArguments(arguments);
                    builder.AppendLine();
                    return(true);
                }
            }

            return(base.VisitFirstMemberAccess(context));
        }
        public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
        {
            var name = firstMemberAccessNameVisitor.Visit(context);

            IParseTree[] arguments = firstMemberAccessArgumentsVisitor.Visit(context);

            if (IsSpecialFunction(name))
            {
                builder.EnsureEvalCall("eval", () =>
                {
                    builder.Append(name);

                    builder.Append('(');
                    if (name.Equals("strmatch", StringComparison.OrdinalIgnoreCase))
                    {
                        builder.StartSpecialFunctionArguments();
                        transpiler.Visit(arguments[1]);
                        builder.Append(',');
                        transpiler.Visit(arguments[0]);
                        builder.EndSpecialFunctionArguments();
                    }
                    else
                    {
                        if (name.Equals("strcmpi", StringComparison.OrdinalIgnoreCase) ||
                            name.Equals("strcmp", StringComparison.OrdinalIgnoreCase))
                        {
                            builder.StartSpecialFunctionArguments();
                            QuoteIntrinsicArgument(arguments[0]);
                            builder.Append(',');
                            QuoteIntrinsicArgument(arguments[1]);
                            builder.EndSpecialFunctionArguments();
                        }
                        else
                        {
                            UnquoteIntrinsicArgument(arguments[0]);
                        }
                    }
                    builder.Append(')');
                });

                return(true);
            }

            return(false);
        }
        public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
        {
            transpiler.Visit(context);

            return(true);
        }
            public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
            {
                result.Append(context.GetText());

                return(true);
            }
Exemple #7
0
 public override bool VisitFirstMemberAccess([NotNull] sphereScript99Parser.FirstMemberAccessContext context)
 {
     return(context.customMemberAccess()?.chainedMemberAccess() != null ||
            context.genericNativeMemberAccess()?.nativeMemberAccess()?.chainedMemberAccess() != null);
 }