public MidBuiltinMethodRef( MidBuiltinMethodDecl decl, MidMemberTerm memberTerm) { _decl = decl; _memberTerm = memberTerm; }
public MidBuiltinApp( SourceRange range, MidBuiltinMethodDecl decl, IEnumerable <MidVal> args) : base(range, decl.ResultType) { _decl = decl; _args = args.ToArray(); }
public MidBuiltinApp( SourceRange range, MidBuiltinMethodDecl decl, IEnumerable<MidVal> args) : base(range, decl.ResultType) { _decl = decl; _args = args.ToArray(); }
private MidMemberDecl EmitMemberDeclImpl( IBuilder parent, IResMethodDecl resMethod, MidEmitEnv env) { var builtinTags = (from tag in resMethod.Line.Tags let builtinTag = tag as ResBuiltinTag where builtinTag != null select builtinTag).ToArray(); if (resMethod.Body != null) { // Don't use builtin version if there's an inline impl (probably // because its an override...) builtinTags = new ResBuiltinTag[] { }; } IMidMethodDecl midMethod = null; if (builtinTags.Length != 0) { midMethod = new MidBuiltinMethodDecl( parent, resMethod.Name, builtinTags); } else { midMethod = new MidMethodDecl( parent, resMethod.Name, _exps); } midMethod.AddBuildAction(() => { var resultType = EmitTypeExp(resMethod.ResultType, env); midMethod.ResultType = resultType; var midParams = (from p in resMethod.Parameters select new MidVar(p.Name, EmitTypeExp(p.Type, env))).ToArray(); midMethod.Parameters = midParams; if (resMethod.Body != null && !IsCrossFrequencyMethod(resMethod)) { var paramEnv = new MidGlobalEmitEnv(env, env.Context); foreach (var pair in midParams.Zip(resMethod.Parameters, Tuple.Create)) { var midParam = pair.Item1; var resParam = pair.Item2; paramEnv.Insert(resParam, (SourceRange r) => new MidVarRef(r, midParam)); } ((MidMethodDecl)midMethod).Body = EmitLocalExp(resMethod.Body, paramEnv); } }); midMethod.DoneBuilding(); if ((parent is MidFacetDecl) && (midMethod is MidMethodDecl)) { ((MidFacetDecl)parent).AddMethod((MidMethodDecl)midMethod); } return((MidMemberDecl)midMethod); }