package org.cafebabepy.runtime.module._ast;

import org.cafebabepy.runtime.PyObject;
import org.cafebabepy.runtime.Python;
import org.cafebabepy.runtime.module.DefinePyFunction;
import org.cafebabepy.runtime.module.DefinePyType;

import static org.cafebabepy.util.ProtocolNames.__init__;

/**
 * Created by yotchang4s on 2017/05/29.
 */
@DefinePyType(name = "_ast.Attribute", parent = {"_ast.expr"})
public class PyAttributeType extends AbstractAST {

    public PyAttributeType(Python runtime) {
        super(runtime);
    }

    @DefinePyFunction(name = __init__)
    public void __init__(PyObject self, PyObject... args) {
        if (args.length == 0) {
            return;
        }

        self.getFrame().getLocals().put("value", args[0]);
        self.getFrame().getLocals().put("attr", args[1]);
        self.getFrame().getLocals().put("ctx", args[2]);
    }

    @Override
    String[] _fields() {
        return new String[]{"value", "attr", "ctx"};
    }
}
@@ -167,24 +167,91 @@
 PyFunction;%0A
+import org.cafebabepy.runtime.module.DefinePyFunctionDefaultValue;%0A
 import org.c
@@ -679,254 +679,1131 @@
 ject
-... args) %7B%0A        if (args.length == 0) %7B%0A            return;%0A        %7D%0A%0A        self.getFrame().getLocals().put(%22value%22, args%5B0%5D);%0A        self.getFrame().getLocals().put(%22attr%22
+ value, PyObject attr, PyObject ctx) %7B%0A        if (value != null) %7B%0A            self.getFrame().getLocals().put(%22value%22, value);%0A        %7D%0A        if (attr != null) %7B%0A            self.getFrame().getLocals().put(%22attr%22, attr);%0A        %7D%0A        if (ctx != null) %7B%0A            self.getFrame().getLocals().put(%22ctx%22, ctx);%0A        %7D%0A    %7D%0A%0A    @DefinePyFunctionDefaultValue(methodName = __init__, parameterName = %22value%22)%0A    private PyObject __init__value() %7B%0A        return null;%0A    %7D%0A%0A    @DefinePyFunctionDefaultValue(methodName = __init__
 , 
+p
 ar
-gs%5B1%5D)
+ameterName = %22attr%22)%0A    private PyObject __init__attr() %7B%0A        return null
 ;%0A    
+%7D%0A%0A
     
-self.getFrame().getLocals().put(%22ctx%22, args%5B2%5D
+@DefinePyFunctionDefaultValue(methodName = __init__, parameterName = %22ctx%22)%0A    private PyObject __init__ctx() %7B%0A        return this.runtime.None();%0A    %7D%0A%0A    @DefinePyFunctionDefaultValue(methodName = __init__, parameterName = %22lineno%22)%0A    private PyObject __init__lineno() %7B%0A        return this.runtime.None();%0A    %7D%0A%0A    @DefinePyFunctionDefaultValue(methodName = __init__, parameterName = %22col_offset%22)%0A    private PyObject __init__cal_offset() %7B%0A        return this.runtime.None(
 );%0A 

Change _ast.Attribute __init__