Skip to content

Commit 18a1078

Browse files
committed
minor
1 parent 87f974b commit 18a1078

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

‎v5-unity/js/pytutor.ts‎

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44

55
/* TODO:
66
7-
- test breakpoint and stdin raw_input functionality after refactorings
8-
97
- substitute in a non-live version of the live editor from opt-live.js
108
in addition to the janky current version of the editor
119
12-
- test out try_hook now that i've ripped code apart into different
13-
classes
14-
1510
- test Java after massive refactorings
1611
1712
*/
@@ -268,10 +263,10 @@ export class ExecutionVisualizer {
268263
https://github.com/daveagp
269264
270265
[this documentation is a bit deprecated since Philip made try_hook a
271-
method of ExecutionVisualizer, but the general ideas remains]
266+
method of ExecutionVisualizer, but the general ideas remain]
272267
273268
An external user should call
274-
add_pytutor_hook("hook_name_here", function(args) {...})
269+
add_pytutor_hook("hook_name_here", function(args) {...})
275270
args will be a javascript object with several named properties;
276271
this is meant to be similar to Python's keyword arguments.
277272
@@ -295,37 +290,33 @@ export class ExecutionVisualizer {
295290
Hook callbacks can return false or undefined (i.e. no return
296291
value) in lieu of [false].
297292
298-
NB: If multiple functions are added to a hook, the oldest goes first.
299-
*/
293+
NB: If multiple functions are added to a hook, the oldest goes first. */
300294
add_pytutor_hook(hook_name, func) {
301295
if (this.pytutor_hooks[hook_name])
302296
this.pytutor_hooks[hook_name].push(func);
303297
else
304298
this.pytutor_hooks[hook_name] = [func];
305299
}
306300

307-
308301
/* [this documentation is a bit deprecated since Philip made try_hook a
309-
method of ExecutionVisualizer, but the general ideas remains]
302+
method of ExecutionVisualizer, but the general ideas remain]
310303
311304
try_hook(hook_name, args): how the internal codebase invokes a hook.
312-
args will be a javascript object with several named properties;
313-
this is meant to be similar to Python's keyword arguments.
314-
E.g.,
305+
306+
args will be a javascript object with several named properties;
307+
this is meant to be similar to Python's keyword arguments. E.g.,
315308
316309
function isPrimitiveType(obj) {
317310
var hook_result = try_hook("isPrimitiveType", {obj:obj});
318311
if (hook_result[0]) return hook_result[1];
319312
// go on as normal if the hook didn't handle it
320313
321-
Although add_pytutor_hook allows the hooked function to
322-
return false or undefined, try_hook will always return
323-
something with the strict format [false], [true] or [true, ...].
324-
*/
314+
Although add_pytutor_hook allows the hooked function to
315+
return false or undefined, try_hook will always return
316+
something with the strict format [false], [true] or [true, ...]. */
325317
try_hook(hook_name, args) {
326318
if (this.pytutor_hooks[hook_name]) {
327319
for (var i=0; i<this.pytutor_hooks[hook_name].length; i++) {
328-
329320
// apply w/o "this", and pack sole arg into array as required by apply
330321
var handled_and_result
331322
= this.pytutor_hooks[hook_name][i].apply(null, [args]);
@@ -719,7 +710,7 @@ export class ExecutionVisualizer {
719710
}
720711

721712
// All of the Java frontend code in this function was written by David
722-
// Pritchard and Will Gwozdz, and integrated by Philip Guo
713+
// Pritchard and Will Gwozdz, and integrated into pytutor.js by Philip Guo
723714
activateJavaFrontend() {
724715
// super hack by Philip that reverses the direction of the stack so
725716
// that it grows DOWN and renders the same way as the Python and JS

0 commit comments

Comments
 (0)