public static Type Create(Context cx, ITypeSymbol type) { type = cx.DisambiguateType(type); const bool errorTypeIsNull = false; return type == null || (errorTypeIsNull && type.TypeKind == TypeKind.Error) ? NullType.Create(cx) : (Type)cx.CreateEntity(type); }
internal Expression(IExpressionInfo info) : base(info.Context) { Location = info.Location; Kind = info.Kind; Type = info.Type; if (Type.Type is null) { Type = NullType.Create(cx); } cx.Emit(Tuples.expressions(this, Kind, Type.Type.TypeRef)); if (info.Parent.IsTopLevelParent) { cx.Emit(Tuples.expr_parent_top_level(this, info.Child, info.Parent)); } else { cx.Emit(Tuples.expr_parent(this, info.Child, info.Parent)); } cx.Emit(Tuples.expr_location(this, Location)); if (info.IsCompilerGenerated) { cx.Emit(Tuples.expr_compiler_generated(this)); } if (info.ExprValue is string value) { cx.Emit(Tuples.expr_value(this, value)); } Type.Type.ExtractGenerics(); }
public static Type Create(Context cx, ITypeSymbol type) { type = type.DisambiguateType(); return(type == null ? NullType.Create(cx) : (Type)cx.CreateEntity(type)); }
internal Expression(IExpressionInfo info) : base(info.Context) { this.info = info; Location = info.Location; Kind = info.Kind; Type = info.Type; if (Type.Type is null) { Type = NullType.Create(cx); } TryPopulate(); }
protected sealed override void Populate(TextWriter trapFile) { var type = Type.HasValue ? Entities.Type.Create(Context, Type.Value) : NullType.Create(Context); trapFile.expressions(this, Kind, type.TypeRef); if (info.Parent.IsTopLevelParent) { trapFile.expr_parent_top_level(this, info.Child, info.Parent); } else { trapFile.expr_parent(this, info.Child, info.Parent); } trapFile.expr_location(this, Location); if (Type.HasValue && !Type.Value.HasObliviousNullability()) { var n = NullabilityEntity.Create(Context, Nullability.Create(Type.Value)); trapFile.type_nullability(this, n); } if (info.FlowState != NullableFlowState.None) { trapFile.expr_flowstate(this, (int)info.FlowState); } if (info.IsCompilerGenerated) { trapFile.expr_compiler_generated(this); } if (info.ExprValue is string value) { trapFile.expr_value(this, value); } type.PopulateGenerics(); }