public static StackFrame ToStackFrame(this ISourcePositionInfo location, string name = null) => new StackFrame { Id = _generator.Next(), Column = location.LinePosition, Line = location.LineNumber, Name = name, Source = location.Source };
public ConstantExpression(object value, TypeSpecifier type, ISourcePositionInfo location = null) : base(type, location) { if (value == null) { Error.ArgumentNull("value"); } Value = value; }
public ConstantExpression(object value, ISourcePositionInfo location = null) : base(TypeSpecifier.Any, location) { if (value == null) { Error.ArgumentNull("value"); } if (Any.TryConvertToSystemValue(value, out var systemValue)) { Value = systemValue; } else { throw Error.InvalidOperation("Internal logic error: encountered unmappable Value of type " + Value.GetType().Name); } if (Value is bool) { ExpressionType = TypeSpecifier.Boolean; } else if (Value is string) { ExpressionType = TypeSpecifier.String; } else if (Value is Int64) { ExpressionType = TypeSpecifier.Integer; } else if (Value is decimal) { ExpressionType = TypeSpecifier.Decimal; } else if (Value is PartialDateTime) { ExpressionType = TypeSpecifier.DateTime; } else if (Value is PartialTime) { ExpressionType = TypeSpecifier.Time; } else if (Value is PartialDate) { ExpressionType = TypeSpecifier.Date; } else if (Value is Quantity) { ExpressionType = TypeSpecifier.Quantity; } else { throw Error.InvalidOperation($"Internal logic error: encountered unmappable Value of type " + Value.GetType().Name); } }
public ConstantExpression(object value, TypeSpecifier type, ISourcePositionInfo location = null) : base(type, location) { if (value == null) { Error.ArgumentNull("value"); } if (value is P.Any && (value is P.Boolean || value is P.Decimal || value is P.Integer || value is P.Long || value is P.String)) { throw new ArgumentException("Internal error: not yet ready to handle Any-based primitives in FhirPath."); } Value = value; }
public static string GetLocationLabel(this ISourcePositionInfo loc) { if (loc == null) { throw new ArgumentNullException(nameof(loc)); } var result = $"line {loc.LineNumber}"; if (loc.LinePosition > 0) { result += $", column {loc.LinePosition}"; } return(result); }
public ConstantExpression(object value, ISourcePositionInfo location = null) : base(TypeSpecifier.Any, location) { if (value == null) { Error.ArgumentNull("value"); } if (Any.TryConvertToSystemValue(value, out var systemValue)) { Value = systemValue; ExpressionType = TypeSpecifier.ForNativeType(value.GetType()); } else { throw Error.InvalidOperation("Internal logic error: encountered unmappable Value of type " + Value.GetType().Name); } }
public ConstantExpression(object value, ISourcePositionInfo location = null) : base(TypeInfo.Any, location) { if (value == null) { Error.ArgumentNull("value"); } Value = Primitives.ConvertToPrimitiveValue(value); if (Value is bool) { ExpressionType = TypeInfo.Boolean; } else if (Value is string) { ExpressionType = TypeInfo.String; } else if (Value is Int64) { ExpressionType = TypeInfo.Integer; } else if (Value is Decimal) { ExpressionType = TypeInfo.Decimal; } else if (Value is PartialDateTime) { ExpressionType = TypeInfo.DateTime; } else if (Value is PartialTime) { ExpressionType = TypeInfo.Time; } else { throw Error.InvalidOperation("Internal logic error: encountered unmappable Value of type " + Value.GetType().Name); } }
public VariableRefExpression(string name, ISourcePositionInfo location = null) : base(TypeSpecifier.Any, location) { Name = name ?? throw Error.ArgumentNull("name"); }
protected Expression(TypeSpecifier type, ISourcePositionInfo location) : this(type) { Location = location; }
public FunctionCallExpression(Expression focus, string name, TypeSpecifier type, IEnumerable <Expression> arguments, ISourcePositionInfo location = null) : base(type, location) { if (string.IsNullOrEmpty(name)) { throw Error.ArgumentNull("name"); } Focus = focus; FunctionName = name; Arguments = arguments ?? throw Error.ArgumentNull("arguments"); }