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(); }
Expr *new_expr(ExprKind kind, SrcPos pos) { var e = (Expr *)ast_alloc(sizeof(Expr)); e->pos = pos; e->kind = kind; return(e); }
Expr new_expr(ExprKind kind, SrcPos pos) { var e = new Expr(); e.pos = pos; e.kind = kind; return(e); }
internal Expression(IExpressionInfo info) : base(info.Context) { this.info = info; Location = info.Location; Kind = info.Kind; Type = info.Type; TryPopulate(); }
public ExpressionInfo(Context cx, AnnotatedType type, Extraction.Entities.Location location, ExprKind kind, IExpressionParentEntity parent, int child, bool isCompilerGenerated, string value) { Context = cx; Type = type; Location = location; Kind = kind; Parent = parent; Child = child; ExprValue = value; IsCompilerGenerated = isCompilerGenerated; }
/// <summary> /// Adjust the expression kind <paramref name="k"/> to match this call type. /// </summary> public static ExprKind AdjustKind(this Expression.CallType ct, ExprKind k) { switch (ct) { case Expression.CallType.Dynamic: case Expression.CallType.UserOperator: return(ExprKind.OPERATOR_INVOCATION); default: return(k); } }
internal Expression(IExpressionInfo info, bool shouldPopulate = true) : base(info.Context) { this.info = info; Location = info.Location; Kind = info.Kind; Type = info.Type; if (shouldPopulate) { TryPopulate(); } }
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(); }
public ExpressionNodeInfo SetKind(ExprKind kind) { Kind = kind; return(this); }
/// <summary> /// Adapt the operator kind depending on whether it's a dynamic call or a user-operator call. /// </summary> /// <param name="cx"></param> /// <param name="node"></param> /// <param name="originalKind"></param> /// <returns></returns> public static ExprKind UnaryOperatorKind(Context cx, ExprKind originalKind, ExpressionSyntax node) => GetCallType(cx, node).AdjustKind(originalKind);
internal static void expressions(this TextWriter trapFile, Expression expr, ExprKind kind, Type exprType) { trapFile.WriteTuple("expressions", expr, (int)kind, exprType); }
internal static Tuple expressions(Expression expr, ExprKind kind, Type exprType) => new Tuple("expressions", expr, kind, exprType);
PostfixUnary(ExpressionNodeInfo info, ExprKind kind, ExpressionSyntax operand) : base(info.SetKind(UnaryOperatorKind(info.Context, kind, info.Node))) { Operand = operand; OperatorKind = kind; }
Unary(ExpressionNodeInfo info, ExprKind kind) : base(info.SetKind(UnaryOperatorKind(info.Context, info.Kind, info.Node))) { OperatorKind = kind; }
public Expression(AbstractNode lhs, ExprKind kind, AbstractNode rhs) { adoptChildren(lhs); adoptChildren(rhs); exprKind = kind; }
public Expression(AbstractNode expr, ExprKind kind) { adoptChildren(expr); exprKind = kind; }