StringExp

Members

Functions

borrowData
ubyte[] borrowData()

Borrow a slice of the data, so the caller can modify it in-place (!)

compare
int compare(StringExp se2)

Compare two StringExp by length, then value

getCodeUnit
dchar getCodeUnit(size_t i)

Get the code unit at index i

numberOfCodeUnits
size_t numberOfCodeUnits(int tynto)

Return the number of code units the string would be if it were re-encoded as tynto.

peekData
const(ubyte)[] peekData()

Get a slice of the data.

setCodeUnit
void setCodeUnit(size_t i, dchar c)

Set the code unit at index i to c

setData
void setData(void* s, size_t len, ubyte sz)

Set new string data. this becomes the new owner of the data.

toStringz
const(char)[] toStringz()

Convert string contents to a 0 terminated string, allocated by mem.xmalloc().

writeTo
void writeTo(void* dest, bool zero, int tyto)

Write the contents of the string to dest. Use numberOfCodeUnits() to determine size of result.

Variables

committed
bool committed;

Whether the string literal's type is fixed

hexString
bool hexString;

If the string is parsed from a hex string literal

Inherited Members

From Expression

size
size_t size()
deinitialize
void deinitialize()

Deinitializes the global state of the compiler.

copy
Expression copy()

Does *not* do a deep copy.

combine
Expression combine(Expression e1, Expression e2)

Combine e1 and e2 by CommaExp if both are not NULL.

extractLast
Expression extractLast(Expression e, Expression e0)

If 'e' is a tree of commas, returns the rightmost expression by stripping off it from the tree. The remained part of the tree is returned via e0. Otherwise 'e' is directly returned and e0 is set to NULL.

isLvalue
bool isLvalue()

Return !=0 if expression is an lvalue.

toLvalue
Expression toLvalue(Scope* sc, Expression e)

Give error if we're not an lvalue. If we can, convert expression to be an lvalue.

resolveLoc
Expression resolveLoc(Loc loc, Scope* sc)

Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, __FILE_FULL_PATH__ to loc.

checkType
bool checkType()

Check that the expression has a valid type. If not, generates an error "... has no type".

checkValue
bool checkValue()

Check that the expression has a valid value. If not, generates an error "... has no value".

checkPurity
bool checkPurity(Scope* sc, FuncDeclaration f)

Calling function f. Check the purity, i.e. if we're in a pure function we can only call other pure functions. Returns true if error occurs.

checkOverriddenDtor
void checkOverriddenDtor(Scope* sc, FuncDeclaration f, bool function(DtorDeclaration) check, string checkName)

Checks whether f is a generated DtorDeclaration that hides a user-defined one which passes check while f doesn't (e.g. when the user defined dtor is pure but the generated dtor is not). In that case the method will identify and print all members causing the attribute missmatch.

checkPurity
bool checkPurity(Scope* sc, VarDeclaration v)

Accessing variable v. Check for purity and safety violations. Returns true if error occurs.

checkSafety
bool checkSafety(Scope* sc, FuncDeclaration f)

Calling function f. Check the safety, i.e. if we're in a @safe function we can only call @safe or @trusted functions. Returns true if error occurs.

checkNogc
bool checkNogc(Scope* sc, FuncDeclaration f)

Calling function f. Check the @nogc-ness, i.e. if we're in a @nogc function we can only call other @nogc functions. Returns true if error occurs.

checkPostblit
bool checkPostblit(Scope* sc, Type t)

Check that the postblit is callable if t is an array of structs. Returns true if error happens.

checkReadModifyWrite
bool checkReadModifyWrite(EXP rmwOp, Expression ex)

Check whether the expression allows RMW operations, error with rmw operator diagnostic if not. ex is the RHS expression, or NULL if ++/-- is used (for diagnostics) Returns true if error occurs.

addressOf
Expression addressOf()

Take address of expression.

deref
Expression deref()

If this is a reference, dereference it.

isIdentical
bool isIdentical(Expression e)

Identical, not just equal. I.e. NaNs with different bit patterns are not identical

toBool
Optional!bool toBool()

Statically evaluate this expression to a bool if possible

Meta