Improve docs of LiveLiteral

Also remove transitive closure from calls
This commit is contained in:
Tony Torralba
2022-05-04 09:42:31 +02:00
committed by Ian Lynagh
parent 3836d1550a
commit bc84ff2031

View File

@@ -14,10 +14,19 @@ class LiveLiteral extends MethodAccess {
not this.getEnclosingCallable() instanceof LiveLiteralMethod
}
/** Gets the constant value that backs this live literal. */
/**
* Live literal classes consist of the following:
* - A private field holding the constant value that backs this live literal.
* - A private getter to access the constant value.
* - A public getter that either calls the private getter and returns its result or,
* if live literals are activated, returns the value of a dynamic state object that is initialized with
* the constant value.
*
* This predicate gets the constant value held by the private field.
*/
CompileTimeConstantExpr getValue() {
result =
any(ReturnStmt r | this.getMethod().calls*(r.getEnclosingCallable()))
any(ReturnStmt r | this.getMethod().calls(r.getEnclosingCallable()))
.getResult()
.(VarAccess)
.getVariable()