Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💻 Check for underscore in variable, remove it #5324

Merged
merged 13 commits into from
Mar 29, 2024
Merged
1 change: 1 addition & 0 deletions hedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3638,6 +3638,7 @@ def transpile_inner(input_string, level, lang="en", populate_source_map=False, i
if not unused_allowed:
for x in lookup_table:
if isinstance(x.name, str) and x.access_line is None and x.name != 'x__x__x__x':
x.name = re.sub(r'^_', '', x.name)
raise hedy.exceptions.UnusedVariableException(
level, x.definition_line, x.name, fixed_code=python, fixed_result=parse_result)

Expand Down
4 changes: 3 additions & 1 deletion static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -97290,7 +97290,9 @@ notes_mapping = {
variableList.empty();
for (const i in variables) {
if (variables[i][1]) {
variableList.append(`<li style=color:${variables[i][2]}>${variables[i][0]}: ${variables[i][1]}</li>`);
console.log("HAAI");
const variableName = variables[i][0].replace(/^_/, "");
variableList.append(`<li style=color:${variables[i][2]}>${variableName}: ${variables[i][1]}</li>`);
}
}
show_variables();
Expand Down
4 changes: 2 additions & 2 deletions static/js/appbundle.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions static/js/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ export function load_variables(variables: any) {
for (const i in variables) {
// Only append if the variable contains any data (and is not undefined)
if (variables[i][1]) {
variableList.append(`<li style=color:${variables[i][2]}>${variables[i][0]}: ${variables[i][1]}</li>`);
console.log("HAAI")
Annelein marked this conversation as resolved.
Show resolved Hide resolved
const variableName = variables[i][0].replace(/^_/, '');
variableList.append(`<li style=color:${variables[i][2]}>${variableName}: ${variables[i][1]}</li>`);
}
}
show_variables();
hide_if_no_variables();
show_variables();
hide_if_no_variables();
}
}

Expand Down
Loading