public override void CheckSemantic(IASTContext context) { if (Instance != null) { Instance.CheckSemantic(context); Function = context.GetFunctionDeclaration(Instance.NetType, Name); } else { Function = context.GetFunctionDeclaration(Name); } if (Function == null) { throw new RecognitionException($"Function {Name} not found in context", Col, Row); } Type = Function.ReturnType; NetType = Function.ReturnNetType; foreach (var parameter in Parameters) { parameter.CheckSemantic(context); } if (!Function.CheckParamterTypes(Parameters)) { throw new RecognitionException($"Function {Name} parameters does not match", Col, Row); } }
public override void CheckSemantic(IASTContext context) { if (Instance != null) { Instance.CheckSemantic(context); Function = context.GetFunctionDeclaration(Instance.NetType, Name); } else { Function = context.GetFunctionDeclaration(Name); } if (Function == null) { throw new RecognitionException($"Function {Name} not found in context", Col, Row); } Type = Function.ReturnType; NetType = Function.ReturnNetType; if (Function.IsQueryMethod) { var genArg = Instance.NetType.GetGenericArguments(); _parameter = System.Linq.Expressions.Expression.Parameter(genArg[0]); context = new QueryASTContext { ModelType = genArg[0], Parameter = _parameter }; } foreach (var parameter in Parameters) { parameter.CheckSemantic(context); } if (!Function.IsQueryMethod && !Function.CheckParamterTypes(Parameters)) { throw new RecognitionException($"Function {Name} parameters does not match", Col, Row); } }
public FunctionDeclaration GetFunctionDeclaration(string name) { return(parent.GetFunctionDeclaration(name)); }