Commit 9205799a by sikang

bug fix

parent 5babf4ae
...@@ -150,14 +150,17 @@ class JavaGarble: ...@@ -150,14 +150,17 @@ class JavaGarble:
# 插入方法 # 插入方法
for fun in self.__functions: for fun in self.__functions:
line += "%s\n" % fun line += "%s\n" % fun
if curly_braces >= 1:
curly_braces += line.count("{")
curly_braces -= line.count("}")
# 定位1个缩进开头的类方法 # 定位1个缩进开头的类方法
if line.startswith(" ") and not line.startswith(" ") and ("){\n" in line or ") {\n" in line): if line.startswith(" ") and not line.startswith(" ") and ("){\n" in line or ") {\n" in line):
curly_braces = 0 curly_braces = line.count("{")
curly_braces -= line.count("}")
if curly_braces >= 1: if curly_braces >= 1:
curly_braces += line.count("{")
curly_braces -= line.count("}")
if "return" in line: if "return" in line:
curly_braces = -10000 curly_braces = -10000
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment