Skip to content

Commit

Permalink
Rename classFile to primaryClass
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Wales authored and Philip Wales committed Jan 27, 2020
1 parent 6b9d336 commit e387b51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Ccap/Codegen/Scala.purs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ modulePath mod = (Export.toPath mod.exports.scalaPkg) <> ".scala"
oneModule :: ValidatedModule -> Box
oneModule mod = do
let
modDecl = classFileType mod
modDecl = primaryClass mod

env =
{ defaultPrefix: Nothing
Expand Down Expand Up @@ -318,14 +318,14 @@ externalTypeRef importedModule importedType =
else
typeName

classFileType :: forall r. { name :: ModuleName, types :: Array TypeDecl | r } -> Maybe TypeDecl
classFileType { name, types } = Array.find (isClassFile name) types
primaryClass :: forall r. { name :: ModuleName, types :: Array TypeDecl | r } -> Maybe TypeDecl
primaryClass { name, types } = Array.find (isPrimaryClass name) types

isClassFile :: ModuleName -> TypeDecl -> Boolean
isClassFile modName typeD = modName == typeDeclName typeD && (isRecord $ typeDeclTopType typeD)
isPrimaryClass :: ModuleName -> TypeDecl -> Boolean
isPrimaryClass modName typeD = modName == typeDeclName typeD && (isRecord $ typeDeclTopType typeD)

needsQualifier :: ModuleName -> TypeDecl -> Boolean
needsQualifier modName = not <<< isClassFile modName
needsQualifier modName = not <<< isPrimaryClass modName

packageAnnotation :: Module -> Maybe String
packageAnnotation = Annotations.field "scala" "package" <<< _.annots
Expand Down

0 comments on commit e387b51

Please sign in to comment.