cleaner name/type for pointer

This commit is contained in:
Greg Hysen
2018-11-06 13:28:59 -08:00
parent 331cca37e2
commit bce62056d9

View File

@@ -137,6 +137,10 @@ namespace AbiEncoder {
return this.hexValue;
}
public getDataItem(): DataItem {
return this.dataItem;
}
public abstract assignValue(value: any): void;
// abstract match(type: string): Bool;
@@ -373,15 +377,25 @@ namespace AbiEncoder {
class Pointer extends StaticDataType {
destDataType: DynamicDataType;
static metaDataItem = { name: '[ptr]', type: '[ptr]' } as DataItem;
constructor(destDataType: DynamicDataType) {
super(Pointer.metaDataItem);
const destDataItem = destDataType.getDataItem();
const dataItem = { name: `ptr<${destDataItem.name}>`, type: `ptr<${destDataItem.type}>` } as DataItem;
super(dataItem);
this.destDataType = destDataType;
}
/*
public assignValue(destDataType: DynamicDataType) {
this.destDataType = destDataType;
}*/
public assignValue(value: any) {
this.destDataType.assignValue(value);
}
public getHexValue(): string {
return this.destDataType.getHexValue();
}
}