Skip to content

Commit

Permalink
#22: Rename parameter attr[ibute]Name to inst[ance]Name
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Aug 11, 2022
1 parent 0a20d3b commit 56d648b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ class CSharpCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)

//</editor-fold>

override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"private bool ${flagForInstName(attrName)};")
out.puts(s"private ${kaitaiType2NativeTypeNullable(attrType, isNullable)} ${privateMemberName(attrName)};")
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"private bool ${flagForInstName(instName)};")
out.puts(s"private ${kaitaiType2NativeTypeNullable(attrType, isNullable)} ${privateMemberName(instName)};")
}

override def instanceHeader(className: String, instName: InstanceIdentifier, dataType: DataType, isNullable: Boolean): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,11 @@ class CppCompiler(

override def switchBytesOnlyAsRaw = true

override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
ensureMode(PrivateAccess)
outHdr.puts(s"bool ${calculatedFlagForName(attrName)};")
outHdr.puts(s"${kaitaiType2NativeType(attrType)} ${privateMemberName(attrName)};")
declareNullFlag(attrName, isNullable)
outHdr.puts(s"bool ${calculatedFlagForName(instName)};")
outHdr.puts(s"${kaitaiType2NativeType(attrType)} ${privateMemberName(instName)};")
declareNullFlag(instName, isNullable)
}

override def instanceHeader(className: List[String], instName: InstanceIdentifier, dataType: DataType, isNullable: Boolean): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ class GoCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)
out.inc
}

override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"${calculatedFlagForName(attrName)} bool")
out.puts(s"${idToStr(attrName)} ${kaitaiType2NativeType(attrType)}")
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"${calculatedFlagForName(instName)} bool")
out.puts(s"${idToStr(instName)} ${kaitaiType2NativeType(attrType)}")
}

override def instanceHeader(className: List[String], instName: InstanceIdentifier, dataType: DataType, isNullable: Boolean): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ class JavaCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)

//</editor-fold>

override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"private ${kaitaiType2JavaTypeBoxed(attrType)} ${idToStr(attrName)};")
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"private ${kaitaiType2JavaTypeBoxed(attrType)} ${idToStr(instName)};")
}

override def instanceHeader(className: String, instName: InstanceIdentifier, dataType: DataType, isNullable: Boolean): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class NimCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)
override def attributeDeclaration(attrName: Identifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"`${idToStr(attrName)}`*: ${ksToNim(attrType)}")
}
override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"`${idToStr(attrName)}`: ${ksToNim(attrType)}")
out.puts(s"`${instanceFlagIdentifier(attrName)}`: bool")
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s"`${idToStr(instName)}`: ${ksToNim(attrType)}")
out.puts(s"`${instanceFlagIdentifier(instName)}`: bool")
}
override def attributeReader(attrName: Identifier, attrType: DataType, isNullable: Boolean): Unit = {}
override def classConstructorHeader(name: List[String], parentType: DataType, rootClassName: List[String], isHybrid: Boolean, params: List[ParamDefSpec]): Unit = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ class RustCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig)

override def switchEnd(): Unit = universalFooter

override def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s" pub ${idToStr(attrName)}: Option<${kaitaiType2NativeType(attrType)}>,")
override def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = {
out.puts(s" pub ${idToStr(instName)}: Option<${kaitaiType2NativeType(attrType)}>,")
}

override def instanceDeclHeader(className: List[String]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ abstract class LanguageCompiler(
def instanceDeclHeader(className: List[String]): Unit = {}
def instanceClear(instName: InstanceIdentifier): Unit = {}
def instanceSetCalculated(instName: InstanceIdentifier): Unit = {}
def instanceDeclaration(attrName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit = attributeDeclaration(attrName, attrType, isNullable)
def instanceDeclaration(instName: InstanceIdentifier, attrType: DataType, isNullable: Boolean): Unit =
attributeDeclaration(instName, attrType, isNullable)
def instanceHeader(className: List[String], instName: InstanceIdentifier, dataType: DataType, isNullable: Boolean): Unit
def instanceFooter: Unit
def instanceCheckCacheAndReturn(instName: InstanceIdentifier, dataType: DataType): Unit
Expand Down

0 comments on commit 56d648b

Please sign in to comment.