コード例 #1
0
ファイル: Signature.cs プロジェクト: tralivali1234/IL2JS
        public PolymorphicMethodEnvironment Enter(TypeEnvironment typeEnv)
        {
            var methodDef = typeEnv.Type.ResolveMethod(this);

            if (methodDef == null)
            {
                throw new InvalidOperationException("unable to resolve method");
            }
            return(typeEnv.AddMethod(methodDef));
        }
コード例 #2
0
ファイル: MemberDef.cs プロジェクト: modulexcite/IL2JS
        internal override void CheckValid(ValidityContext vctxt, TypeEnvironment typeEnv)
        {
            if (Invalid != null || typeEnv.Type.Invalid != null)
                return;

            var methEnv = typeEnv.AddMethod(this).AddSelfMethodBoundArguments();
            for (var i = 0; i < TypeParameters.Count; i++)
            {
                TypeParameters[i].CheckValid(vctxt, methEnv);
                if (TypeParameters[i].Invalid != null)
                {
                    Invalid = new InvalidInfo
                        (MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), TypeParameters[i].Invalid);
                    return;
                }
            }
            var ctxt = MessageContextBuilders.Member(vctxt.Global, typeEnv.Assembly, typeEnv.Type, this);
            foreach (var p in ValueParameters)
            {
                Invalid = p.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                    return;
            }
            if (Result != null)
            {
                Invalid = Result.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                    return;
            }

            if (vctxt.IgnoreMethodDefBody(typeEnv.Assembly, typeEnv.Type, this))
                return;

            foreach (var l in Locals)
            {
                Invalid = l.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                    return;
            }
            var instructions = Instructions(vctxt.Global);
            if (instructions != null)
            {
                foreach (var i in instructions.Body)
                {
                    Invalid = i.CheckValid(vctxt, ctxt, methEnv);
                    if (Invalid != null)
                        return;
                    Invalid = vctxt.ImplementableInstruction(ctxt, methEnv.Assembly, methEnv.Type, this, i);
                    if (Invalid != null)
                        return;
                }
            }

            vctxt.ImplementableMemberDef(typeEnv.Assembly, typeEnv.Type, this);
        }
コード例 #3
0
ファイル: MemberDef.cs プロジェクト: tralivali1234/IL2JS
        internal override void CheckValid(ValidityContext vctxt, TypeEnvironment typeEnv)
        {
            if (Invalid != null || typeEnv.Type.Invalid != null)
            {
                return;
            }

            var methEnv = typeEnv.AddMethod(this).AddSelfMethodBoundArguments();

            for (var i = 0; i < TypeParameters.Count; i++)
            {
                TypeParameters[i].CheckValid(vctxt, methEnv);
                if (TypeParameters[i].Invalid != null)
                {
                    Invalid = new InvalidInfo
                                  (MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), TypeParameters[i].Invalid);
                    return;
                }
            }
            var ctxt = MessageContextBuilders.Member(vctxt.Global, typeEnv.Assembly, typeEnv.Type, this);

            foreach (var p in ValueParameters)
            {
                Invalid = p.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                {
                    return;
                }
            }
            if (Result != null)
            {
                Invalid = Result.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                {
                    return;
                }
            }

            if (vctxt.IgnoreMethodDefBody(typeEnv.Assembly, typeEnv.Type, this))
            {
                return;
            }

            foreach (var l in Locals)
            {
                Invalid = l.Type.CheckValid(vctxt, ctxt, methEnv);
                if (Invalid != null)
                {
                    return;
                }
            }
            var instructions = Instructions(vctxt.Global);

            if (instructions != null)
            {
                foreach (var i in instructions.Body)
                {
                    Invalid = i.CheckValid(vctxt, ctxt, methEnv);
                    if (Invalid != null)
                    {
                        return;
                    }
                    Invalid = vctxt.ImplementableInstruction(ctxt, methEnv.Assembly, methEnv.Type, this, i);
                    if (Invalid != null)
                    {
                        return;
                    }
                }
            }

            vctxt.ImplementableMemberDef(typeEnv.Assembly, typeEnv.Type, this);
        }