public bool TryGet(string name, IEnumerable <InjectionValue> argumentValues, out NativeSubrutineDefinition subrutineDefinition)
        {
            var key = NativeSubrutineDefinition.GetSignature(name, argumentValues);

            if (subrutines.TryGetValue(key, out var value))
            {
                subrutineDefinition = value;
                return(true);
            }

            key = NativeSubrutineDefinition.GetAnySignature(name, argumentValues);
            if (subrutines.TryGetValue(key, out value))
            {
                subrutineDefinition = value;
                return(true);
            }

            subrutineDefinition = null;
            return(false);
        }
Exemple #2
0
        private bool TryGetObjectSubrutine(string name, InjectionValue[] argumentValues, out NativeSubrutineDefinition nativeSubrutine)
        {
            var segments = name.Split('.');

            if (segments.Length == 2)
            {
                string varName = segments[0];

                if (semanticScope.TryGetVar(varName, out InjectionValue value) && value.Kind == InjectionValueKind.Object)
                {
                    string subrutineName = segments[1];
                    if (value.Object.TryGet(subrutineName, argumentValues, out nativeSubrutine))
                    {
                        return(true);
                    }
                }
            }

            nativeSubrutine = null;
            return(false);
        }
Exemple #3
0
 public bool TryGetIntrinsicVariable(string name, out NativeSubrutineDefinition variable)
 => intrinsicVariables.TryGetValue(name, out variable);
Exemple #4
0
 public bool TryGetNativeSubrutine(string name, IEnumerable <InjectionValue> argumentValues, out NativeSubrutineDefinition subrutineDefinition)
 => nativeSubrutines.TryGet(name, argumentValues, out subrutineDefinition);
Exemple #5
0
 public void AddIntrinsicVariable(NativeSubrutineDefinition subrutineDef)
 => intrinsicVariables.Add(subrutineDef.Name, subrutineDef);
Exemple #6
0
 public void Add(NativeSubrutineDefinition subrutineDef)
 => nativeSubrutines.Add(subrutineDef);
 public void Add(NativeSubrutineDefinition subrutineDef)
 => subrutines.Add(subrutineDef.GetSignature(), subrutineDef);