C++: Split valuetext off into its own table

This commit is contained in:
Ian Lynagh
2019-08-28 14:09:13 +01:00
parent 1bd0c69f0e
commit 754612d257
2 changed files with 9 additions and 5 deletions

View File

@@ -85,10 +85,10 @@ class Expr extends StmtParent, @expr {
override string toString() { none() } override string toString() { none() }
/** Gets the value of this expression, if it is a constant. */ /** Gets the value of this expression, if it is a constant. */
string getValue() { exists(@value v | values(v,result,_) and valuebind(v,underlyingElement(this))) } string getValue() { exists(@value v | values(v,result) and valuebind(v,underlyingElement(this))) }
/** Gets the source text for the value of this expression, if it is a constant. */ /** Gets the source text for the value of this expression, if it is a constant. */
string getValueText() { exists(@value v | values(v,_,result) and valuebind(v,underlyingElement(this))) } string getValueText() { exists(@value v | valuetext(v,result) and valuebind(v,underlyingElement(this))) }
/** Holds if this expression has a value that can be determined at compile time. */ /** Holds if this expression has a value that can be determined at compile time. */
cached cached

View File

@@ -1237,11 +1237,15 @@ expr_cond_false(
int false: @expr ref int false: @expr ref
); );
// the second field is a string representation of the value /** A string representation of the value. */
// the third field is the actual text in the source or the same as the second field
values( values(
unique int id: @value, unique int id: @value,
string str: string ref, string str: string ref
);
/** The actual text in the source code for the value, if any. */
valuetext(
unique int id: @value ref,
string text: string ref string text: string ref
); );