-
Notifications
You must be signed in to change notification settings - Fork 568
chore(types): Type-clean colang/ (111 errors) #1381
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
base: develop
Are you sure you want to change the base?
Changes from all commits
de7c35c
2299504
f1045f5
84484f5
1a0b696
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems that all control flow jump offsets are being converted from # before:
if_element["_next_else"] = len(then_elements) + 1
{"_type": "jump", "_next": len(else_elements) + 1}
while_element["_next_on_break"] = n + 2
do_elements[j]["_next_on_break"] = n + 1 - j
do_elements[j]["_next_on_continue"] = -1 * j - 1
# after:
if_element["_next_else"] = str(len(then_elements) + 1)
{"_type": "jump", "_next": str(len(else_elements) + 1)}
while_element["_next_on_break"] = str(n + 2)
do_elements[j]["_next_on_break"] = str(n + 1 - j)
do_elements[j]["_next_on_continue"] = str(-1 * j - 1)
this seems like working around type annotations rather than fixing them, might be better to update type annotations to accept |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,11 +86,14 @@ def get_numbered_lines(content: str): | |
| current_comment = None | ||
| multiline_string = False | ||
| current_string = None | ||
| multiline_indentation = 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: |
||
| while i < len(raw_lines): | ||
| raw_line = raw_lines[i].strip() | ||
|
|
||
| # handle multiline string | ||
| if multiline_string: | ||
| if current_string is None: | ||
| current_string = "" | ||
|
Comment on lines
+95
to
+96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: This check is redundant. |
||
| current_string += "\n" + raw_line | ||
| if raw_line.endswith('"'): | ||
| multiline_string = False | ||
|
|
@@ -139,6 +142,8 @@ def get_numbered_lines(content: str): | |
| continue | ||
|
|
||
| if multiline_comment: | ||
| if current_comment is None: | ||
| current_comment = "" | ||
|
Comment on lines
+145
to
+146
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: This check is redundant. |
||
| if raw_line.endswith('"""'): | ||
| current_comment += "\n" + raw_line[0:-3] | ||
| multiline_comment = False | ||
|
|
@@ -403,7 +408,7 @@ def parse_package_name(text): | |
| return package_name | ||
|
|
||
|
|
||
| def string_hash(s): | ||
| def string_hash(s: str) -> str: | ||
| """A simple string hash with an equivalent implementation in javascript. | ||
|
|
||
| module.exports.string_hash = function(s){ | ||
|
|
@@ -421,7 +426,7 @@ def string_hash(s): | |
| """ | ||
| _hash = 0 | ||
| if len(s) == 0: | ||
| return 0 | ||
| return "0" | ||
| for i in range(len(s)): | ||
| _char = ord(s[i]) | ||
| _hash = ((_hash << 5) - _hash) + _char | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.