currentHolder.addMethod(element);
methodName.setStaticElement(element);
} else {
SimpleIdentifier propertyNameNode = node.getName();
String propertyName = propertyNameNode.getName();
FieldElementImpl field = (FieldElementImpl) currentHolder.getField(propertyName);
if (field == null) {
field = new FieldElementImpl(node.getName().getName(), -1);
field.setFinal(true);
field.setStatic(isStatic);
field.setSynthetic(true);
currentHolder.addField(field);
}
if (matches(property, Keyword.GET)) {
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl(propertyNameNode);
getter.setFunctions(holder.getFunctions());
getter.setLabels(holder.getLabels());
getter.setLocalVariables(holder.getLocalVariables());
if (body.isAsynchronous()) {
getter.setAsynchronous(true);
}
if (body.isGenerator()) {
getter.setGenerator(true);
}
getter.setVariable(field);
getter.setAbstract(body instanceof EmptyFunctionBody && node.getExternalKeyword() == null);
getter.setGetter(true);
getter.setStatic(isStatic);
field.setGetter(getter);
currentHolder.addAccessor(getter);
propertyNameNode.setStaticElement(getter);
} else {
PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl(propertyNameNode);
setter.setFunctions(holder.getFunctions());
setter.setLabels(holder.getLabels());
setter.setLocalVariables(holder.getLocalVariables());
setter.setParameters(holder.getParameters());
if (body.isAsynchronous()) {
setter.setAsynchronous(true);
}
if (body.isGenerator()) {
setter.setGenerator(true);
}
setter.setVariable(field);
setter.setAbstract(body instanceof EmptyFunctionBody
&& !matches(node.getExternalKeyword(), Keyword.EXTERNAL));
setter.setSetter(true);
setter.setStatic(isStatic);
field.setSetter(setter);
field.setFinal(false);
currentHolder.addAccessor(setter);
propertyNameNode.setStaticElement(setter);
}
}