1. A method for generating an optimized application source code, comprising: determining that a programmatic expression in a first function call corresponds to a complex promise type based on the programmatic expression comprising a second function call having user-defined code, the second function call to a second function, the first function call located in a caller function of an original application source code; determining a first value for the programmatic expression based on evaluating the second function using a context of the caller function system state during execution of the caller function; compiling the programmatic expression into a first optimized code portion using the first value, an assumption, and an expression scope, wherein the assumption denotes whether the first value is valid; replacing the programmatic expression in the original application source code with the first optimized code portion to create the optimized application source code; executing the optimized application source code; responsive to executing the optimized application source code, determining that the programmatic expression is modified outside of the expression scope; in response to determining that the programmatic expression is modified outside of the expression scope, invalidating the assumption to indicate that the first value is invalid; in response to invalidating the assumption, de-optimizing the first optimized code portion, wherein de-optimizing comprises determining a second value for the programmatic expression using the complex promise type; and continuing execution using the second value for the programmatic expression.