From 7293985b1b9bb17df16f88571c73ffaaf15bc68d Mon Sep 17 00:00:00 2001 From: Nicolas Rouquette Date: Sun, 15 May 2022 20:56:33 -0700 Subject: [PATCH] Removed superfluous method override return types. All tests pass --- .../scala/analysis/Analyzers/Analyzer.scala | 2 +- .../Analyzers/TypeExpressionAnalyzer.scala | 40 +++++------ .../analysis/Analyzers/UseAnalyzer.scala | 14 ++-- .../CheckSemantics/CheckExprTypes.scala | 44 ++++++------- .../CheckSemantics/CheckPortDefs.scala | 2 +- .../CheckSemantics/CheckSpecLocs.scala | 12 ++-- .../CheckSemantics/CheckTypeUses.scala | 20 +++--- .../CheckSemantics/CheckUseDefCycles.scala | 18 ++--- .../analysis/CheckSemantics/CheckUses.scala | 16 ++--- .../CheckSemantics/EvalConstantExprs.scala | 26 ++++---- .../EvalImpliedEnumConsts.scala | 2 +- .../CheckSemantics/FinalizeTypeDefs.scala | 26 ++++---- .../ComputeFrameworkDependencies.scala | 2 +- .../ComputeDependencies/MapUsesToLocs.scala | 12 ++-- .../Semantics/ComponentInstance.scala | 2 +- .../scala/analysis/Semantics/Connection.scala | 2 +- .../analysis/Semantics/PortInstance.scala | 2 +- .../ResolveTopology/PatternResolver.scala | 8 +-- .../main/scala/analysis/Semantics/Value.scala | 66 +++++++++---------- .../src/main/scala/codegen/AstWriter.scala | 4 +- .../codegen/CppWriter/ComputeCppFiles.scala | 2 +- .../codegen/CppWriter/ConstantCppWriter.scala | 2 +- .../codegen/CppWriter/CppDocCppWriter.scala | 14 ++-- .../codegen/CppWriter/CppDocHppWriter.scala | 14 ++-- .../scala/codegen/CppWriter/CppWriter.scala | 2 +- .../src/main/scala/codegen/FppWriter.scala | 2 +- .../scala/codegen/LocateDefsFppWriter.scala | 2 +- .../XmlFppWriter/ComponentXmlFppWriter.scala | 4 +- .../codegen/XmlWriter/ArrayXmlWriter.scala | 2 +- .../codegen/XmlWriter/ComputeXmlFiles.scala | 14 ++-- .../codegen/XmlWriter/EnumXmlWriter.scala | 2 +- .../codegen/XmlWriter/StructXmlWriter.scala | 2 +- .../codegen/XmlWriter/TypeXmlWriter.scala | 10 +-- .../codegen/XmlWriter/ValueXmlWriter.scala | 16 ++--- .../scala/codegen/XmlWriter/XmlWriter.scala | 14 ++-- 35 files changed, 211 insertions(+), 211 deletions(-) diff --git a/compiler/lib/src/main/scala/analysis/Analyzers/Analyzer.scala b/compiler/lib/src/main/scala/analysis/Analyzers/Analyzer.scala index 2f02f0e72..d6477520b 100644 --- a/compiler/lib/src/main/scala/analysis/Analyzers/Analyzer.scala +++ b/compiler/lib/src/main/scala/analysis/Analyzers/Analyzer.scala @@ -14,7 +14,7 @@ trait Analyzer extends AstStateVisitor { case None => Right(a) } - override def transUnit(a: Analysis, tu: Ast.TransUnit): Result = + override def transUnit(a: Analysis, tu: Ast.TransUnit) = visitList(a, tu.members, matchTuMember) } diff --git a/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala b/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala index 72eaaff5c..9efc7727a 100644 --- a/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala +++ b/compiler/lib/src/main/scala/analysis/Analyzers/TypeExpressionAnalyzer.scala @@ -44,10 +44,10 @@ trait TypeExpressionAnalyzer def typeNameNode(a: Analysis, node: AstNode[Ast.TypeName]): Out = matchTypeNameNode(a, node) - override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString): Out = + override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString) = opt(exprNode)(a, tn.size) - override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]): Either[Error,State] = { + override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]) = { val (_, node1, _) = node val data = node1.data for { @@ -57,7 +57,7 @@ trait TypeExpressionAnalyzer } yield a } - override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]): Either[Error,State] = { + override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]) = { val (_, node1, _) = node val data = node1.data for { @@ -70,13 +70,13 @@ trait TypeExpressionAnalyzer } yield a } - override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = { + override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]) = { val (_, node1, _) = node val data = node1.data exprNode(a, data.value) } - override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,State] = { + override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node1, _) = node val data = node1.data for { @@ -86,7 +86,7 @@ trait TypeExpressionAnalyzer } yield a } - override def defPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefPort]]): Either[Error,State] = { + override def defPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefPort]]) = { val (_, node1, _) = node val data = node1.data for { @@ -95,7 +95,7 @@ trait TypeExpressionAnalyzer } yield a } - override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[Error,State] = { + override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node1, _) = node val data = node1.data for { @@ -104,25 +104,25 @@ trait TypeExpressionAnalyzer } yield a } - override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray): Result = + override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray) = visitList(a, e.elts, exprNode) - override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Either[Error,State] = + override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop) = for { a <- exprNode(a, e.e1) a <- exprNode(a, e.e2) } yield a - override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot): Result = exprNode(a, e.e) + override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot) = exprNode(a, e.e) - override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen): Result = exprNode(a, e.e) + override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen) = exprNode(a, e.e) - override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct): Result = + override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct) = visitList(a, e.members, structMemberNode) - override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop): Result = exprNode(a, e.e) + override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop) = exprNode(a, e.e) - override def specCommandAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCommand]]): Either[Error,State] = { + override def specCommandAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCommand]]) = { val (_, node1, _) = node val data = node1.data for { @@ -148,7 +148,7 @@ trait TypeExpressionAnalyzer } } - override def specEventAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecEvent]]): Either[Error,State] = { + override def specEventAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecEvent]]) = { val (_, node1, _) = node val data = node1.data for { @@ -158,12 +158,12 @@ trait TypeExpressionAnalyzer } yield a } - override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]): Result = { + override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]) = { val data = aNode._2.data exprNode(a, data.phase) } - override def specInternalPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecInternalPort]]): Either[Error,State] = { + override def specInternalPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecInternalPort]]) = { val (_, node1, _) = node val data = node1.data for { @@ -172,7 +172,7 @@ trait TypeExpressionAnalyzer } yield a } - override def specParamAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecParam]]): Either[Error,State] = { + override def specParamAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecParam]]) = { val (_, node1, _) = node val data = node1.data for { @@ -184,7 +184,7 @@ trait TypeExpressionAnalyzer } yield a } - override def specPortInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = { + override def specPortInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = { val (_, node1, _) = node val data = node1.data data match { @@ -197,7 +197,7 @@ trait TypeExpressionAnalyzer } } - override def specTlmChannelAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]): Either[Error,State] = { + override def specTlmChannelAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = { def limit(a: Analysis, value: Ast.SpecTlmChannel.Limit) = { val (_, e) = value exprNode(a, e) diff --git a/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala b/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala index 57afa244c..b3eb2107b 100644 --- a/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala +++ b/compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala @@ -24,7 +24,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { /** A use of a type definition */ def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = default(a) - override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]): Either[Error,State] = { + override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]) = { val (_, node1, _) = node val data = node1.data for { @@ -33,7 +33,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { } yield a } - override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot): Result = { + override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot) = { def nameOpt(e: Ast.Expr, qualifier: List[Name.Unqualified]): Option[Name.Qualified] = { e match { case Ast.ExprIdent(id) => { @@ -51,12 +51,12 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { } } - override def exprIdentNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprIdent): Result = { + override def exprIdentNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprIdent) = { val use = Name.Qualified(Nil, e.value) constantUse(a, node, use) } - override def specCompInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCompInstance]]): Result = { + override def specCompInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCompInstance]]) = { val (_, node1, _) = node val data = node1.data qualIdentNode (componentInstanceUse) (a, data.instance) @@ -83,7 +83,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { } } - override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = { + override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = { val (_, node, _) = aNode val data = node.data data match { @@ -115,13 +115,13 @@ trait UseAnalyzer extends TypeExpressionAnalyzer { } } - override def specTopImportAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTopImport]]): Result = { + override def specTopImportAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTopImport]]) = { val (_, node1, _) = node val data = node1.data qualIdentNode(topologyUse)(a, data.top) } - override def typeNameQualIdentNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameQualIdent): Result = { + override def typeNameQualIdentNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameQualIdent) = { val use = Name.Qualified.fromQualIdent(tn.name.data) typeUse(a, node, use) } diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala index 1729b71fa..21819e5e6 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckExprTypes.scala @@ -7,10 +7,10 @@ import fpp.compiler.util._ * and default values */ object CheckExprTypes extends UseAnalyzer { - override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Result = + override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) = visitUse(a, node) - override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Either[Error,State] = { + override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val (_, node, _) = aNode val data = node.data for { @@ -29,7 +29,7 @@ object CheckExprTypes extends UseAnalyzer { } yield a } - override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = { + override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]) = { val (_, node,_) = aNode if (!a.typeMap.contains(node.id)) { val data = node.data @@ -42,7 +42,7 @@ object CheckExprTypes extends UseAnalyzer { else Right(a) } - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,State] = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode val data = node.data for { @@ -60,7 +60,7 @@ object CheckExprTypes extends UseAnalyzer { } yield a } - override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]): Either[Error,State] = { + override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]) = { val (_, node, _) = aNode val data = node.data for { @@ -72,7 +72,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[Error,State] = { + override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node, _) = aNode val data = node.data for { @@ -90,7 +90,7 @@ object CheckExprTypes extends UseAnalyzer { } yield a } - override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray): Either[Error,Analysis] = { + override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray) = { val loc = Locations.get(node.id) val emptyListError = SemanticError.EmptyArray(loc) for { @@ -99,7 +99,7 @@ object CheckExprTypes extends UseAnalyzer { } yield a.assignType(node -> Type.AnonArray(Some(e.elts.size), t)) } - override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Either[Error,State] = { + override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop) = { val loc = Locations.get(node.id) for { a <- super.exprBinopNode(a, node, e) @@ -108,24 +108,24 @@ object CheckExprTypes extends UseAnalyzer { } yield a.assignType(node -> t) } - override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool): Out = + override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool) = Right(a.assignType(node -> Type.Boolean)) - override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat): Out = + override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat) = Right(a.assignType(node -> Type.F64)) - override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt): Out = + override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt) = Right(a.assignType(node -> Type.Integer)) - override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString): Out = + override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString) = Right(a.assignType(node -> Type.String(None))) - override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen): Either[Error,Analysis] = { + override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen) = { for (a <- super.exprParenNode(a, node, e)) yield a.assignType(node -> a.typeMap(e.e.id)) } - override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct): Either[Error,State] = { + override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct) = { def getName(member: Ast.StructMember) = member.name for { _ <- Analysis.checkForDuplicateStructMember(getName)(e.members) @@ -143,7 +143,7 @@ object CheckExprTypes extends UseAnalyzer { } } - override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop): Either[Error,Analysis] = { + override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop) = { val loc = Locations.get(node.id) for { a <- super.exprUnopNode(a, node, e) @@ -154,7 +154,7 @@ object CheckExprTypes extends UseAnalyzer { } yield a.assignType(node -> t) } - override def specCommandAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecCommand]]): Either[Error,State] = { + override def specCommandAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecCommand]]) = { val (_, node, _) = aNode val data = node.data for { @@ -165,7 +165,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def specEventAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]]): Either[Error,State] = { + override def specEventAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]]) = { val (_, node, _) = aNode val data = node.data for { @@ -176,7 +176,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]): Either[Error,State] = { + override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]) = { val (_, node, _) = aNode val data = node.data for { @@ -186,7 +186,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def specInternalPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInternalPort]]): Either[Error,State] = { + override def specInternalPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInternalPort]]) = { val (_, node, _) = aNode val data = node.data for { @@ -196,7 +196,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def specParamAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecParam]]): Either[Error,State] = { + override def specParamAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecParam]]) = { val (_, node, _) = aNode val data = node.data def checkDefault (a: Analysis) (default: AstNode[Ast.Expr]) = { @@ -215,7 +215,7 @@ object CheckExprTypes extends UseAnalyzer { yield a } - override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = { + override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = { val (_, node, _) = aNode val data = node.data data match { @@ -230,7 +230,7 @@ object CheckExprTypes extends UseAnalyzer { } } - override def specTlmChannelAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]): Either[Error,State] = { + override def specTlmChannelAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = { val (_, node, _) = aNode val data = node.data def checkLimitExpr (a: Analysis) (e: AstNode[Ast.Expr]): Result.Result[Unit] = { diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckPortDefs.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckPortDefs.scala index 3e3e38f35..dbe6f5873 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckPortDefs.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckPortDefs.scala @@ -9,7 +9,7 @@ object CheckPortDefs with ModuleAnalyzer { - override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]): Either[Error,State] = { + override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]) = { val (_, node, _) = aNode val data = node.data for (_ <- Analysis.checkForDuplicateParameter(data.params)) diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckSpecLocs.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckSpecLocs.scala index 183e4a96f..b5ae915e4 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckSpecLocs.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckSpecLocs.scala @@ -9,37 +9,37 @@ object CheckSpecLocs with ModuleAnalyzer { - override def defAbsTypeAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefAbsType]]): Result = { + override def defAbsTypeAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefAbsType]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Type, name, node) } - override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Result = { + override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Type, name, node) } - override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = { + override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Constant, name, node) } - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Result = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Type, name, node) } - override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]): Result = { + override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Port, name, node) } - override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Result = { + override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node, _) = aNode val name = node.data.name checkSpecLoc(a, Ast.SpecLoc.Type, name, node) diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckTypeUses.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckTypeUses.scala index 7def373dd..f1d50071a 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckTypeUses.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckTypeUses.scala @@ -8,7 +8,7 @@ import fpp.compiler.util._ * default value expressions are still unevaluated. */ object CheckTypeUses extends UseAnalyzer { - override def defAbsTypeAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefAbsType]]): Result = { + override def defAbsTypeAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefAbsType]]) = { def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefAbsType]]) = { val t = Type.AbsType(aNode) val node = aNode._2 @@ -17,7 +17,7 @@ object CheckTypeUses extends UseAnalyzer { visitIfNeeded(visitor)(a, aNode) } - override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Result = { + override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = for (a <- super.defArrayAnnotatedNode(a, aNode)) yield { @@ -31,7 +31,7 @@ object CheckTypeUses extends UseAnalyzer { visitIfNeeded(visitor)(a, aNode) } - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Result = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode val data = node.data @@ -68,7 +68,7 @@ object CheckTypeUses extends UseAnalyzer { visitIfNeeded(visitor)(a, aNode) } - override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Result = { + override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node, _) = aNode val data = node.data @@ -97,12 +97,12 @@ object CheckTypeUses extends UseAnalyzer { visitIfNeeded(visitor)(a, aNode) } - override def exprNode(a: Analysis, node: AstNode[Ast.Expr]): Result = default(a) + override def exprNode(a: Analysis, node: AstNode[Ast.Expr]) = default(a) - override def typeNameBoolNode(a: Analysis, node: AstNode[Ast.TypeName]): Out = + override def typeNameBoolNode(a: Analysis, node: AstNode[Ast.TypeName]) = Right(a.assignType(node -> Type.Boolean)) - override def typeNameFloatNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameFloat): Out = { + override def typeNameFloatNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameFloat) = { val t = tn.name match { case Ast.F32() => Type.F32 case Ast.F64() => Type.F64 @@ -110,7 +110,7 @@ object CheckTypeUses extends UseAnalyzer { Right(a.assignType(node -> t)) } - override def typeNameIntNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameInt): Out = { + override def typeNameIntNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameInt) = { val t = tn.name match { case Ast.I8() => Type.I8 case Ast.I16() => Type.I16 @@ -124,10 +124,10 @@ object CheckTypeUses extends UseAnalyzer { Right(a.assignType(node -> t)) } - override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString): Out = + override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString) = Right(a.assignType(node -> Type.String(tn.size))) - override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = + override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified) = visitUse(a, node) private def visitUse[T](a: Analysis, node: AstNode[T]): Result = { diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUseDefCycles.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUseDefCycles.scala index b29bf6a47..3676d2dd7 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUseDefCycles.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUseDefCycles.scala @@ -6,43 +6,43 @@ import fpp.compiler.util._ /** Check for use-def cycles */ object CheckUseDefCycles extends UseAnalyzer { - override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Result = + override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) = visitUse(a, node, use) - override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]): Result = { + override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]) = { val symbol = Symbol.Array(node) visitDefPost(a, symbol, node, super.defArrayAnnotatedNode) } - override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = { + override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]) = { val symbol = Symbol.Constant(node) visitDefPost(a, symbol, node, super.defConstantAnnotatedNode) } - override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]): Result = { + override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val symbol = Symbol.Enum(node) visitDefPost(a, symbol, node, super.defEnumAnnotatedNode) } - override def defEnumConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnumConstant]]): Result = { + override def defEnumConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnumConstant]]) = { val symbol = Symbol.EnumConstant(node) visitDefPost(a, symbol, node, super.defEnumConstantAnnotatedNode) } - override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]): Result = { + override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val symbol = Symbol.Struct(node) visitDefPost(a, symbol, node, super.defStructAnnotatedNode) } - override def defTopologyAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefTopology]]): Result = { + override def defTopologyAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefTopology]]) = { val symbol = Symbol.Topology(node) visitDefPost(a, symbol, node, super.defTopologyAnnotatedNode) } - override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = visitUse(a, node, use) - override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = + override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified) = visitUse(a, node, use) private def error(a: Analysis, symbol: Symbol): Result = { diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUses.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUses.scala index ca3847a5d..417877e7a 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUses.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/CheckUses.scala @@ -6,13 +6,13 @@ import fpp.compiler.util._ /** Match uses to their definitions */ object CheckUses extends UseAnalyzer { - override def componentInstanceUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def componentInstanceUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = visitQualIdentNode (NameGroup.ComponentInstance) (a, node) - override def componentUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def componentUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = visitQualIdentNode (NameGroup.Component) (a, node) - override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Result = { + override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) = { def visitExprNode(a: Analysis, node: AstNode[Ast.Expr]): Result = { def visitExprIdent(a: Analysis, node: AstNode[Ast.Expr], name: Name.Unqualified) = { val mapping = a.nestedScope.get (NameGroup.Value) _ @@ -55,7 +55,7 @@ object CheckUses extends UseAnalyzer { visitExprNode(a, node) } - override def defComponentAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefComponent]]): Either[Error,Analysis] = { + override def defComponentAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefComponent]]) = { val (_, node, _) = aNode val data = node.data for { @@ -69,7 +69,7 @@ object CheckUses extends UseAnalyzer { } yield a.copy(nestedScope = a.nestedScope.pop) } - override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,Analysis] = { + override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node1, _) = node val data = node1.data for { @@ -106,13 +106,13 @@ object CheckUses extends UseAnalyzer { yield a.copy(nestedScope = a.nestedScope.pop) } - override def portUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def portUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = visitQualIdentNode (NameGroup.Port) (a, node) - override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = visitQualIdentNode (NameGroup.Topology) (a, node) - override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = { + override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified) = { val data = node.data data match { case Ast.TypeNameQualIdent(qualIdentNode) => for { diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalConstantExprs.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalConstantExprs.scala index 322b1cff0..17f27d482 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalConstantExprs.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalConstantExprs.scala @@ -6,10 +6,10 @@ import fpp.compiler.util._ /** Compute the values of constants symbols and expressions */ object EvalConstantExprs extends UseAnalyzer { - override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Result = + override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) = visitUse(a, node) - override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = { + override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]) = { val (_, node,_) = aNode if (!a.valueMap.contains(node.id)) { val data = node.data @@ -22,7 +22,7 @@ object EvalConstantExprs extends UseAnalyzer { else Right(a) } - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,State] = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { def checkForDuplicateValue( a: Analysis, ids: List[AstNode.Id], @@ -47,7 +47,7 @@ object EvalConstantExprs extends UseAnalyzer { } yield a } - override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]): Result = { + override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]) = { val (_, node, _) = aNode if (!a.valueMap.contains(node.id)) { node.data.value match { @@ -72,7 +72,7 @@ object EvalConstantExprs extends UseAnalyzer { else Right(a) } - override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray): Either[Error,Analysis] = + override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray) = for (a <- super.exprArrayNode(a, node, e)) yield { val eltType = a.typeMap(node.id) match { @@ -88,7 +88,7 @@ object EvalConstantExprs extends UseAnalyzer { a.assignValue(node -> v) } - override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Either[Error,Analysis] = + override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop) = for { a <- super.exprBinopNode(a, node, e) v <- e.op match { @@ -99,7 +99,7 @@ object EvalConstantExprs extends UseAnalyzer { } } yield a.assignValue(node -> v) - override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool): Out = { + override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool) = { val b = e.value match { case Ast.LiteralBool.True => true case Ast.LiteralBool.False => false @@ -109,29 +109,29 @@ object EvalConstantExprs extends UseAnalyzer { } - override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat): Out = { + override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat) = { val v = Value.Float(e.value.toDouble, Type.Float.F64) Right(a.assignValue(node -> v)) } - override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt): Out = { + override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt) = { val bigInt = if (e.value.startsWith("0x") || e.value.startsWith("0X")) BigInt(e.value.substring(2, e.value.length), 16) else BigInt(e.value) val v = Value.Integer(bigInt) Right(a.assignValue(node -> v)) } - override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString): Out = { + override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString) = { val v = Value.String(e.value) Right(a.assignValue(node -> v)) } - override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen): Either[Error,Analysis] = { + override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen) = { for (a <- super.exprParenNode(a, node, e)) yield a.assignValue(node -> a.valueMap(e.e.id)) } - override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct): Either[Error,Analysis] = + override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct) = for (a <- super.exprStructNode(a, node, e)) yield { def visitor(members: Value.Struct.Members, node: AstNode[Ast.StructMember]): Value.Struct.Members = { @@ -145,7 +145,7 @@ object EvalConstantExprs extends UseAnalyzer { a.assignValue(node -> v) } - override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop): Either[Error,Analysis] = { + override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop) = { for (a <- super.exprUnopNode(a, node, e)) yield { val v = a.neg(e.e.id) diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalImpliedEnumConsts.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalImpliedEnumConsts.scala index 7d6622665..015fbe6c2 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalImpliedEnumConsts.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/EvalImpliedEnumConsts.scala @@ -10,7 +10,7 @@ object EvalImpliedEnumConsts with ComponentAnalyzer { - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Out = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode val loc = Locations.get(node.id) val data = node.data diff --git a/compiler/lib/src/main/scala/analysis/CheckSemantics/FinalizeTypeDefs.scala b/compiler/lib/src/main/scala/analysis/CheckSemantics/FinalizeTypeDefs.scala index 8158c6c7f..2e5cb6cea 100644 --- a/compiler/lib/src/main/scala/analysis/CheckSemantics/FinalizeTypeDefs.scala +++ b/compiler/lib/src/main/scala/analysis/CheckSemantics/FinalizeTypeDefs.scala @@ -9,15 +9,15 @@ object FinalizeTypeDefs extends TypeExpressionAnalyzer { - override def exprNode(a: Analysis, node: AstNode[Ast.Expr]): Result = default(a) + override def exprNode(a: Analysis, node: AstNode[Ast.Expr]) = default(a) - override def typeNameNode(a: Analysis, node: AstNode[Ast.TypeName]): Either[Error,State] = { + override def typeNameNode(a: Analysis, node: AstNode[Ast.TypeName]) = { val t1 = a.typeMap(node.id) for (t2 <- TypeVisitor.ty(a, t1)) yield if (t1 != t2) a.assignType(node -> t2) else a } - override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Result = { + override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val symbol = Symbol.Array(aNode) def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val node = aNode._2 @@ -66,7 +66,7 @@ object FinalizeTypeDefs visitIfNeeded(symbol, visitor)(a, aNode) } - override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Result = { + override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val symbol = Symbol.Enum(aNode) def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode @@ -83,7 +83,7 @@ object FinalizeTypeDefs visitIfNeeded(symbol, visitor)(a, aNode) } - override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Result = { + override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val symbol = Symbol.Struct(aNode) def visitor(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node, _) = aNode @@ -156,7 +156,7 @@ object FinalizeTypeDefs visitIfNeeded(symbol, visitor)(a, aNode) } - override def transUnit(a: Analysis, tu: Ast.TransUnit): Result = + override def transUnit(a: Analysis, tu: Ast.TransUnit) = super.transUnit(a.copy(visitedSymbolSet = Set()), tu) private def visitIfNeeded[T] @@ -175,21 +175,21 @@ object FinalizeTypeDefs type Out = Result.Result[Type] - override def default(a: Analysis, t: Type): Out = Right(t) + override def default(a: Analysis, t: Type) = Right(t) - override def array(a: Analysis, t: Type.Array): Either[Error,Type] = + override def array(a: Analysis, t: Type.Array) = for (a <- defArrayAnnotatedNode(a, t.node)) yield a.typeMap(t.node._2.id) - override def anonArray(a: Analysis, t: Type.AnonArray): Either[Error,Type.AnonArray] = + override def anonArray(a: Analysis, t: Type.AnonArray) = for (eltType <- ty(a, t.eltType)) yield Type.AnonArray(t.size, eltType) - override def enumeration(a: Analysis, t: Type.Enum): Either[Error,Type] = + override def enumeration(a: Analysis, t: Type.Enum) = for (a <- defEnumAnnotatedNode(a, t.node)) yield a.typeMap(t.node._2.id) - override def string(a: Analysis, t: Type.String): Out = + override def string(a: Analysis, t: Type.String) = t.size match { case Some(e) => { val id = e.id @@ -206,11 +206,11 @@ object FinalizeTypeDefs case None => Right(t) } - override def struct(a: Analysis, t: Type.Struct): Either[Error,Type] = + override def struct(a: Analysis, t: Type.Struct) = for (a <- defStructAnnotatedNode(a, t.node)) yield a.typeMap(t.node._2.id) - override def anonStruct(a: Analysis, t: Type.AnonStruct): Either[Error,Type.AnonStruct] = { + override def anonStruct(a: Analysis, t: Type.AnonStruct) = { def visitor(member: Type.Struct.Member): Result.Result[Type.Struct.Member] = for (memberType <- ty(a, member._2)) yield member._1 -> memberType for (members <- Result.map(t.members.toList, visitor)) diff --git a/compiler/lib/src/main/scala/analysis/ComputeDependencies/Framework/ComputeFrameworkDependencies.scala b/compiler/lib/src/main/scala/analysis/ComputeDependencies/Framework/ComputeFrameworkDependencies.scala index 51d2edb7a..c61cc60e7 100644 --- a/compiler/lib/src/main/scala/analysis/ComputeDependencies/Framework/ComputeFrameworkDependencies.scala +++ b/compiler/lib/src/main/scala/analysis/ComputeDependencies/Framework/ComputeFrameworkDependencies.scala @@ -49,7 +49,7 @@ object ComputeFrameworkDependencies extends AstStateVisitor { } } - override def transUnit(s: State, tu: Ast.TransUnit): Result = + override def transUnit(s: State, tu: Ast.TransUnit) = visitList(s, tu.members, matchTuMember) } diff --git a/compiler/lib/src/main/scala/analysis/ComputeDependencies/MapUsesToLocs.scala b/compiler/lib/src/main/scala/analysis/ComputeDependencies/MapUsesToLocs.scala index 58556d158..9f4c57645 100644 --- a/compiler/lib/src/main/scala/analysis/ComputeDependencies/MapUsesToLocs.scala +++ b/compiler/lib/src/main/scala/analysis/ComputeDependencies/MapUsesToLocs.scala @@ -8,13 +8,13 @@ import fpp.compiler.util._ /** Map uses to locations */ object MapUsesToLocs extends UseAnalyzer { - override def componentInstanceUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def componentInstanceUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = analyzeUse(a, Ast.SpecLoc.ComponentInstance, use) - override def componentUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def componentUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = analyzeUse(a, Ast.SpecLoc.Component, use) - override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Either[Error,State] = + override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) = for { // Analyze as a constant a <- analyzeUse(a, Ast.SpecLoc.Constant, use) @@ -28,13 +28,13 @@ object MapUsesToLocs extends UseAnalyzer { } } yield a - override def portUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def portUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = analyzeUse(a, Ast.SpecLoc.Port, use) - override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified): Result = + override def topologyUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = analyzeUse(a, Ast.SpecLoc.Topology, use) - override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = + override def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified) = analyzeUse(a, Ast.SpecLoc.Type, use) private def analyzeUse(a: Analysis, kind: Ast.SpecLoc.Kind, use: Name.Qualified): Result = { diff --git a/compiler/lib/src/main/scala/analysis/Semantics/ComponentInstance.scala b/compiler/lib/src/main/scala/analysis/Semantics/ComponentInstance.scala index 65820e152..3069157bd 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/ComponentInstance.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/ComponentInstance.scala @@ -41,7 +41,7 @@ final case class ComponentInstance( /** Gets the location of the component instance */ def getLoc: Location = Locations.get(aNode._2.id) - override def compare(that: ComponentInstance): Int = + override def compare(that: ComponentInstance) = this.qualifiedName.toString.compare(that.qualifiedName.toString) } diff --git a/compiler/lib/src/main/scala/analysis/Semantics/Connection.scala b/compiler/lib/src/main/scala/analysis/Semantics/Connection.scala index 343017a55..ea0105486 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/Connection.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/Connection.scala @@ -108,7 +108,7 @@ object Connection { case None => port.toString } - override def compare(that: Endpoint): Int = { + override def compare(that: Endpoint) = { val name1 = this.port.getQualifiedName.toString val name2 = that.port.getQualifiedName.toString val nameCompare = name1.compare(name2) diff --git a/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala b/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala index 3b67c3607..d679ccd2f 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/PortInstance.scala @@ -157,7 +157,7 @@ object PortInstance { override def getUnqualifiedName = aNode._2.data.name - override def requireConnectionAt(loc: Location): Result.Result[Unit] = Left( + override def requireConnectionAt(loc: Location) = Left( SemanticError.InvalidPortKind( loc, "cannot connect to internal port", diff --git a/compiler/lib/src/main/scala/analysis/Semantics/ResolveTopology/PatternResolver.scala b/compiler/lib/src/main/scala/analysis/Semantics/ResolveTopology/PatternResolver.scala index ebc3a6709..6c154ceb6 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/ResolveTopology/PatternResolver.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/ResolveTopology/PatternResolver.scala @@ -209,7 +209,7 @@ object PatternResolver { cmdResponseIn <- getCmdResponseIn } yield Source(cmdRegIn, cmdOut, cmdResponseIn) - override def resolveTarget(targetUse: (ComponentInstance, Location)): Either[Error,Target] = + override def resolveTarget(targetUse: (ComponentInstance, Location)) = for { cmdRegOut <- getCmdRegOut(targetUse) cmdIn <- getCmdIn(targetUse) @@ -252,7 +252,7 @@ object PatternResolver { portTypeName ) - override def resolveTarget(targetUse: (ComponentInstance, Location)): Result.Result[PortInstanceIdentifier] = + override def resolveTarget(targetUse: (ComponentInstance, Location)) = getSpecialPort(targetUse, kind) override def getConnectionsForTarget( @@ -333,7 +333,7 @@ object PatternResolver { override def resolveSource: Either[Error,Health.PingPorts] = getPingPorts(pattern.source) - override def resolveTarget(targetUse: (ComponentInstance, Location)): Either[Error,Health.PingPorts] = + override def resolveTarget(targetUse: (ComponentInstance, Location)) = getPingPorts(targetUse) override def getConnectionsForTarget( @@ -403,7 +403,7 @@ object PatternResolver { prmSetIn <- getPrmSetIn } yield Source(prmGetIn, prmSetIn) - override def resolveTarget(targetUse: (ComponentInstance, Location)): Either[Error,Target] = + override def resolveTarget(targetUse: (ComponentInstance, Location)) = for { prmGetOut <- getPrmGetOut(targetUse) prmSetOut <- getPrmSetOut(targetUse) diff --git a/compiler/lib/src/main/scala/analysis/Semantics/Value.scala b/compiler/lib/src/main/scala/analysis/Semantics/Value.scala index c8dceab9b..605cd99ff 100644 --- a/compiler/lib/src/main/scala/analysis/Semantics/Value.scala +++ b/compiler/lib/src/main/scala/analysis/Semantics/Value.scala @@ -124,7 +124,7 @@ object Value { case _ => None } - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case Type.PrimitiveInt(kind1) => Some(PrimitiveInt(value, kind1)) case Type.Integer => Some(Integer(value)) @@ -132,11 +132,11 @@ object Value { case _ => promoteToAggregate(t) } - override def getType: Type.PrimitiveInt = Type.PrimitiveInt(kind) + override def getType = Type.PrimitiveInt(kind) - override def isZero: scala.Boolean = (value == 0) + override def isZero = (value == 0) - override def toString: lang.String = value.toString + ": " + kind.toString + override def toString = value.toString + ": " + kind.toString override def truncate: PrimitiveInt = { def truncateUnsigned(v: BigInt, shiftAmt: Int) = { @@ -169,7 +169,7 @@ object Value { (value >= - (u64Bound / 2) && value < u64Bound) } - override protected[analysis] def binop(op: Binop)(v: Value): Option[Value] = v match { + override protected[analysis] def binop(op: Binop)(v: Value) = v match { case PrimitiveInt(value1, kind1) => { val result = op.intOp(value, value1) Some(Integer(result)) @@ -184,7 +184,7 @@ object Value { case _ => None } - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case Type.PrimitiveInt(kind1) => Some(PrimitiveInt(value, kind1)) case Type.Integer => Some(Integer(value)) @@ -194,9 +194,9 @@ object Value { override def getType = Type.Integer - override def isZero: scala.Boolean = (value == 0) + override def isZero = (value == 0) - override def toString: lang.String = value.toString + override def toString = value.toString override def unary_- = Some(Integer(-value)) @@ -205,7 +205,7 @@ object Value { /** Floating-point values */ case class Float(value: Double, kind: Type.Float.Kind) extends Value { - override protected[analysis] def binop(op: Binop)(v: Value): Option[Value] = v match { + override protected[analysis] def binop(op: Binop)(v: Value) = v match { case PrimitiveInt(value1, kind1) => { val result = op.doubleOp(value, value1.toDouble) Some(Float(result.toFloat, Type.Float.F64)) @@ -228,18 +228,18 @@ object Value { override def isZero: scala.Boolean = (Math.abs(value) < Float.EPSILON) - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case Type.PrimitiveInt(kind1) => Some(PrimitiveInt(value.intValue, kind1)) case Type.Integer => Some(Integer(value.intValue)) case Type.Float(kind1) => Some(Float(value, kind1)) case _ => promoteToAggregate(t) } - override def getType: Type.Float = Type.Float(kind) + override def getType = Type.Float(kind) - override def toString: lang.String = value.toString + ": " + kind.toString + override def toString = value.toString + ": " + kind.toString - override def truncate: Value = kind match { + override def truncate = kind match { case Type.Float.F32 => Float(value.toFloat, kind) case Type.Float.F64 => this } @@ -258,26 +258,26 @@ object Value { /** Boolean values */ case class Boolean(value: scala.Boolean) extends Value { - override def convertToDistinctType(t: Type): Option[Value] = promoteToAggregate(t) + override def convertToDistinctType(t: Type) = promoteToAggregate(t) override def getType = Type.Boolean - override def toString: lang.String = value.toString + override def toString = value.toString } /** String values */ case class String(value: java.lang.String) extends Value { - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case Type.String(_) => Some(this) case _ => promoteToAggregate(t) } - override def getType: Type.String = Type.String(None) + override def getType = Type.String(None) - override def toString: lang.String = "\"" + value.toString + "\"" + override def toString = "\"" + value.toString + "\"" } @@ -306,16 +306,16 @@ object Value { yield Array(anonArray, arrayType) } - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case anonArrayType : Type.AnonArray => convertToAnonArray(anonArrayType) case arrayType : Type.Array => convertToArray(arrayType) case _ => None } - override def getType: Type.AnonArray = Type.AnonArray(Some(elements.size), elements.head.getType) + override def getType = Type.AnonArray(Some(elements.size), elements.head.getType) - override def toString: lang.String = "[ " ++ elements.mkString(", ") ++ " ]" + override def toString = "[ " ++ elements.mkString(", ") ++ " ]" override def truncate: AnonArray = AnonArray(elements.map(_.truncate)) @@ -326,7 +326,7 @@ object Value { override def getType = t - override def toString: lang.String = s"value of type $t" + override def toString = s"value of type $t" } @@ -339,7 +339,7 @@ object Value { def convertToArray(arrayType: Type.Array): Option[Value.Array] = anonArray.convertToArray(arrayType) - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case anonArrayType : Type.AnonArray => convertToAnonArray(anonArrayType) case arrayType : Type.Array => convertToArray(arrayType) @@ -348,7 +348,7 @@ object Value { override def getType = t - override def toString: lang.String = anonArray.toString ++ ": " ++ t.node._2.data.name + override def toString = anonArray.toString ++ ": " ++ t.node._2.data.name override def truncate: Array = Array(anonArray.truncate, t) @@ -357,12 +357,12 @@ object Value { /** Enum constant values */ case class EnumConstant(value: (Name.Unqualified, BigInt), t: Type.Enum) extends Value { - override protected[analysis] def binop(op: Binop)(v: Value): Option[Value] = convertToRepType.binop(op)(v) + override protected[analysis] def binop(op: Binop)(v: Value) = convertToRepType.binop(op)(v) /** Convert the enum to the representation type */ def convertToRepType: PrimitiveInt = PrimitiveInt(value._2, t.repType.kind) - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = convertToRepType.convertToDistinctType(t) match { case Some(v) => Some(v) case None => promoteToAggregate(t) @@ -372,7 +372,7 @@ object Value { override def isZero = convertToRepType.isZero - override def toString: lang.String = value.toString ++ ": " ++ t.node._2.data.name + override def toString = value.toString ++ ": " ++ t.node._2.data.name override def unary_- = - convertToRepType @@ -406,20 +406,20 @@ object Value { yield Struct(anonStruct, structType) } - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case anonStructType : Type.AnonStruct => convertToAnonStruct(anonStructType) case structType : Type.Struct => convertToStruct(structType) case _ => None } - override def getType: Type.AnonStruct = { + override def getType = { def f(member: Struct.Member): Type.Struct.Member = (member._1, member._2.getType) val typeMembers = members.map(f) Type.AnonStruct(typeMembers) } - override def toString: lang.String = { + override def toString = { def memberToString(member: Struct.Member) = member._1 ++ " = " ++ member._2.toString members.size match { case 0 => "{ }" @@ -444,7 +444,7 @@ object Value { anonStruct.convertToAnonStruct(anonStructType) def convertToStruct(structType: Type.Struct): Option[Value.Struct] = anonStruct.convertToStruct(structType) - override def convertToDistinctType(t: Type): Option[Value] = + override def convertToDistinctType(t: Type) = t match { case anonStructType : Type.AnonStruct => convertToAnonStruct(anonStructType) case structType : Type.Struct => convertToStruct(structType) @@ -453,9 +453,9 @@ object Value { override def getType: Type.Struct = t - override def toString: lang.String = anonStruct.toString ++ ": " ++ t.node._2.data.name + override def toString = anonStruct.toString ++ ": " ++ t.node._2.data.name - override def truncate: Struct = Struct(anonStruct.truncate, t) + override def truncate = Struct(anonStruct.truncate, t) } diff --git a/compiler/lib/src/main/scala/codegen/AstWriter.scala b/compiler/lib/src/main/scala/codegen/AstWriter.scala index 9fac4c917..cca082829 100644 --- a/compiler/lib/src/main/scala/codegen/AstWriter.scala +++ b/compiler/lib/src/main/scala/codegen/AstWriter.scala @@ -139,7 +139,7 @@ object AstWriter extends AstVisitor with LineUtils { (ident(data.name) ++ data.members.map(topologyMember).flatten).map(indentIn) } - override def default(in: Unit): Out = + override def default(in: Unit) = throw new InternalError("AstWriter: Visitor not implemented") override def exprArrayNode( @@ -447,7 +447,7 @@ object AstWriter extends AstVisitor with LineUtils { qualIdent(data.top.data).map(indentIn) } - override def transUnit(in: Unit, tu: Ast.TransUnit): List[Line] = + override def transUnit(in: Unit, tu: Ast.TransUnit) = tu.members.map(tuMember).flatten override def typeNameBoolNode( diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComputeCppFiles.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComputeCppFiles.scala index 0bc184ca4..72bcc8b1a 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComputeCppFiles.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComputeCppFiles.scala @@ -56,7 +56,7 @@ object ComputeCppFiles extends AstStateVisitor { addMappings(s, FileNames.getTopology(name), Some(loc)) } - override def transUnit(s: State, tu: Ast.TransUnit): Result = + override def transUnit(s: State, tu: Ast.TransUnit) = visitList(s, tu.members, matchTuMember) /** Adds mappings for hpp and cppfiles */ diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ConstantCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ConstantCppWriter.scala index 8d1d1c053..66093d4ae 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ConstantCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ConstantCppWriter.scala @@ -103,7 +103,7 @@ object ConstantCppWriter { members } - override def transUnit(s: CppWriterState, tu: Ast.TransUnit): List[CppDoc.Member] = + override def transUnit(s: CppWriterState, tu: Ast.TransUnit) = tu.members.flatMap(matchTuMember(s, _)) private def writeBooleanConstant(name: String, value: String) = diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala index 89506738c..ee7cd49a8 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala @@ -20,14 +20,14 @@ object CppDocCppWriter extends CppDocWriter { } } - override def visitClass(in: Input, c: CppDoc.Class): Output = { + override def visitClass(in: Input, c: CppDoc.Class) = { val name = c.name val newClassNameList = name :: in.classNameList val in1 = in.copy(classNameList = newClassNameList) c.members.map(visitClassMember(in1, _)).flatten } - override def visitConstructor(in: Input, constructor: CppDoc.Class.Constructor): List[Line] = { + override def visitConstructor(in: Input, constructor: CppDoc.Class.Constructor) = { val unqualifiedClassName = in.getEnclosingClassUnqualified val qualifiedClassName = in.getEnclosingClassQualified val outputLines = { @@ -58,7 +58,7 @@ object CppDocCppWriter extends CppDocWriter { outputLines } - override def visitCppDoc(cppDoc: CppDoc): Output = { + override def visitCppDoc(cppDoc: CppDoc) = { val in = Input(cppDoc.hppFile, cppDoc.cppFileName) List( CppDocWriter.writeBanner( @@ -69,7 +69,7 @@ object CppDocCppWriter extends CppDocWriter { ).flatten } - override def visitDestructor(in: Input, destructor: CppDoc.Class.Destructor): List[Line] = { + override def visitDestructor(in: Input, destructor: CppDoc.Class.Destructor) = { val unqualifiedClassName = in.getEnclosingClassUnqualified val qualifiedClassName = in.getEnclosingClassQualified val outputLines = { @@ -81,7 +81,7 @@ object CppDocCppWriter extends CppDocWriter { outputLines } - override def visitFunction(in: Input, function: CppDoc.Function): List[Line] = { + override def visitFunction(in: Input, function: CppDoc.Function) = { val contentLines = { val startLines = { val prototypeLines = { @@ -111,7 +111,7 @@ object CppDocCppWriter extends CppDocWriter { Line.blank :: contentLines } - override def visitLines(in: Input, lines: CppDoc.Lines): Output = { + override def visitLines(in: Input, lines: CppDoc.Lines) = { val content = lines.content lines.output match { case CppDoc.Lines.Hpp => Nil @@ -120,7 +120,7 @@ object CppDocCppWriter extends CppDocWriter { } } - override def visitNamespace(in: Input, namespace: CppDoc.Namespace): Output = { + override def visitNamespace(in: Input, namespace: CppDoc.Namespace) = { val name = namespace.name val startLines = List(Line.blank, line(s"namespace $name {")) val outputLines = namespace.members.map(visitNamespaceMember(in, _)).flatten diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala index 8f4c07e03..34bdca850 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala @@ -51,7 +51,7 @@ object CppDocHppWriter extends CppDocWriter { } } - override def visitClass(in: Input, c: CppDoc.Class): Output = { + override def visitClass(in: Input, c: CppDoc.Class) = { val name = c.name val commentLines = CppDocWriter.writeDoxygenCommentOpt(c.comment) val openLines = c.superclassDecls match { @@ -72,7 +72,7 @@ object CppDocHppWriter extends CppDocWriter { commentLines ++ openLines ++ bodyLines ++ closeLines } - override def visitConstructor(in: Input, constructor: CppDoc.Class.Constructor): List[Line] = { + override def visitConstructor(in: Input, constructor: CppDoc.Class.Constructor) = { val unqualifiedClassName = in.getEnclosingClassUnqualified val outputLines = { val lines1 = CppDocWriter.writeDoxygenCommentOpt(constructor.comment) @@ -85,7 +85,7 @@ object CppDocHppWriter extends CppDocWriter { outputLines } - override def visitCppDoc(cppDoc: CppDoc): Output = { + override def visitCppDoc(cppDoc: CppDoc) = { val hppFile = cppDoc.hppFile val cppFileName = cppDoc.cppFileName val in = Input(hppFile, cppFileName) @@ -100,7 +100,7 @@ object CppDocHppWriter extends CppDocWriter { ).flatten } - override def visitDestructor(in: Input, destructor: CppDoc.Class.Destructor): List[Line] = { + override def visitDestructor(in: Input, destructor: CppDoc.Class.Destructor) = { val unqualifiedClassName = in.getEnclosingClassUnqualified val outputLines = { val lines1 = CppDocWriter.writeDoxygenCommentOpt(destructor.comment) @@ -113,7 +113,7 @@ object CppDocHppWriter extends CppDocWriter { outputLines } - override def visitFunction(in: Input, function: CppDoc.Function): List[Line] = { + override def visitFunction(in: Input, function: CppDoc.Function) = { import CppDoc.Function._ val outputLines = { val lines1 = CppDocWriter.writeDoxygenCommentOpt(function.comment) @@ -145,7 +145,7 @@ object CppDocHppWriter extends CppDocWriter { outputLines } - override def visitLines(in: Input, lines: CppDoc.Lines): Output = { + override def visitLines(in: Input, lines: CppDoc.Lines) = { val content = lines.content lines.output match { case CppDoc.Lines.Hpp => content @@ -154,7 +154,7 @@ object CppDocHppWriter extends CppDocWriter { } } - override def visitNamespace(in: Input, namespace: CppDoc.Namespace): Output = { + override def visitNamespace(in: Input, namespace: CppDoc.Namespace) = { val name = namespace.name val startLines = List(Line.blank, line(s"namespace $name {")) val outputLines = namespace.members.map(visitNamespaceMember(in, _)).flatten diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriter.scala index cc7aed183..810cf65fd 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriter.scala @@ -28,7 +28,7 @@ object CppWriter extends AstStateVisitor with LineUtils { writeCppDoc(s, cppDoc) } - override def transUnit(s: CppWriterState, tu: Ast.TransUnit): Result = + override def transUnit(s: CppWriterState, tu: Ast.TransUnit) = visitList(s, tu.members, matchTuMember) def tuList(s: CppWriterState, tul: List[Ast.TransUnit]): Either[Error,Unit] = diff --git a/compiler/lib/src/main/scala/codegen/FppWriter.scala b/compiler/lib/src/main/scala/codegen/FppWriter.scala index 7b58b20e6..e3f091e1a 100644 --- a/compiler/lib/src/main/scala/codegen/FppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/FppWriter.scala @@ -185,7 +185,7 @@ object FppWriter extends AstVisitor with LineUtils { List(Line.blank, line("}")) } - override def default(in: Unit): Out = + override def default(in: Unit) = throw new InternalError("FppWriter: Visitor not implemented") override def exprArrayNode( diff --git a/compiler/lib/src/main/scala/codegen/LocateDefsFppWriter.scala b/compiler/lib/src/main/scala/codegen/LocateDefsFppWriter.scala index 80a45cf98..6863c3417 100644 --- a/compiler/lib/src/main/scala/codegen/LocateDefsFppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/LocateDefsFppWriter.scala @@ -110,7 +110,7 @@ object LocateDefsFppWriter extends AstVisitor with LineUtils { writeSpecLoc(s, Ast.SpecLoc.Topology, data.name, node) } - override def transUnit(s: State, tu: Ast.TransUnit): List[Line] = + override def transUnit(s: State, tu: Ast.TransUnit) = tu.members.flatMap(matchModuleMember(s, _)) private def writeSpecLoc[T]( diff --git a/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala b/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala index 5b33821e2..3138d04d4 100644 --- a/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlFppWriter/ComponentXmlFppWriter.scala @@ -335,7 +335,7 @@ object ComponentXmlFppWriter extends LineUtils { val xmlName = "parameter" - override def generateMemberNodes(file: XmlFppWriter.File, xmlNode: scala.xml.Node): Either[Error,List[Ast.Annotated[Ast.ComponentMember.Node]]] = { + override def generateMemberNodes(file: XmlFppWriter.File, xmlNode: scala.xml.Node) = { for { enumAnnotatedOpt <- XmlFppWriter.FppBuilder.InlineEnumBuilder.defEnumAnnotatedOpt(file)(xmlNode) comment <- file.getComment(xmlNode) @@ -384,7 +384,7 @@ object ComponentXmlFppWriter extends LineUtils { val xmlName = "channel" - override def generateMemberNodes(file: XmlFppWriter.File, xmlNode: scala.xml.Node): Either[Error,List[Ast.Annotated[Ast.ComponentMember.Node]]] = { + override def generateMemberNodes(file: XmlFppWriter.File, xmlNode: scala.xml.Node) = { type Limits = List[Ast.SpecTlmChannel.Limit] def translateLimits( direction: String, diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/ArrayXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/ArrayXmlWriter.scala index 50ea8486e..1c33481ea 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/ArrayXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/ArrayXmlWriter.scala @@ -9,7 +9,7 @@ object ArrayXmlWriter extends AstVisitor with LineUtils { override def default(s: XmlWriterState) = Nil - override def defArrayAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): List[Line] = { + override def defArrayAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val node = aNode._2 val data = node.data val tags = { diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/ComputeXmlFiles.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/ComputeXmlFiles.scala index 77ebadb19..1d1a1ec31 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/ComputeXmlFiles.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/ComputeXmlFiles.scala @@ -16,7 +16,7 @@ object ComputeXmlFiles extends AstStateVisitor { type State = XmlWriterState - override def defArrayAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefArray]]): Either[CodeGenError.DuplicateXmlFile,XmlWriterState] = { + override def defArrayAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefArray]]) = { val (_, node1, _) = node val data = node1.data val loc = Locations.get(node1.id) @@ -25,7 +25,7 @@ object ComputeXmlFiles extends AstStateVisitor { addMapping(s, fileName, loc) } - override def defComponentAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefComponent]]): Either[Error,XmlWriterState] = { + override def defComponentAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefComponent]]) = { val (_, node1, _) = node val data = node1.data val loc = Locations.get(node1.id) @@ -38,7 +38,7 @@ object ComputeXmlFiles extends AstStateVisitor { yield s } - override def defEnumAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[CodeGenError.DuplicateXmlFile,XmlWriterState] = { + override def defEnumAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node1, _) = node val data = node1.data val loc = Locations.get(node1.id) @@ -56,7 +56,7 @@ object ComputeXmlFiles extends AstStateVisitor { visitList(s, data.members, matchModuleMember) } - override def defPortAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefPort]]): Either[CodeGenError.DuplicateXmlFile,XmlWriterState] = { + override def defPortAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefPort]]) = { val (_, node1, _) = node val data = node1.data val loc = Locations.get(node1.id) @@ -65,7 +65,7 @@ object ComputeXmlFiles extends AstStateVisitor { addMapping(s, fileName, loc) } - override def defStructAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[CodeGenError.DuplicateXmlFile,XmlWriterState] = { + override def defStructAnnotatedNode(s: State, node: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node1, _) = node val data = node1.data val loc = Locations.get(node1.id) @@ -74,7 +74,7 @@ object ComputeXmlFiles extends AstStateVisitor { addMapping(s, fileName, loc) } - override def defTopologyAnnotatedNode(s: State, aNode: Ast.Annotated[AstNode[Ast.DefTopology]]): Either[CodeGenError.DuplicateXmlFile,XmlWriterState] = { + override def defTopologyAnnotatedNode(s: State, aNode: Ast.Annotated[AstNode[Ast.DefTopology]]) = { val (_, node, _) = aNode val data = node.data val loc = Locations.get(node.id) @@ -83,7 +83,7 @@ object ComputeXmlFiles extends AstStateVisitor { addMapping(s, fileName, loc) } - override def transUnit(s: State, tu: Ast.TransUnit): Result = + override def transUnit(s: State, tu: Ast.TransUnit) = visitList(s, tu.members, matchTuMember) private def addMapping(s: State, fileName: String, loc: Location) = diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/EnumXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/EnumXmlWriter.scala index 1500feeb0..113a4e95a 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/EnumXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/EnumXmlWriter.scala @@ -9,7 +9,7 @@ object EnumXmlWriter extends AstVisitor with LineUtils { override def default(s: XmlWriterState) = Nil - override def defEnumAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): List[Line] = { + override def defEnumAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val node = aNode._2 val data = node.data val enumType @ Type.Enum(_, _, _) = s.a.typeMap(node.id) diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/StructXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/StructXmlWriter.scala index 2b3a97898..bd7135e53 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/StructXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/StructXmlWriter.scala @@ -9,7 +9,7 @@ object StructXmlWriter extends AstVisitor with LineUtils { override def default(s: XmlWriterState) = Nil - override def defStructAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): List[Line] = { + override def defStructAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val node = aNode._2 val data = node.data val tags = { diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/TypeXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/TypeXmlWriter.scala index 3aebb7e82..77b706f0d 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/TypeXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/TypeXmlWriter.scala @@ -8,17 +8,17 @@ object TypeXmlWriter { private object NameVisitor extends TypeVisitor { - override def absType(s: XmlWriterState, t: Type.AbsType): String = + override def absType(s: XmlWriterState, t: Type.AbsType) = s.writeSymbol(Symbol.AbsType(t.node)) - override def array(s: XmlWriterState, t: Type.Array): String = + override def array(s: XmlWriterState, t: Type.Array) = s.writeSymbol(Symbol.Array(t.node)) override def boolean(s: XmlWriterState) = "bool" - override def default(s: XmlWriterState, t: Type): Out = throw new InternalError("visitor not defined") + override def default(s: XmlWriterState, t: Type) = throw new InternalError("visitor not defined") - override def enumeration(s: XmlWriterState, t: Type.Enum): String = + override def enumeration(s: XmlWriterState, t: Type.Enum) = s.writeSymbol(Symbol.Enum(t.node)) override def float(s: XmlWriterState, t: Type.Float) = t.toString @@ -27,7 +27,7 @@ object TypeXmlWriter { override def string(s: XmlWriterState, t: Type.String) = "string" - override def struct(s: XmlWriterState, t: Type.Struct): String = + override def struct(s: XmlWriterState, t: Type.Struct) = s.writeSymbol(Symbol.Struct(t.node)) type In = XmlWriterState diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/ValueXmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/ValueXmlWriter.scala index 87bed7af0..82dcb165f 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/ValueXmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/ValueXmlWriter.scala @@ -13,7 +13,7 @@ object ValueXmlWriter { type Out = String - override def absType(s: XmlWriterState, v: Value.AbsType): String = { + override def absType(s: XmlWriterState, v: Value.AbsType) = { val aNode = v.t.node val cppName = s.writeSymbol(Symbol.AbsType(aNode)) s.builtInTypes.get(cppName) match { @@ -22,7 +22,7 @@ object ValueXmlWriter { } } - override def array(s: XmlWriterState, v: Value.Array): String = { + override def array(s: XmlWriterState, v: Value.Array) = { val elements = v.anonArray.elements.map(getValue(s, _)) val stringify = elements.mkString(", ") TypeXmlWriter.getName(s, v.getType) ++ "(" ++ stringify ++ ")" @@ -30,13 +30,13 @@ object ValueXmlWriter { override def boolean(s: XmlWriterState, v: Value.Boolean) = v.value.toString - override def default(s: XmlWriterState, v: Value): Out = + override def default(s: XmlWriterState, v: Value) = throw new InternalError("visitor not defined") - override def enumConstant(s: XmlWriterState, v: Value.EnumConstant): String = + override def enumConstant(s: XmlWriterState, v: Value.EnumConstant) = TypeXmlWriter.getName(s, v.getType) ++ "::" ++ v.value._1.toString - override def float(s: XmlWriterState, v: Value.Float): String = { + override def float(s: XmlWriterState, v: Value.Float) = { val s = v.value.toString v.kind match { case Type.Float.F32 => s"${s}f" @@ -44,17 +44,17 @@ object ValueXmlWriter { } } - override def integer(s: XmlWriterState, v: Value.Integer): String = v.value.toString + override def integer(s: XmlWriterState, v: Value.Integer) = v.value.toString override def primitiveInt(s: XmlWriterState, v: Value.PrimitiveInt) = v.value.toString - override def string(s: XmlWriterState, v: Value.String): String = + override def string(s: XmlWriterState, v: Value.String) = "\"" ++ v.value.toString.replaceAll("\\\\", "\\\\\\\\"). replaceAll("\"", "\\\\\"").replaceAll("\n", "\\\\n") ++ "\"" - override def struct(s: XmlWriterState, v: Value.Struct): String = { + override def struct(s: XmlWriterState, v: Value.Struct) = { val structType = v.getType val data = structType.node._2.data val namesList = data.members diff --git a/compiler/lib/src/main/scala/codegen/XmlWriter/XmlWriter.scala b/compiler/lib/src/main/scala/codegen/XmlWriter/XmlWriter.scala index 7c887cef0..935820612 100644 --- a/compiler/lib/src/main/scala/codegen/XmlWriter/XmlWriter.scala +++ b/compiler/lib/src/main/scala/codegen/XmlWriter/XmlWriter.scala @@ -9,7 +9,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { type State = XmlWriterState - override def defArrayAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Either[Error,XmlWriterState] = { + override def defArrayAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = { val (_, node, _) = aNode val data = node.data val name = s.getName(Symbol.Array(aNode)) @@ -18,7 +18,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { writeXmlFile(s, fileName, lines) } - override def defComponentAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefComponent]]): Either[Error,State] = { + override def defComponentAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefComponent]]) = { val (_, node, _) = aNode val data = node.data val name = s.getName(Symbol.Component(aNode)) @@ -31,7 +31,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { yield s } - override def defEnumAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,XmlWriterState] = { + override def defEnumAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = { val (_, node, _) = aNode val data = node.data val name = s.getName(Symbol.Enum(aNode)) @@ -49,7 +49,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { visitList(s, data.members, matchModuleMember) } - override def defPortAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefPort]]): Either[Error,XmlWriterState] = { + override def defPortAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefPort]]) = { val (_, node, _) = aNode val data = node.data val name = s.getName(Symbol.Port(aNode)) @@ -58,7 +58,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { writeXmlFile(s, fileName, lines) } - override def defStructAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[Error,State] = { + override def defStructAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = { val (_, node, _) = aNode val loc = Locations.get(node.id) val data = node.data @@ -71,7 +71,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { } yield s } - override def defTopologyAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefTopology]]): Either[Error,XmlWriterState] = { + override def defTopologyAnnotatedNode(s: XmlWriterState, aNode: Ast.Annotated[AstNode[Ast.DefTopology]]) = { val (_, node, _) = aNode val data = node.data val name = s.getName(Symbol.Topology(aNode)) @@ -80,7 +80,7 @@ object XmlWriter extends AstStateVisitor with LineUtils { writeXmlFile(s, fileName, lines) } - override def transUnit(s: XmlWriterState, tu: Ast.TransUnit): Result = + override def transUnit(s: XmlWriterState, tu: Ast.TransUnit) = visitList(s, tu.members, matchTuMember) private def writeXmlHeader(fileName: String) = lines(