mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
13
javascript/ql/src/LanguageFeatures/examples/Eval2.js
Normal file
13
javascript/ql/src/LanguageFeatures/examples/Eval2.js
Normal file
@@ -0,0 +1,13 @@
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
["x", "y"].forEach(function(p) {
|
||||
Point.prototype["get_" + p] = new Function("",
|
||||
"return this." + p + ";");
|
||||
Point.prototype["set_" + p] = new Function("v",
|
||||
"if (typeof v !== 'number')" +
|
||||
" throw Error('number expected');" +
|
||||
" this." + p + " = v;");
|
||||
});
|
||||
Reference in New Issue
Block a user