Skip to content
Snippets Groups Projects
Commit 54863675 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

Don't generate duplicate intentions (e.g. name) for typedefs. Updated

TypeDefParser
parent efccdd42
No related branches found
No related tags found
No related merge requests found
...@@ -287,10 +287,12 @@ aspect Signature { ...@@ -287,10 +287,12 @@ aspect Signature {
eq TypeInstance.intentions() = intentionSet(); eq TypeInstance.intentions() = intentionSet();
public void TypeInstance.genSigLineForDecl(SignatureList list, boolean decl, ASTNode inst) { public void TypeInstance.genSigLineForDecl(SignatureList list, boolean decl, ASTNode inst) {
// debugAnnotations(this.getName()); // debugAnnotations(this.getName());
// list.addString(inst.getIntentionString(), "intention string"); // list.addString(inst.getIntentionString(), "intention string");
list.addIntentions(intentionSet(), "intentions"); if(addIntentions()) {
getDataType().genSigLineForDecl(list, decl, this); list.addIntentions(intentionSet(), "intentions");
}
getDataType().genSigLineForDecl(list, decl, this);
} }
......
...@@ -548,31 +548,30 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler { ...@@ -548,31 +548,30 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
return current.getName(); return current.getName();
} }
/** return name, (if any, or "") for now */
String decodeIntentions() throws IOException { String decodeIntentions() throws IOException {
int n = decodePacked32() & 0xffffffff; int n = decodePacked32() & 0xffffffff;
if(n==0) return ""; if(n==0) return "";
StringBuilder sb = new StringBuilder(); String name = "";
for(int i=0; i<n;i++) { for(int i=0; i<n;i++) {
sb.append("(");
int klen = decodePacked32() & 0xffffffff; int klen = decodePacked32() & 0xffffffff;
byte[] kchars = new byte[klen]; byte[] kchars = new byte[klen];
for(int k=0; k<klen; k++) { for(int k=0; k<klen; k++) {
kchars[k] = in.readByte(); kchars[k] = in.readByte();
} }
sb.append(new String(kchars));
sb.append(":");
int vlen = decodePacked32() & 0xffffffff; int vlen = decodePacked32() & 0xffffffff;
byte[] vchars = new byte[vlen]; byte[] vchars = new byte[vlen];
for(int j=0; j<vlen; j++) { for(int j=0; j<vlen; j++) {
vchars[j] = in.readByte(); vchars[j] = in.readByte();
} }
sb.append(new String(vchars)); if(klen==0) {
sb.append(")"); name = new String(vchars);
}
} }
return sb.toString(); return name;
} }
String decodeString() throws IOException { String decodeString() throws IOException {
...@@ -648,13 +647,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler { ...@@ -648,13 +647,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
} }
private ParsedField parseParsedField(ParserState in) throws IOException { private ParsedField parseParsedField(ParserState in) throws IOException {
String intentions = in.decodeString(); String name = in.decodeIntentions();
if(intentions.length()>0) {
System.out.println("parseParsedField intentions ("+intentions);
} else {
System.out.println("no intentions");
}
String name = in.decodeString();
return new ParsedField(name, parseType(in, false)); return new ParsedField(name, parseType(in, false));
} }
...@@ -682,7 +675,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler { ...@@ -682,7 +675,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
} }
private ParsedTypeDef parseTypeDef(ParserState in, boolean parseIntentions) throws IOException { private ParsedTypeDef parseTypeDef(ParserState in, boolean parseIntentions) throws IOException {
ParsedTypeDef result = in.newTypeDef(); ParsedTypeDef result = in.newTypeDef();
result.setType(parseType(in, parseIntentions)); result.setType(parseType(in, false));
return result; return result;
} }
...@@ -695,7 +688,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler { ...@@ -695,7 +688,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
System.out.println("no intentions"); System.out.println("no intentions");
} }
} else { } else {
System.out.println("not parsing intentions"); // System.out.println("not parsing intentions");
} }
int tag = in.decodePacked32(); int tag = in.decodePacked32();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment