Skip to content

Commit e9f9075

Browse files
committed
question editor: cope with multiple definitions of functions with the same name
1 parent 7b0abdb commit e9f9075

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

editor/static/js/question/edit.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,14 @@ $(document).ready(function() {
404404
return scope;
405405
}
406406

407+
var seen_functions = {}
408+
407409
functions.map(function(f) {
408410
try {
409411
const name = jme.normaliseName(f.name(), scope);
410-
var cfn = made_functions[name][0];
412+
var i = seen_functions[name] || 0;
413+
seen_functions[name] = i + 1;
414+
var cfn = made_functions[name][i];
411415

412416
var oevaluate = cfn.evaluate;
413417
cfn.evaluate = function(args,scope) {

0 commit comments

Comments
 (0)