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(); }
public static Type GetExternalType(CilTypeSpec typeSpec, CilProgram program) { if (typeSpec.ClassName != null) { return(GetExternalType(typeSpec.ClassName)); } return(typeSpec.Type.GetRuntimeType(program)); }
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(); } }