public override bool VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context) { var name = context.memberName()?.GetText(); if (!string.IsNullOrEmpty(name)) { if (name.Equals("var", StringComparison.OrdinalIgnoreCase)) { var arguments = context.customFunctionEnclosedArgumentList()?.customFunctionEnclosedArgumentListInner()?.customFunctionEnclosedArgument(); if (arguments != null && arguments.Length > 1) { repository.DefineGlobalVariable(arguments[0].GetText().Trim()); } else if (arguments == null || arguments.Length == 0) { var chainedName = new FirstChainedMemberAccessNameVisitor().Visit(context); if (!string.IsNullOrEmpty(chainedName)) { repository.DefineGlobalVariable(chainedName); } } } } return(base.VisitCustomMemberAccess(context)); }
public override IParseTree[] VisitCustomMemberAccess([NotNull] sphereScript99Parser.CustomMemberAccessContext context) { if (!CanVisitCustomMemberAccess(context)) { return(base.VisitCustomMemberAccess(context)); } var arguments = context.customFunctionEnclosedArgumentList()?.customFunctionEnclosedArgumentListInner()?.customFunctionEnclosedArgument(); if (arguments != null && arguments.Length > 0) { return(arguments); } else { return(Array.Empty <IParseTree>()); } }