///<summary>Gets the restricted calls from the unfilled optional parameters.</summary> public void CheckOptionalsRestrictedCalls(ParseInfo parseInfo, DocRange callRange) { // Iterate through each parameter. for (int i = 0; i < OrderedParameters.Length; i++) { // Check if the parameter is prefilled, which means the parameter is optional and not set. if (OrderedParameters[i].Prefilled) { // Add the restricted call. foreach (RestrictedCallType callType in Option.Parameters[i].RestrictedCalls) { parseInfo.RestrictedCallHandler.RestrictedCall(new RestrictedCall( callType, parseInfo.GetLocation(callRange), RestrictedCall.Message_UnsetOptionalParameter(Option.Parameters[i].Name, Option.GetLabel(false), callType) )); } } } }
public IExpression Apply(IVariable variable, IExpression[] index, DocRange variableRange) { // Callable if (variable is ICallable callable) { Call(callable, variableRange); } // IIndexReferencers are wrapped by CallVariableActions. if (variable is IIndexReferencer referencer) { // If the type of the variable being called is Player, check if the variable is calling Event Player. // If the source expression is null, Event Player is used by default. // Otherwise, confirm that the source expression is returning the player variable scope. if (referencer.VariableType == VariableType.Player) { EventPlayerRestrictedCall(new RestrictedCall(RestrictedCallType.EventPlayer, _parseInfo.GetLocation(variableRange), RestrictedCall.Message_EventPlayerDefault(referencer.Name))); } // If there is a local variable tracker and the variable requires capture. if (referencer.RequiresCapture) { _parseInfo.LocalVariableAccessed(referencer); } return(new CallVariableAction(referencer, index)); } // Check value in array. if (index != null && index.Length > 0) { if (!variable.CanBeIndexed) { Error("This variable type cannot be indexed.", variableRange); } else { return(new ValueInArrayAction(_parseInfo, (IExpression)variable, index)); } } // Function group. if (variable is MethodGroup methodGroup) { return(new CallMethodGroup(_parseInfo, variableRange, methodGroup)); } return((IExpression)variable); }
void DefaultEventPlayerRestrictedCall() => _parseInfo.RestrictedCallHandler.AddRestrictedCall( new RestrictedCall(RestrictedCallType.EventPlayer, _parseInfo.GetLocation(CallRange), RestrictedCall.Message_EventPlayerDefault(_name)) );
public void Call(ParseInfo parseInfo, DocRange callRange) { parseInfo.Script.AddDefinitionLink(callRange, DefinedAt); parseInfo.Script.AddHover(callRange, GetLabel(true)); parseInfo.TranslateInfo.GetComponent <SymbolLinkComponent>().AddSymbolLink(this, new Location(parseInfo.Script.Uri, callRange)); parseInfo.CurrentCallInfo?.Call(_recursiveCallHandler, callRange); OnBlockApply(new MacroVarRestrictedCallHandler(this, parseInfo.RestrictedCallHandler, parseInfo.GetLocation(callRange))); }
public override void Call(ParseInfo parseInfo, DocRange callRange) { parseInfo.Script.AddDefinitionLink(callRange, DefinedAt); parseInfo.CurrentCallInfo?.Call(_recursiveCallHandler, callRange); ((DefinedType)Type).AddLink(parseInfo.GetLocation(callRange)); }