Hi,
As part of v8 embedding work recently, I've encountered one more use case:
Sample app.js:
===========
var database_table = "beer_sample";
var city = "BLR";
// "query" is a FunctionTemplate exposed via an ObjectTemplate
var queryResult = query("select * from $database_table where $database_table.city= $city");
// Assuming "city" is top level json field in documents within that DB table, sample doc could look like:
// {"beer_count": 1000, city: "BLR", "brewery_location": "business_district"}
===========
Within the C++ Handler FunctionTemplate of "query" call needs to poke at what was the state of stack variables in JS and after replacing it, it would require to fire query. Just to clarify, query that Handler would require to fire:
"select * from beer-sample where beer-sample.city= BLR"
Please suggest if there is a way to do this currently using v8, else I suppose I would require to convert JS source to AST and after replacing variables appropriately I would need to convert AST to valid JS source.