public CandidateFunctionMember(MethPropWithInst mpwi, TypeArray @params, byte ctypeLift, bool fExpanded) { this.mpwi = mpwi; this.@params = @params; this.ctypeLift = ctypeLift; this.fExpanded = fExpanded; }
public static ObjectActivator CreateDelegate(Type objectType, params Type[] constructorArgumentTypes) { var typeList = new List<Type> { objectType }; if (constructorArgumentTypes.Length > 0) { typeList.AddRange(constructorArgumentTypes); } var key = new TypeArray(typeList); return ActivatorCache.GetOrAdd(key, k => GenerateDelegate(k.First, k.Rest)); }
public override void VisitTypeArray(ASTTypeArray n) { _lastSeenType = CheckSubTree(n.BaseType); n.Type = _lastSeenType = new TypeArray(_lastSeenType); }
public void ObjectIsAccesptedForClasses() { var t = new TypeArray <Base>(new[] { typeof(object) }, true); Assert.AreEqual(1, t.Memebers.Count); }
public void ObjectIsNotAccesptedForInterfaces() { var t = new TypeArray <IBase>(new[] { typeof(object) }); Assert.AreEqual(0, t.Memebers.Count); }
public void CheckBaseInterfaceAgainstInheritatedInterfaces() { var t = new TypeArray <IBase>(new[] { typeof(ISub) }); Assert.AreEqual(1, t.Memebers.Count); }
public void CheckBaseClassAgainstItsInterface() { var t = new TypeArray <Base>(new[] { typeof(IBase) }); Assert.AreEqual(0, t.Memebers.Count); }
public void CheckBaseInterface() { var t = new TypeArray <IBase>(new[] { typeof(IBase) }); Assert.AreEqual(1, t.Memebers.Count); }
//------------------------------------------------------------ // MetaDataHelper.GetExplicitImplTypeName // /// <summary></summary> /// <param name="typeSym"></param> /// <param name="strBuilder"></param> //------------------------------------------------------------ public void GetExplicitImplTypeName(TYPESYM typeSym, StringBuilder strBuilder) { #if DEBUG if (!(typeSym != null)) { ; } #endif DebugUtil.Assert(typeSym != null); TYPESYM nakedTypeSym = typeSym.GetNakedType(false); TypeArray typeArgs = null; switch (nakedTypeSym.Kind) { default: DebugUtil.Assert(false, "Unhandled type in GetExplicitImplTypeName"); return; case SYMKIND.TYVARSYM: strBuilder.Append(nakedTypeSym.Name); break; case SYMKIND.NUBSYM: nakedTypeSym = (nakedTypeSym as NUBSYM).GetAggTypeSym(); if (nakedTypeSym == null) { DebugUtil.Assert(false, "Why did GetAts return null?"); return; } // Fall through. goto case SYMKIND.AGGTYPESYM; case SYMKIND.AGGTYPESYM: { AGGTYPESYM outerAggTypeSym = (nakedTypeSym as AGGTYPESYM).OuterTypeSym; AGGSYM aggSym = nakedTypeSym.GetAggregate(); if (outerAggTypeSym != null) { GetExplicitImplTypeName(outerAggTypeSym, strBuilder); strBuilder.Append('.'); } else { DebugUtil.Assert(aggSym.ParentBagSym != null && !aggSym.ParentBagSym.IsAGGSYM); int cch = strBuilder.Length; GetFullName(aggSym.ParentBagSym, strBuilder, aggSym); if (cch < strBuilder.Length) { strBuilder.Append('.'); } } strBuilder.Append(aggSym.Name); typeArgs = (nakedTypeSym as AGGTYPESYM).TypeArguments; } break; case SYMKIND.ERRORSYM: { ERRORSYM errSym = nakedTypeSym as ERRORSYM; SYM parentSym = errSym.ParentSym; if (parentSym != null && parentSym.IsTYPESYM) { GetExplicitImplTypeName(parentSym as TYPESYM, strBuilder); strBuilder.Append('.'); } else if (parentSym != null && parentSym.IsNSAIDSYM) { parentSym = (parentSym as NSAIDSYM).NamespaceSym; int cch = strBuilder.Length; GetFullName(parentSym, strBuilder, errSym); if (cch < strBuilder.Length) { strBuilder.Append('.'); } } strBuilder.Append(errSym.ErrorName); typeArgs = errSym.TypeArguments; } break; } if (typeArgs != null && typeArgs.Count > 0) { strBuilder.Append('<'); for (int i = 0; i < typeArgs.Count; ++i) { if (i > 0) { strBuilder.Append(','); } GetExplicitImplTypeName(typeArgs[i], strBuilder); } strBuilder.Append('>'); } // Add ptr and array modifiers AddTypeModifiers(typeSym, strBuilder); }
public bool Equals([AllowNull] Gradient other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) && (Equals(TypeArray, other.TypeArray) || TypeArray != null && other.TypeArray != null && TypeArray.SequenceEqual(other.TypeArray)) && (Color == other.Color && Color != null && other.Color != null && Color.Equals(other.Color)) && (Equals(ColorArray, other.ColorArray) || ColorArray != null && other.ColorArray != null && ColorArray.SequenceEqual(other.ColorArray)) && (TypeSrc == other.TypeSrc && TypeSrc != null && other.TypeSrc != null && TypeSrc.Equals(other.TypeSrc)) && (ColorSrc == other.ColorSrc && ColorSrc != null && other.ColorSrc != null && ColorSrc.Equals(other.ColorSrc))); }
protected ValueArraySparse(TypeArray valueType) { ValueArrayType = valueType; }
public void GreenQuadReflectionTest() { byte[] vertexByteCode; byte[] framentByteCode; { var const_1f = new Constant(-1.0f); var const1f = new Constant(1.0f); var const0f = new Constant(0.0f); var const0i = new Constant(0); var arrayType = new TypeArray(SpirvTypeBase.Vec4, 4); var a = new ConstantComposite(SpirvTypeBase.Vec4, const_1f, const1f, const0f, const1f); var b = new ConstantComposite(SpirvTypeBase.Vec4, const1f, const1f, const1f, const1f); var c = new ConstantComposite(SpirvTypeBase.Vec4, const_1f, const_1f, const0f, const1f); var d = new ConstantComposite(SpirvTypeBase.Vec4, const1f, const_1f, const1f, const1f); var positions = new ConstantComposite(arrayType, a, b, c, d); var clipArrayType = new TypeArray(SpirvTypeBase.Float, 1); var gl_PerVertex = new TypeStruct("gl_PerVertex", new TypeStructureField(SpirvTypeBase.Vec4, "gl_Position") .WithDecoration(Decoration.BuiltIn(BuiltIn.Position())), new TypeStructureField(SpirvTypeBase.Float, "gl_PointSize") .WithDecoration(Decoration.BuiltIn(BuiltIn.PointSize())), new TypeStructureField(clipArrayType, "gl_ClipDistance") .WithDecoration(Decoration.BuiltIn(BuiltIn.ClipDistance())), new TypeStructureField(clipArrayType, "gl_CullDistance") .WithDecoration(Decoration.BuiltIn(BuiltIn.CullDistance())) ).WithDecoration(Decoration.Block()); var outputVar = new Variable(gl_PerVertex.MakePointer(StorageClass.Output()), StorageClass.Output(), null, ""); var localVar = new Variable( arrayType.MakePointer(StorageClass.Function()), StorageClass.Function(), null, "indexable"); Node positionPointer = new AccessChain(SpirvTypeBase.Vec4.MakePointer(StorageClass.Output()), outputVar, new[] { const0i }); var glVertexIndex = Variable.gl_VertexIndex(); Node position = new Load(SpirvTypeBase.Vec4, new AccessChain(SpirvTypeBase.Vec4.MakePointer(StorageClass.Function()), localVar, new Node[] { new Load(SpirvTypeBase.Int, glVertexIndex, null) }), null); var vertexShaderMain = new Function(Spv.FunctionControl.Enumerant.None, new TypeFunction() { ReturnType = SpirvTypeBase.Void }, "main") .SetUp(_ => _ .ThenLabel() .ThenStore(localVar, positions, null) .ThenStore(positionPointer, position, null) .ThenReturn() ); var reflection = new ShaderReflection() .WithCapability(Capability.Shader()) .WithExtInstImport("GLSL.std.450") .WithMemoryModel(AddressingModel.Logical(), MemoryModel.GLSL450()) .WithEntryPoint(ExecutionModel.Vertex(), vertexShaderMain, "main"); var shader = reflection .BuildShader(); vertexByteCode = shader.Build(); Console.WriteLine("-----------------------"); Node node = reflection.EntryPointInstructions.First().Value; while (node != null) { Console.WriteLine($".Then(new {node})"); node = node.GetNext(); } //var vertexSource = @"#version 450 //#extension GL_KHR_vulkan_glsl : enable //const vec4 QuadInfos[4] = //{ // vec4(-1, 1, 0, 1), // vec4(1, 1, 1, 1), // vec4(-1, -1, 0, 1), // vec4(1, -1, 1, 1), //}; //void main() //{ // gl_Position = QuadInfos[gl_VertexIndex]; //}"; //vertexByteCode = ShaderTestBase.CompileToBytecode(vertexSource, ShaderStages.Vertex, true, true); } { var const0f = new Constant(0.0f); var const1f = new Constant(1.0f); var redColor = new ConstantComposite(SpirvTypeBase.Vec4, const0f, const1f, const0f, const1f); var v = new Variable(SpirvTypeBase.Vec4.MakePointer(StorageClass.Output()), StorageClass.Output(), null, "fsout_Color0") { Location = 0 }; var fragmentShaderMain = new Function(Spv.FunctionControl.Enumerant.None, new TypeFunction(SpirvTypeBase.Void), "main") .SetUp(_ => _ .ThenLabel() .ThenStore(v, redColor, null) .ThenReturn() ); var reflection = new ShaderReflection() .WithCapability(Capability.Shader()) .WithExtInstImport("GLSL.std.450") .WithMemoryModel(AddressingModel.Logical(), MemoryModel.GLSL450()) .WithEntryPoint(ExecutionModel.Fragment(), fragmentShaderMain, "main") .WithExecutionMode(fragmentShaderMain, ExecutionMode.OriginUpperLeft()); var shader = reflection .BuildShader(); framentByteCode = shader .Build(); Console.WriteLine("-----------------------"); Node node = reflection.EntryPointInstructions.First().Value; while (node != null) { Console.WriteLine($".Then(new {node})"); node = node.GetNext(); } // var fragmentSource = @"#version 450 //layout(location = 0) out vec4 fsout_Color0; //void main() //{ // fsout_Color0 = vec4(0,1,0,1); //}"; // framentByteCode = ShaderTestBase.CompileToBytecode(fragmentSource, ShaderStages.Fragment, true, true); } { var glsl = Veldrid.SPIRV.SpirvCompilation.CompileVertexFragment(vertexByteCode, framentByteCode, CrossCompileTarget.GLSL); Console.WriteLine(glsl.VertexShader); Console.WriteLine(glsl.FragmentShader); } var shaders = ResourceFactory.CreateFromSpirv( new ShaderDescription(ShaderStages.Vertex, vertexByteCode, "main"), new ShaderDescription(ShaderStages.Fragment, framentByteCode, "main")); var readRenderTargetPixel = RenderQuad(shaders); Assert.AreEqual(new RgbaByte(0, 255, 0, 255), readRenderTargetPixel); }
//public virtual void AcceptVisitor(IASTNodeAcyclicVisitor visitor) //{ // if (visitor is IASTNodeAcyclicVisitor<ValueArray>) // ((IASTNodeAcyclicVisitor<ValueArray>)visitor).Visit(this); // //You can write fall back logic here if needed. //} public static ValueArray Create(TypeArray valueType, IEnumerable <ILanguageValue> value) { return(new ValueArray(valueType, value)); }
protected ValueArray(TypeArray valueType, IEnumerable <ILanguageValue> value) { ValueArrayType = valueType; Value.AddRange(value); }
public override void Process() { if (FieldList == null) { throw new Exception("Filed csharp is null."); } string defName = GetFileName(Option.CSharpPath); // 创建代码字符串 StringBuilder sbTab = new StringBuilder(); sbTab.AppendLine( @"// ======================================== // Copyright (c) 2017 KingSoft, All rights reserved. // http://www.kingsoft.com // // Generated Code // // Date: 2017/05/24 // Author: xiangjinbao // Email: [email protected] // ========================================" ); sbTab.AppendLine(); sbTab.AppendLine("using xsj.framework;"); sbTab.AppendLine(); sbTab.AppendLine("namespace xsj"); sbTab.AppendLine("{"); if (this.ClassComment != null) { sbTab.AppendLine(this.ClassComment); } sbTab.AppendFormat("\tpublic class {0} : AbsTabData\r\n\t{{", defName.Replace("_", "")); sbTab.AppendLine(); foreach (FieldDef field in FieldList) { sbTab.AppendFormat("\t\t// {0}", field.comment); sbTab.AppendLine(); string fieldType = field.type.ToLower().Trim(); string fieldTypeMapping = null; if (!TypeArray.TryGetValue(fieldType, out fieldTypeMapping)) { throw new Exception(string.Format("Error type {0}", fieldType)); } sbTab.AppendFormat("\t\tpublic {0} {1}", fieldTypeMapping, field.name); sbTab.AppendLine(" {"); sbTab.AppendFormat("\t\t\tget;"); sbTab.AppendLine(); sbTab.AppendFormat("\t\t\tset;"); sbTab.AppendLine(); sbTab.AppendLine("\t\t}"); } sbTab.Append("\t}"); sbTab.AppendLine(); sbTab.AppendLine(); // 创建代码字符串 StringBuilder sbConf = new StringBuilder(); sbConf.AppendFormat("\tpublic class {0}Config : AbsTabConfig\r\n\t{{", defName.Replace("_", "")); sbConf.AppendLine(); sbConf.AppendFormat("\t\tpublic const string FILE_NAME = \"Assets/Arts/Config/Tab/{0}.tab.txt\";\n", defName.ToLower().Replace("_", "")); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic enum Cols"); sbConf.AppendLine("\t\t{"); foreach (FieldDef field in FieldList) { sbConf.AppendFormat("\t\t\t{0},\n", field.name.ToUpper()); } sbConf.AppendLine("\t\t}"); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic override void Init()"); sbConf.AppendLine("\t\t{"); sbConf.AppendLine("\t\t\tFacade.Config.Load<TabReaderImpl>(FILE_NAME, this, false);"); sbConf.AppendLine("\t\t}"); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic override void OnRow(ITabRow row) \n\t\t{"); sbConf.AppendFormat("\t\t\t{0} tab = new {1}();\n", defName.Replace("_", ""), defName.Replace("_", "")); foreach (FieldDef field in FieldList) { string typeName = field.type.Substring(0, 1).ToUpper() + field.type.Substring(1); sbConf.AppendFormat("\t\t\ttab.{0} = row.Get{1}((int)Cols.{2});\n", field.name, typeName, field.name.ToUpper()); } sbConf.AppendLine(); sbConf.AppendFormat("\t\t\tif (!ConfigMap.ContainsKey(tab.{0}.ToString())) {{\n", FieldList[0].name); sbConf.AppendFormat("\t\t\t\tConfigMap.Add(tab.{0}.ToString(), tab);\n", FieldList[0].name); sbConf.AppendLine("\t\t\t}"); sbConf.AppendLine("\t\t}"); sbConf.AppendLine("\t}"); sbConf.AppendLine("}"); StringBuilder sb = new StringBuilder(); sb.Append(sbTab.ToString()); sb.Append(sbConf.ToString()); // 写文件 string p = GetFileName(Option.CSharpPath); p = string.Format("{0}/{1}Config.cs", "Assets/Scripts/Auto/Config/Tab", p.Replace("_", "")); p = Path.Combine(Path.GetDirectoryName(Option.CSharpPath), p); // 写文件 WriteFile(p, sb.ToString(), Coding); }
public override void Process(bool isOver = true) { if (FieldList == null) { throw new Exception("Filed csharp is null."); } string defName = GetFileName(Option.CSharpPath); // 创建代码字符串 StringBuilder sbTab = new StringBuilder(); sbTab.AppendLine( @"// ======================================== // Copyright (c) 2017 KingSoft, All rights reserved. // http://www.kingsoft.com // // Generated Code // // Date: 2017/05/24 // Author: xiangjinbao // Email: [email protected] // ========================================" ); sbTab.AppendLine(); sbTab.AppendLine("using xsj.framework;"); sbTab.AppendLine(); sbTab.AppendLine("namespace xsj"); sbTab.AppendLine("{"); if (this.ClassComment != null) { sbTab.AppendLine(this.ClassComment); } sbTab.AppendFormat("\tpublic class {0} : AbsTabData\r\n\t{{", defName.Replace("_", "")); sbTab.AppendLine(); Dictionary <string, List <FieldDef> > repeatFieldmap = new Dictionary <string, List <FieldDef> >(); foreach (FieldDef field in FieldList) { sbTab.AppendFormat("\t\t// {0}", field.comment); sbTab.AppendLine(); string fieldType = field.type.ToLower().Trim(); string fieldTypeMapping = null; if (!TypeArray.TryGetValue(fieldType, out fieldTypeMapping)) { throw new Exception(string.Format("Error type {0}", fieldType)); } sbTab.AppendFormat("\t\tpublic {0} {1}", fieldTypeMapping, field.name); sbTab.AppendLine(); sbTab.AppendLine("\t\t{"); sbTab.AppendFormat("\t\t\tget;"); sbTab.AppendLine(); sbTab.AppendFormat("\t\t\tset;"); sbTab.AppendLine(); sbTab.AppendLine("\t\t}"); string suffix = field.name.Trim().Substring(field.name.Length - 1); string prefix = field.name.Trim().Substring(0, field.name.Length - 1); if (IsInt(suffix)) { List <FieldDef> fieldList = null; if (!repeatFieldmap.TryGetValue(prefix, out fieldList)) { fieldList = new List <FieldDef>(); repeatFieldmap.Add(prefix, fieldList); } fieldList.Add(field); } } foreach (KeyValuePair <string, List <FieldDef> > pair in repeatFieldmap) { sbTab.AppendLine(); sbTab.AppendFormat("\t\tpublic {0}[] Get{1}Array() \n\t\t{{\n", TypeArray[pair.Value[0].type.ToLower().Trim()], pair.Key.Replace("_", string.Empty)); sbTab.AppendFormat("\t\t\treturn new {0}[] {{", TypeArray[pair.Value[0].type.ToLower().Trim()]); int index = 0; foreach (FieldDef field in pair.Value) { index++; if (index == pair.Value.Count) { sbTab.AppendFormat("{0}", field.name); } else { sbTab.AppendFormat("{0}, ", field.name); } } sbTab.Append(" };"); sbTab.AppendLine(); sbTab.AppendLine("\t\t}"); } sbTab.Append("\t}"); sbTab.AppendLine(); sbTab.AppendLine(); // 创建代码字符串 StringBuilder sbConf = new StringBuilder(); sbConf.AppendFormat("\tpublic class {0}Config : AbsTabConfig\r\n\t{{", defName.Replace("_", "")); sbConf.AppendLine(); sbConf.AppendFormat("\t\tprivate const string FILE_NAME = \"Assets/Arts/Config/Tab/{0}.tab.txt\";\n", defName.ToLower().Replace("_", "")); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic enum Cols"); sbConf.AppendLine("\t\t{"); foreach (FieldDef field in FieldList) { sbConf.AppendFormat("\t\t\t{0},\n", field.name.ToUpper()); } sbConf.AppendLine("\t\t}"); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic override void Init()"); sbConf.AppendLine("\t\t{"); sbConf.AppendLine("\t\t\tConfig.Load<TabReaderImpl>(FILE_NAME, this, false);"); sbConf.AppendLine("\t\t}"); sbConf.AppendLine(); sbConf.AppendLine("\t\tpublic override void OnRow(ITabRow row) \n\t\t{"); sbConf.AppendFormat("\t\t\t{0} tab = new {1}();\n", defName.Replace("_", ""), defName.Replace("_", "")); foreach (FieldDef field in FieldList) { string typeName = field.type.Substring(0, 1).ToUpper() + field.type.Substring(1); sbConf.AppendFormat("\t\t\ttab.{0} = row.Get{1}((int)Cols.{2});\n", field.name, typeName, field.name.ToUpper()); } sbConf.AppendLine(); sbConf.AppendFormat("\t\t\tif (!ConfigMap.ContainsKey(tab.{0}.ToString())) {{\n", FieldList[0].name); sbConf.AppendFormat("\t\t\t\tConfigMap.Add(tab.{0}.ToString(), tab);\n", FieldList[0].name); sbConf.AppendLine("\t\t\t}"); sbConf.AppendLine("\t\t}"); sbConf.AppendLine("\t}"); sbConf.AppendLine("}"); StringBuilder sb = new StringBuilder(); sb.Append(sbTab.ToString()); sb.Append(sbConf.ToString()); // 写文件 string p = GetFileName(Option.CSharpPath); p = string.Format("{0}/{1}Config.cs", "cs", p.Replace("_", "")); p = Path.Combine(Path.GetDirectoryName(Option.CSharpPath), p); // 写文件 WriteFile(p, sb.ToString(), Coding); }
private void ErrAppendMethod(MethodSymbol meth, SubstContext pctx, bool fArgs) { if (meth.IsExpImpl() && meth.swtSlot) { ErrAppendParentSym(meth, pctx); // Get the type args from the explicit impl type and substitute using pctx (if there is one). SubstContext ctx = new SubstContext(GetTypeManager().SubstType(meth.swtSlot.GetType(), pctx).AsAggregateType()); ErrAppendSym(meth.swtSlot.Sym, ctx, fArgs); // args already added return; } if (meth.isPropertyAccessor()) { PropertySymbol prop = meth.getProperty(); // this includes the parent class ErrAppendSym(prop, pctx); // add accessor name if (prop.methGet == meth) { ErrAppendString(".get"); } else { Debug.Assert(meth == prop.methSet); ErrAppendString(".set"); } // args already added return; } if (meth.isEventAccessor()) { EventSymbol @event = meth.getEvent(); // this includes the parent class ErrAppendSym(@event, pctx); // add accessor name if (@event.methAdd == meth) { ErrAppendString(".add"); } else { Debug.Assert(meth == @event.methRemove); ErrAppendString(".remove"); } // args already added return; } TypeArray replacementTypeArray = null; ErrAppendMethodParentSym(meth, pctx, out replacementTypeArray); if (meth.IsConstructor()) { // Use the name of the parent class instead of the name "<ctor>". ErrAppendName(meth.getClass().name); } else if (meth.IsDestructor()) { // Use the name of the parent class instead of the name "Finalize". ErrAppendChar('~'); ErrAppendName(meth.getClass().name); } else if (meth.isConversionOperator()) { // implicit/explicit ErrAppendString(meth.isImplicit() ? "implicit" : "explicit"); ErrAppendString(" operator "); // destination type name ErrAppendType(meth.RetType, pctx); } else if (meth.isOperator) { // handle user defined operators // map from CLS predefined names to "operator <X>" ErrAppendString("operator "); // // This is kinda slow, but the alternative is to add bits to methsym. // string operatorName; OperatorKind op = Operators.OperatorOfMethodName(GetNameManager(), meth.name); if (Operators.HasDisplayName(op)) { operatorName = Operators.GetDisplayName(op); } else { // // either equals or compare // if (meth.name == GetNameManager().GetPredefName(PredefinedName.PN_OPEQUALS)) { operatorName = "equals"; } else { Debug.Assert(meth.name == GetNameManager().GetPredefName(PredefinedName.PN_OPCOMPARE)); operatorName = "compare"; } } ErrAppendString(operatorName); } else if (meth.IsExpImpl()) { if (meth.errExpImpl != null) { ErrAppendType(meth.errExpImpl, pctx, fArgs); } } else { // regular method ErrAppendName(meth.name); } if (null == replacementTypeArray) { ErrAppendTypeParameters(meth.typeVars, pctx, false); } if (fArgs) { // append argument types ErrAppendChar('('); if (!meth.computeCurrentBogusState()) { ErrAppendParamList(GetTypeManager().SubstTypeArray(meth.Params, pctx), meth.isVarargs, meth.isParamArray); } ErrAppendChar(')'); } }
//------------------------------------------------------------ // FUNCBREC.BindCollectionInitializer // /// <summary></summary> /// <param name="newNode"></param> /// <param name="typeSym"></param> /// <param name="locVarSym"></param> /// <param name="objectExpr"></param> /// <param name="builder"></param> /// <returns></returns> //------------------------------------------------------------ internal EXPR BindCollectionInitializer( NEWNODE newNode, BASENODE elementsNode, TYPESYM typeSym, LOCVARSYM locVarSym, EXPR leftExpr, EXPR rightExpr, StatementListBuilder builder) { DebugUtil.Assert(newNode != null && typeSym != null && builder != null); DebugUtil.Assert(locVarSym != null || leftExpr != null || rightExpr != null); string addMethName = Compiler.NameManager.GetPredefinedName(PREDEFNAME.ADD); //-------------------------------------------------------- // typeSym should implement IEnumerable. //-------------------------------------------------------- AGGTYPESYM enumerableSym = HasIEnumerable(typeSym); if (enumerableSym == null) { Compiler.Error( newNode.TypeNode, CSCERRID.ERR_CollectInitRequiresIEnumerable, new ErrArg(typeSym)); return(rightExpr); } TYPESYM paramTypeSym = null; TypeArray typeArgs = enumerableSym.TypeArguments; if (typeArgs != null && typeArgs.Count > 0) { DebugUtil.Assert(typeArgs.Count == 1); paramTypeSym = typeArgs[0]; } else { paramTypeSym = Compiler.GetReqPredefAgg(PREDEFTYPE.OBJECT, true).GetThisType(); if (typeArgs == null) { typeArgs = new TypeArray(); } typeArgs.Add(paramTypeSym); typeArgs = Compiler.MainSymbolManager.AllocParams(typeArgs); } BindFlagsEnum bindFlags = BindFlagsEnum.RValueRequired; string localFormat = "<{0}><{1}>__local"; //-------------------------------------------------------- // Bind the local variable. //-------------------------------------------------------- if (leftExpr == null) { if (locVarSym == null) { string locName = String.Format(localFormat, typeSym.Name, (this.localCount)++); locVarSym = Compiler.LocalSymbolManager.CreateLocalSym( SYMKIND.LOCVARSYM, locName, this.currentScopeSym) as LOCVARSYM; locVarSym.TypeSym = typeSym; locVarSym.LocSlotInfo.HasInit = true; locVarSym.DeclTreeNode = newNode; StoreInCache(newNode, locName, locVarSym, null, true); } leftExpr = BindToLocal( newNode, locVarSym, bindFlags | BindFlagsEnum.MemberSet); } //-------------------------------------------------------- // If objectExpr is not null, assign it to the local variable. //-------------------------------------------------------- if (rightExpr != null) { EXPR assignLocExpr = BindAssignment( newNode, leftExpr, rightExpr, false); builder.Add(SetNodeStmt(newNode, MakeStmt(newNode, assignLocExpr, 0))); } //-------------------------------------------------------- // Get "Add" method. //-------------------------------------------------------- MemberLookup mem = new MemberLookup(); if (!mem.Lookup( Compiler, typeSym, leftExpr, this.parentDeclSym, addMethName, 0, MemLookFlagsEnum.UserCallable)) { Compiler.Error( newNode.TypeNode, CSCERRID.ERR_NoSuchMember, new ErrArg(typeSym), new ErrArg("Add")); return(NewError(newNode, null)); } if (mem.FirstSym == null || !mem.FirstSym.IsMETHSYM) { return(NewError(newNode, null)); } TypeArray typeGroup = mem.GetAllTypes(); EXPRMEMGRP grpExpr = NewExpr( newNode, EXPRKIND.MEMGRP, Compiler.MainSymbolManager.MethodGroupTypeSym) as EXPRMEMGRP; grpExpr.Name = addMethName; grpExpr.SymKind = SYMKIND.METHSYM; grpExpr.TypeArguments = BSYMMGR.EmptyTypeArray; grpExpr.ParentTypeSym = typeSym; grpExpr.MethPropSym = null; grpExpr.ObjectExpr = leftExpr; grpExpr.ContainingTypeArray = typeGroup; grpExpr.Flags |= EXPRFLAG.USERCALLABLE; //-------------------------------------------------------- // Add each value. //-------------------------------------------------------- DebugUtil.Assert(newNode.InitialNode != null); #if false BASENODE node = null; switch (newNode.InitialNode.Kind) { case NODEKIND.DECLSTMT: node = (newNode.InitialNode as DECLSTMTNODE).VariablesNode; break; case NODEKIND.UNOP: node = (newNode.InitialNode as UNOPNODE).Operand; break; default: DebugUtil.Assert(false); break; } #endif BASENODE node = elementsNode; while (node != null) { BASENODE elementNode; if (node.Kind == NODEKIND.LIST) { elementNode = node.AsLIST.Operand1; node = node.AsLIST.Operand2; } else { elementNode = node; node = null; } //---------------------------------------------------- // Bind the elements //---------------------------------------------------- EXPR elementExpr = BindExpr( elementNode, BindFlagsEnum.RValueRequired); //---------------------------------------------------- // Add the elements //---------------------------------------------------- EXPR addExpr = BindGrpToArgs(newNode, bindFlags, grpExpr, elementExpr); if (addExpr != null) { builder.Add(SetNodeStmt(newNode, MakeStmt(newNode, addExpr, 0))); } } return(leftExpr); }
public void NullNotAllowed() { var t = new TypeArray <IBase>(new[] { (Type)null }); Assert.AreEqual(0, t.Memebers.Count); }
//------------------------------------------------------------ // FUNCBREC.HasIEnumerable (2) // /// <summary> /// Rewrite HasIEnumerable for collection initializer. /// Return the IEnumerable or IEnumerable<T> instance. /// </summary> /// <param name="collection"></param> /// <param name="tree"></param> /// <param name="badType"></param> /// <param name="badMember"></param> /// <returns></returns> //------------------------------------------------------------ private AGGTYPESYM HasIEnumerable( TYPESYM collectionTypeSym/*, * BASENODE treeNode, * TYPESYM badTypeSym, * PREDEFNAME badMemberName*/ ) { AGGTYPESYM ifaceCandidateAts = null; // First try the generic interfaces AGGSYM gEnumAggSym = Compiler.GetOptPredefAgg(PREDEFTYPE.G_IENUMERABLE, true); TypeArray allIfacesTypeArray = null; AGGTYPESYM baseAts = null; // If generics don't exist or the type isn't an AGGTYPESYM // then we can't check the interfaces (and base-class interfaces) // for IEnumerable<T> so immediately try the non-generic IEnumerable if (gEnumAggSym == null) { goto NO_GENERIC; } if (collectionTypeSym.IsAGGTYPESYM) { if (collectionTypeSym.GetAggregate() == gEnumAggSym || collectionTypeSym.IsPredefType(PREDEFTYPE.IENUMERABLE)) { DebugUtil.Assert(false, "IEnumerable/ator types are bad!"); goto LERROR; } AGGTYPESYM tempAts = collectionTypeSym as AGGTYPESYM; allIfacesTypeArray = tempAts.GetIfacesAll(); baseAts = tempAts.GetBaseClass(); } else if (collectionTypeSym.IsTYVARSYM) { // Note: // we'll search the interface list before the class constraint, // but it doesn't matter since we require a unique instantiation of IEnumerable<T>. // Note: // The pattern search will usually find the interface constraint // - but if the class constraint has a non-public or non-applicable // or non-method GetEnumerator, // the interfaces are hidden in which case we will find them here. TYVARSYM tempTvSym = collectionTypeSym as TYVARSYM; allIfacesTypeArray = tempTvSym.AllInterfaces; baseAts = tempTvSym.BaseClassSym; } else { goto NO_GENERIC; } DebugUtil.Assert(allIfacesTypeArray != null); // If the type implements exactly one instantiation of // IEnumerable<T> then it's the one. // // If it implements none then try the non-generic interface. // // If it implements more than one, then it's an error. // // Search the direct and indirect interfaces via allIfacesTypeArray, // going up the base chain... // Work up the base chain for (; ;) { // Now work across all the interfaces for (int i = 0; i < allIfacesTypeArray.Count; ++i) { AGGTYPESYM iface = allIfacesTypeArray[i] as AGGTYPESYM; if (iface.GetAggregate() == gEnumAggSym) { if (ifaceCandidateAts == null) { // First implementation ifaceCandidateAts = iface; } else if (iface != ifaceCandidateAts) { // If this really is a different instantiation report an error Compiler.Error( treeNode, CSCERRID.ERR_MultipleIEnumOfT, new ErrArgRef(collectionTypeSym), new ErrArg(gEnumAggSym.GetThisType())); return(null); } } } // Check the base class. if (baseAts == null) { break; } allIfacesTypeArray = baseAts.GetIfacesAll(); baseAts = baseAts.GetBaseClass(); } // Report the one and only generic interface if (ifaceCandidateAts != null) { DebugUtil.Assert( CanConvert(collectionTypeSym, ifaceCandidateAts, ConvertTypeEnum.NOUDC)); return(ifaceCandidateAts); } NO_GENERIC: if (collectionTypeSym.IsPredefType(PREDEFTYPE.IENUMERABLE)) { DebugUtil.VsFail("Why didn't IEnumerator match the pattern?"); goto LERROR; } // No errors, no generic interfaces, try the non-generic interface ifaceCandidateAts = GetRequiredPredefinedType(PREDEFTYPE.IENUMERABLE); if (CanConvert(collectionTypeSym, ifaceCandidateAts, ConvertTypeEnum.NOUDC)) { return(ifaceCandidateAts); } LERROR: return(null); }
public void CheckBaseClass() { var t = new TypeArray <Base>(new[] { typeof(Base) }); Assert.AreEqual(1, t.Memebers.Count); }
//------------------------------------------------------------ // MemberLookup.LookupExtensionMethodInInterfaces // /// <summary></summary> /// <param name="startAggTypeSym"></param> /// <returns></returns> //------------------------------------------------------------ private bool LookupExtensionMethodInInterfaces(AGGTYPESYM startAggTypeSym) { //DebugUtil.Assert(this.firstSymWithType == null || this.isMulti); //DebugUtil.Assert(startAggTypeSym != null); if (startAggTypeSym == null) { return(false); } if (this.firstSymWithType != null && this.firstSymWithType.IsNotNull) { return(false); } //DebugUtil.Assert(startAggTypeSym == null || startAggTypeSym.IsInterfaceType()); //DebugUtil.Assert(startAggTypeSym != null || interfaceTypeArray.Count > 0); //DebugUtil.Assert((this.flags & // (MemLookFlagsEnum.Ctor | MemLookFlagsEnum.Operator | MemLookFlagsEnum.BaseCall)) // == 0); TypeArray interfaceTypeArray = startAggTypeSym.GetIfacesAll(); if (interfaceTypeArray == null || interfaceTypeArray.Count == 0) { return(false); } // Clear all the hidden flags. Anything found in a class hides any other // kind of member in all the interfaces. if (startAggTypeSym != null) { startAggTypeSym.AllHidden = false; startAggTypeSym.DiffHidden = (this.firstSymWithType != null); } for (int i = 0; i < interfaceTypeArray.Count; ++i) { AGGTYPESYM type = interfaceTypeArray[i] as AGGTYPESYM; DebugUtil.Assert(type.IsInterfaceType()); type.AllHidden = false; type.DiffHidden = (this.firstSymWithType != null); } if (startAggTypeSym != null) { Compiler.EnsureState(startAggTypeSym, AggStateEnum.Prepared); } if (interfaceTypeArray != null) { Compiler.EnsureState(interfaceTypeArray, AggStateEnum.Prepared); } //-------------------------------------------------------- // Loop through the interfaces. //-------------------------------------------------------- bool hideObject = false; int index = 0; AGGTYPESYM currentSym = interfaceTypeArray[index++] as AGGTYPESYM; DebugUtil.Assert(currentSym != null); for (; ;) { DebugUtil.Assert(currentSym != null && currentSym.IsInterfaceType()); bool hideByName = false; if (!currentSym.AllHidden && SearchSingleType(currentSym, out hideByName)) { SYM fsym = this.firstSymWithType.Sym; DebugUtil.Assert(fsym != null); if (fsym.Kind == SYMKIND.METHSYM && (fsym as METHSYM).IsInstanceExtensionMethod) { hideByName |= !this.isMulti; // Mark base interfaces appropriately. TypeArray interfaceArray = currentSym.GetIfacesAll(); for (int i = 0; i < interfaceArray.Count; ++i) { AGGTYPESYM sym = interfaceArray[i] as AGGTYPESYM; DebugUtil.Assert(sym.IsInterfaceType()); if (hideByName) { sym.AllHidden = true; } sym.DiffHidden = true; } // If we hide all base types, that includes object! if (hideByName) { hideObject = true; } } } this.flags &= ~MemLookFlagsEnum.TypeVarsAllowed; if (index >= interfaceTypeArray.Count) { return(!hideObject); } // Substitution has already been done. currentSym = interfaceTypeArray[index++] as AGGTYPESYM; } }
public void CheckBaseClassAgainstInheritatedClasses() { var t = new TypeArray <Base>(new[] { typeof(Sub), typeof(SubSub) }); Assert.AreEqual(2, t.Memebers.Count); }
//// TODO: Try to combine expression builders as much as possible. private static Expression BuildStringExpression(Condition condition, Expression propertyExpression, Expression valueExpression) { switch (condition) { case Condition.Contains: return(Expression.AndAlso(Expression.Not(Expression.Call(typeof(string).GetMethod("IsNullOrEmpty", TypeArray.From <string>()), propertyExpression)), Expression.Call(propertyExpression, typeof(string).GetMethod("Contains", TypeArray.From <string>()), valueExpression))); case Condition.DoesNotContain: return(Expression.Not(BuildStringExpression(Condition.Contains, propertyExpression, valueExpression))); case Condition.StartsWith: return(Expression.AndAlso(Expression.Not(Expression.Call(typeof(string).GetMethod("IsNullOrEmpty", TypeArray.From <string>()), propertyExpression)), Expression.Call(propertyExpression, typeof(string).GetMethod("StartsWith", TypeArray.From <string>()), valueExpression))); case Condition.DoesNotStartWith: return(Expression.Not(BuildStringExpression(Condition.StartsWith, propertyExpression, valueExpression))); case Condition.EndsWith: return(Expression.AndAlso(Expression.Not(Expression.Call(typeof(string).GetMethod("IsNullOrEmpty", TypeArray.From <string>()), propertyExpression)), Expression.Call(propertyExpression, typeof(string).GetMethod("EndsWith", TypeArray.From <string>()), valueExpression))); case Condition.DoesNotEndWith: return(Expression.Not(BuildStringExpression(Condition.EndsWith, propertyExpression, valueExpression))); case Condition.EqualTo: return(Expression.AndAlso(Expression.Not(Expression.Call(typeof(string).GetMethod("IsNullOrEmpty", TypeArray.From <string>()), propertyExpression)), Expression.Equal(propertyExpression, valueExpression))); case Condition.NotEqualTo: return(Expression.Not(BuildStringExpression(Condition.EqualTo, propertyExpression, valueExpression))); case Condition.GreaterThan: return(Expression.GreaterThan(Expression.Call( typeof(string).GetMethod("Compare", TypeArray.From <string, string, StringComparison>()), propertyExpression, valueExpression, Expression.Constant(StringComparison.OrdinalIgnoreCase)), Expression.Constant(0))); case Condition.GreaterThanOrEqualTo: return(Expression.GreaterThanOrEqual( Expression.Call( typeof(string).GetMethod("Compare", TypeArray.From <string, string, StringComparison>()), propertyExpression, valueExpression, Expression.Constant(StringComparison.OrdinalIgnoreCase)), Expression.Constant(0))); case Condition.LessThan: return(Expression.LessThan(Expression.Call( typeof(string).GetMethod("Compare", TypeArray.From <string, string, StringComparison>()), propertyExpression, valueExpression, Expression.Constant(StringComparison.OrdinalIgnoreCase)), Expression.Constant(0))); case Condition.LessThanOrEqualTo: return(Expression.LessThanOrEqual(Expression.Call( typeof(string).GetMethod("Compare", TypeArray.From <string, string, StringComparison>()), propertyExpression, valueExpression, Expression.Constant(StringComparison.OrdinalIgnoreCase)), Expression.Constant(0))); case Condition.IsNull: return(Expression.Equal(propertyExpression, Expression.Constant(null))); case Condition.NotIsNull: return(Expression.Not(Expression.Equal(propertyExpression, Expression.Constant(null)))); case Condition.IsEmpty: return(Expression.Equal(propertyExpression, Expression.Constant(string.Empty))); case Condition.NotIsEmpty: return(Expression.Not(Expression.Equal(propertyExpression, Expression.Constant(string.Empty)))); default: throw new NotSupportedException(string.Format( LanguageHelper.GetString("FilterBuilder_Exception_Message_ConditionIsNotSupported_Pattern"), condition)); } }
public void CheckSubInterfaceAgainstBaseInterfaces() { var t = new TypeArray <ISub>(new[] { typeof(IBase) }); Assert.AreEqual(0, t.Memebers.Count); }
//------------------------------------------------------------ // ReflectionUtil.IsTypeBuilderInstruction // /// <summary></summary> /// <param name="typeSym"></param> /// <returns></returns> //------------------------------------------------------------ internal static bool IsTypeBuilderInstruction(TYPESYM typeSym) { if (typeSym == null) { return(false); } Type type = null; int count = 0; int index = 0; switch (typeSym.Kind) { //---------------------------------------------------- // AGGTYPESYM //---------------------------------------------------- case SYMKIND.AGGTYPESYM: AGGTYPESYM ats = typeSym as AGGTYPESYM; DebugUtil.Assert(ats != null); if (ats.AllTypeArguments == null || ats.AllTypeArguments.Count == 0) { return(false); } AGGSYM aggSym = ats.GetAggregate(); DebugUtil.Assert(aggSym != null); if (aggSym.TypeBuilder != null) { return(true); } TypeArray typeArgs = ats.AllTypeArguments; for (int i = 0; i < typeArgs.Count; ++i) { if (IsTypeBuilderInstruction(typeArgs[i])) { return(true); } } return(false); //---------------------------------------------------- // ARRAYSYM //---------------------------------------------------- case SYMKIND.ARRAYSYM: return(IsTypeBuilderInstruction(typeSym.ParentSym as TYPESYM)); //---------------------------------------------------- // VOIDSYM //---------------------------------------------------- case SYMKIND.VOIDSYM: return(false); //---------------------------------------------------- // PARAMMODSYM //---------------------------------------------------- case SYMKIND.PARAMMODSYM: return(IsTypeBuilderInstruction(typeSym.ParentSym as TYPESYM)); //---------------------------------------------------- // TYVARSYM //---------------------------------------------------- case SYMKIND.TYVARSYM: return(true); //---------------------------------------------------- // PTRSYM //---------------------------------------------------- case SYMKIND.PTRSYM: return(IsTypeBuilderInstruction((typeSym as PTRSYM).BaseTypeSym)); //---------------------------------------------------- // NUBSYM //---------------------------------------------------- case SYMKIND.NUBSYM: return(IsTypeBuilderInstruction((typeSym as NUBSYM).BaseTypeSym)); //---------------------------------------------------- // otherwise //---------------------------------------------------- case SYMKIND.NULLSYM: case SYMKIND.ERRORSYM: break; case SYMKIND.MODOPTTYPESYM: throw new NotImplementedException("SymbolUtil.MakeSystemType: MODOPTTYPESYM"); case SYMKIND.ANONMETHSYM: case SYMKIND.METHGRPSYM: case SYMKIND.UNITSYM: break; default: break; } return(false); }
public void ObjectBaseAcceptsEverything() { var t = new TypeArray <object>(new[] { typeof(int), typeof(string), typeof(IBase), typeof(Sub) }); Assert.AreEqual(4, t.Memebers.Count); }
//------------------------------------------------------------ // ReflectionUtil.GetConstructedConstructorInfo // /// <summary></summary> /// <param name="compiler"></param> /// <param name="methodSym"></param> /// <param name="aggTypeSym"></param> /// <returns></returns> //------------------------------------------------------------ internal static ConstructorInfo GetConstructedConstructorInfo( COMPILER compiler, METHSYM methodSym, AGGTYPESYM aggTypeSym) { DebugUtil.Assert(compiler != null && compiler.Emitter != null); EMITTER emitter = compiler.Emitter; DebugUtil.Assert(emitter != null && methodSym != null && aggTypeSym != null); SymUtil.EmitParentSym(emitter, aggTypeSym); SymUtil.GetSystemTypeFromSym(aggTypeSym, null, null); emitter.EmitMethodDef(methodSym); Type parentType = aggTypeSym.Type; ConstructorInfo cnstrDefInfo = methodSym.ConstructorInfo; DebugUtil.Assert(cnstrDefInfo != null); bool isGenericType = parentType.IsGenericType; //-------------------------------------------------------- // (1) Non-generic Type //-------------------------------------------------------- if (!isGenericType) { return(cnstrDefInfo); } //-------------------------------------------------------- // (2) Generic Type //-------------------------------------------------------- TypeArray paramTypeArray = methodSym.ParameterTypes; TypeArray paramTypeArray2 = null; Type[] paramTypes = null; if (paramTypeArray != null && paramTypeArray.Count > 0) { paramTypeArray2 = compiler.MainSymbolManager.SubstTypeArray( paramTypeArray, aggTypeSym.AllTypeArguments, null, SubstTypeFlagsEnum.NormNone); paramTypes = SymUtil.GetSystemTypesFromTypeArray( paramTypeArray2, methodSym.ClassSym, methodSym); } else { paramTypes = Type.EmptyTypes; } ConstructorInfo constructedInfo = null; Exception ex = null; try { constructedInfo = parentType.GetConstructor(paramTypes); } catch (NotSupportedException) { constructedInfo = GetConstructorInfo(parentType, cnstrDefInfo, out ex); } return(constructedInfo); }
private void ErrAppendMethodParentSym(MethodSymbol sym, SubstContext pcxt, out TypeArray substMethTyParams) { substMethTyParams = null; ErrAppendParentSym(sym, pcxt); }
//------------------------------------------------------------ // ReflectionUtil.GetConstructedMethodInfo // /// <summary></summary> /// <param name="compiler"></param> /// <param name="methodSym"></param> /// <param name="aggTypeSym"></param> /// <param name="methTypeArguments"></param> /// <returns></returns> //------------------------------------------------------------ internal static MethodInfo GetConstructedMethodInfo( COMPILER compiler, METHSYM methodSym, AGGTYPESYM aggTypeSym, TypeArray methTypeArguments) { DebugUtil.Assert(compiler != null && compiler.Emitter != null); EMITTER emitter = compiler.Emitter; DebugUtil.Assert(emitter != null && methodSym != null && aggTypeSym != null); SymUtil.EmitParentSym(emitter, aggTypeSym); SymUtil.GetSystemTypeFromSym(aggTypeSym, null, null); emitter.EmitMethodDef(methodSym); Type parentType = aggTypeSym.Type; MethodInfo methodDefInfo = methodSym.MethodInfo; bool isGenericType = parentType.IsGenericType; bool isGenericMethod = methodDefInfo.IsGenericMethod; //-------------------------------------------------------- // (1-1) Non-generic Type, non-generic method //-------------------------------------------------------- if (!isGenericType && !isGenericMethod) { return(methodDefInfo); } //-------------------------------------------------------- // Parameter types //-------------------------------------------------------- TypeArray paramTypeArray = methodSym.ParameterTypes; TypeArray paramTypeArray2 = null; Type[] paramTypes = null; if (paramTypeArray != null && paramTypeArray.Count > 0) { paramTypeArray2 = compiler.MainSymbolManager.SubstTypeArray( paramTypeArray, aggTypeSym.AllTypeArguments, methTypeArguments, SubstTypeFlagsEnum.NormNone); paramTypes = SymUtil.GetSystemTypesFromTypeArray( paramTypeArray2, methodSym.ClassSym, methodSym); } else { paramTypes = Type.EmptyTypes; } //-------------------------------------------------------- // (1-2) Non-generic Type, generic method //-------------------------------------------------------- if (!isGenericType) { DebugUtil.Assert(methTypeArguments != null); Exception ex = null; Type[] typeArgs = SymUtil.GetSystemTypesFromTypeArray( methTypeArguments, methodSym.ClassSym, methodSym); return(ReflectionUtil.GetGenericMethod( methodDefInfo, typeArgs, out ex)); } //-------------------------------------------------------- // (2) Generic Type //-------------------------------------------------------- else { string methodName = methodDefInfo.Name; MethodInfo cstrMethInfo = null; Exception ex = null; try { cstrMethInfo = parentType.GetMethod(methodName, paramTypes); } catch (NotSupportedException) { cstrMethInfo = GetMethodInfo(parentType, methodDefInfo, out ex); } if (!isGenericMethod) { return(cstrMethInfo); } DebugUtil.Assert(methTypeArguments != null); Type[] typeArgs = SymUtil.GetSystemTypesFromTypeArray( methTypeArguments, methodSym.ClassSym, methodSym); return(ReflectionUtil.GetGenericMethod( cstrMethInfo, typeArgs, out ex)); } }
private bool IsTypeBinarySerializable(Type type) { if (type == null) { return(false); } return(TypeBinarySerializableCache.GetFromCacheOrFetch(type, () => type.GetConstructor(TypeArray.From <SerializationInfo, StreamingContext>()) != null)); }
public void TestSameEquals() { var array = new TypeArray(new[] { typeof(int) }); CheckEquals(array, array); }