Esempio n. 1
0
        public override void Init(AstContext context, ParseTreeNode parseNode)
        {
            // className
            var classNameChildren = AstChildren.Empty()
                                    .Add <ClassNameAstNode>();

            if (classNameChildren.PopulateWith(parseNode))
            {
                TypeSpec = new CilTypeSpec
                {
                    ClassName = classNameChildren.Child1.ClassName
                };

                return;
            }

            // type
            var typeChildren = AstChildren.Empty()
                               .Add <TypeAstNode>();

            if (typeChildren.PopulateWith(parseNode))
            {
                TypeSpec = new CilTypeSpec
                {
                    Type = typeChildren.Child1.Type
                };

                return;
            }

            throw new NotImplementedException();
        }
Esempio n. 2
0
        public static Type GetExternalType(CilTypeSpec typeSpec, CilProgram program)
        {
            if (typeSpec.ClassName != null)
            {
                return(GetExternalType(typeSpec.ClassName));
            }

            return(typeSpec.Type.GetRuntimeType(program));
        }
Esempio n. 3
0
        public bool IsInstanceOf(CilTypeSpec typeSpec, CilProgram program)
        {
            var cilType = typeSpec.GetCilType(program);

            if (cilType is CilTypeClass cilTypeClass)
            {
                if (cilTypeClass.ClassName.ToString() == this.Class.Name.ToString())
                {
                    return(true);
                }

                throw new System.NotImplementedException();
            }
            else
            {
                throw new System.NotImplementedException();
            }
        }