int CreateFunctionInstance(TypeBase args, FunctionSyntax syntax, CompoundView compoundView) { var index = _list.Count; var f = new FunctionType(index, syntax, compoundView, args); _list.Add(f); return index; }
internal static Result<Parser.Value> Create (Syntax left, bool isImplicit, bool isMetaFunction, Syntax right, Syntax syntax) { var leftvalue = left?.Value; var rightvalue = right?.Value; var target = new FunctionSyntax (leftvalue?.Target, isImplicit, isMetaFunction, rightvalue?.Target,syntax); var issues = leftvalue?.Issues.plus(rightvalue?.Issues); return new Result<Parser.Value>(target, issues); }
internal FunctionType (int index, FunctionSyntax body, CompoundView compoundView, TypeBase argsType) { Getter = new GetterFunction(this, index, body.Getter); Setter = body.Setter == null ? null : new SetterFunction(this, index, body.Setter); Index = index; Body = body; _compoundView = compoundView; ArgsType = argsType; StopByObjectIds(); }
internal IEnumerable<FunctionType> Find(FunctionSyntax syntax, CompoundView compoundView) => _dictionary[syntax][compoundView].Select(item => _list[item.Value]);
internal FunctionType Find (FunctionSyntax syntax, CompoundView compoundView, TypeBase argsType) { var index = _dictionary[syntax][compoundView][argsType]; return _list[index]; }
internal IEnumerable<FunctionType> Functions(FunctionSyntax body) => Compound .Root .FunctionInstances(this, body);
internal FunctionType Function(FunctionSyntax body, TypeBase argsType) => Compound .Root .FunctionInstance(this, body, argsType);
IConversion ConversionFunction(FunctionSyntax body) { IConversion result = new ConverterAccess(Function(body, Root.VoidType), Type); var source = result.Source; Tracer.Assert(source == Type.Pointer, source.Dump); Tracer.Assert(source == result.Result(Category.Code).Code.ArgType); return result; }
internal TypeBase FunctionalType(FunctionSyntax syntax) => _functionBodyTypeCache[syntax];