[ClavaAst] Adapts VarDeclData to use DataStore
@@ -15,9 +15,11 @@ package pt.up.fe.specs.clava.ast.decl.data;
import java.util.Optional;
+import org.suikasoft.jOptions.Interfaces.DataStore;
+
import com.google.common.base.Preconditions;
-import pt.up.fe.specs.clava.ast.decl.data2.VarDeclDataV2;
+import pt.up.fe.specs.clava.ast.decl.VarDecl;
import pt.up.fe.specs.clava.ast.decl.enums.InitializationStyle;
import pt.up.fe.specs.clava.ast.decl.enums.StorageClass;
import pt.up.fe.specs.clava.language.TLSKind;
@@ -44,14 +46,14 @@ public class VarDeclData {
private InitializationStyle initKind;
- private final VarDeclDataV2 varDeclData2;
+ private final DataStore varDeclData2;
public VarDeclData() {
this(StorageClass.NONE, TLSKind.NONE, false, false, InitializationStyle.NO_INIT, false);
}
public VarDeclData(StorageClass storageClass, TLSKind tlsKind, boolean isModulePrivate, boolean isNrvo,
- InitializationStyle initKind, VarDeclDataV2 varDeclData2) {
+ InitializationStyle initKind, DataStore varDeclData2) {
this.storageClass = storageClass;
this.tlsKind = tlsKind;
@@ -81,7 +83,7 @@ public class VarDeclData {
this.isModulePrivate = isModulePrivate;
this.isNrvo = isNrvo;
this.initKind = initKind;
- this.varDeclData2 = VarDeclDataV2.empty();
+ this.varDeclData2 = DataStore.newInstance("VarDeclData");
}
public VarDeclData copy() {
@@ -129,9 +131,9 @@ public class VarDeclData {
// return Optional.ofNullable(varDeclDumperInfo);
}
- public VarDeclDataV2 getVarDeclDataV2() {
- return varDeclData2;
- }
+ // public VarDeclDataV2 getVarDeclDataV2() {
+ // return varDeclData2;
+ // }
/**
* @deprecated use hasVarDeclV2() instead. Will throw an exception if used.
@@ -149,27 +151,27 @@ public class VarDeclData {
}
public boolean isConstexpr() {
- return varDeclData2.isConstexpr();
+ return varDeclData2.get(VarDecl.IS_CONSTEXPR);
// return getVarDeclDumperInfo().map(data -> data.isConstexpr()).orElse(false);
}
public boolean hasGlobalStorage() {
- return varDeclData2.hasGlobalStorage();
+ return varDeclData2.get(VarDecl.HAS_GLOBAL_STORAGE);
// return getVarDeclDumperInfo().map(data -> data.hasGlobalStorage()).orElse(false);
}
public boolean isStaticDataMember() {
- return varDeclData2.isStaticDataMember();
+ return varDeclData2.get(VarDecl.IS_STATIC_DATA_MEMBER);
// return getVarDeclDumperInfo().map(data -> data.isStaticDataMember()).orElse(false);
}
public boolean isOutOfLine() {
- return varDeclData2.isOutOfLine();
+ return varDeclData2.get(VarDecl.IS_OUT_OF_LINE);
// return getVarDeclDumperInfo().map(data -> data.isOutOfLine()).orElse(false);
}
public Optional<String> getQualifiedName() {
- return varDeclData2.getQualifiedName();
+ return Optional.of(varDeclData2.get(VarDecl.QUALIFIED_NAME));
// return getVarDeclDumperInfo().map(data -> data.getQualifiedName());
}
}
