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

AttributeError: 'MethodCallExpr' object has no attribute 'add_bang' #10

Open
martinezmatias opened this issue May 3, 2018 · 2 comments

Comments

@martinezmatias
Copy link

martinezmatias commented May 3, 2018

Hello
I have followed the instructions you mention for running the jsketch scripts.
I had an error when I executed the example you wrote and the test cases:
For example, the execution of:
./jsk.sh test/new_ast/Construct.java

produces this error:

AttributeError: 'MethodCallExpr' object has no attribute 'add_bang'

Here the complete log:

user1s-MacBook-Pro:java-sketch user1$ ./jsk.sh test/new_ast/Construct.java
03:18:36 [INFO] /mypath/java-sketch/java_sk/main.py:36 => parsing ['test/new_ast/Construct.java']
03:18:36 [INFO] /mypath/java-sketch/jskparser/jskparser/jskparser.py:32 => parsing file...
03:18:36 [INFO] /mypath/java-sketch/jskparser/jskparser/jskparser.py:36 => generating symbol table...
03:18:36 [INFO] /mypath/java-sketch/jskparser/jskparser/jskparser.py:38 => building class heirarchy...
03:18:36 [INFO] /mypath/java-sketch/java_sk/main.py:41 => encoding to Sketch
03:18:36 [INFO] java_sk/encoder.py:114 => generating Object.sk
03:18:36 [INFO] java_sk/encoder.py:117 => generating meta.sk
03:18:36 [INFO] java_sk/encoder.py:121 => generating cls.sk
03:18:36 [DEBUG] java_sk/translator.py:813 => accessing this.x:10
03:18:36 [DEBUG] java_sk/translator.py:823 => found field: x_A
03:18:36 [DEBUG] java_sk/translator.py:835 => non-static field - type(n.scope): <class 'ast.expr.thisexpr.ThisExpr'>
03:18:36 [DEBUG] java_sk/translator.py:845 => END FIELD ACCESS

03:18:36 [INFO] java_sk/translator.py:895 => calling: m from Construct
03:18:36 [DEBUG] java_sk/translator.py:927 => scope: f1 F <class 'ast.body.variabledeclarator.VariableDeclarator'>
03:18:36 [DEBUG] java_sk/translator.py:1002 => searching in class: F
03:18:36 [DEBUG] java_sk/translator.py:1009 => potentitals: ['m']
03:18:36 [DEBUG] java_sk/translator.py:1016 => strict_applicable: ['m']
03:18:36 [DEBUG] java_sk/translator.py:1020 => loose_applicable: ['m']
03:18:36 [DEBUG] java_sk/translator.py:1040 => most_specific - name: m, qualifying type: <class 'ast.type.voidtype.VoidType'>, invocation_mode: virtual
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/mypath/java-sketch/java_sk/main.py", line 125, in
sys.exit(translate(**vars(OPT)))
File "/mypath/java-sketch/java_sk/main.py", line 42, in translate
encoder.to_sk()
File "java_sk/encoder.py", line 125, in to_sk
cls_sk = self.gen_cls_sk(cls)
File "java_sk/encoder.py", line 275, in gen_cls_sk
buf.write(self.to_func(m) + os.linesep)
File "java_sk/encoder.py", line 603, in to_func
buf.write(self.tltr.trans(mtd))
File "java_sk/translator.py", line 792, in trans
s.accept(self, **kwargs)
File "/mypath/java-sketch/jskparser/ast/node.py", line 257, in accept
def accept(self, v, **kwargs): v.visit(self, **kwargs)
File "java_sk/visit.py", line 26, in ff
return dispatcher(*args, **kw)
File "java_sk/visit.py", line 44, in call
return d(*args, **kw)
File "java_sk/translator.py", line 210, in visit
n.body.accept(self, **kwargs)
File "/mypath/java-sketch/jskparser/ast/node.py", line 257, in accept
def accept(self, v, **kwargs): v.visit(self, **kwargs)
File "java_sk/visit.py", line 26, in ff
return dispatcher(*args, **kw)
File "java_sk/visit.py", line 44, in call
return d(*args, **kw)
File "java_sk/translator.py", line 277, in visit
s.accept(self, **kwargs)
File "/mypath/java-sketch/jskparser/ast/node.py", line 257, in accept
def accept(self, v, **kwargs): v.visit(self, **kwargs)
File "java_sk/visit.py", line 26, in ff
return dispatcher(*args, **kw)
File "java_sk/visit.py", line 44, in call
return d(*args, **kw)
File "java_sk/translator.py", line 350, in visit
if n.expr: n.expr.accept(self, **kwargs)
File "/mypath/java-sketch/jskparser/ast/node.py", line 257, in accept
def accept(self, v, **kwargs): v.visit(self, **kwargs)
File "java_sk/visit.py", line 26, in ff
return dispatcher(*args, **kw)
File "java_sk/visit.py", line 44, in call
return d(*args, **kw)
File "java_sk/translator.py", line 661, in visit
self.trans_call(n, **kwargs)
File "java_sk/translator.py", line 1044, in trans_call
is_ax2 = callexpr.add_bang
AttributeError: 'MethodCallExpr' object has no attribute 'add_bang'
user1s-MacBook-Pro:java-sketch user1$ java -version
java version "1.8.0_101"

Thanks for your help!
Regards
Matias

@lichongyang
Copy link

hey..have you solved this problem? now, i have the same problem with you. If you have any idea about the problem, can you share it with me?

@martinezmatias
Copy link
Author

Hello @lichongyang
No, I could not find a fix. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants