File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Src/PCompiler/CompilerCore/Backend/Java Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,9 @@ private void WriteMonitorDecl()
117
117
{
118
118
WriteFunction ( f ) ;
119
119
}
120
+
121
+ WriteToString ( ) ;
122
+
120
123
WriteLine ( ) ;
121
124
122
125
WriteLine ( $ "}} // { cname } monitor definition") ;
@@ -964,5 +967,21 @@ private void WriteStructureAccess(IPExpr e)
964
967
}
965
968
}
966
969
970
+ private void WriteToString ( )
971
+ {
972
+ WriteLine ( "public String toString() {" ) ;
973
+ WriteLine ( $ "StringBuilder sb = new StringBuilder(\" { _currentMachine . Name } \" );") ;
974
+
975
+ WriteLine ( "sb.append(\" [\" );" ) ;
976
+ foreach ( var ( sep , field ) in _currentMachine . Fields . WithPrefixSep ( ", " ) )
977
+ {
978
+ WriteLine ( $ "sb.append(\" { sep } { field . Name } =\" + { Names . GetNameForDecl ( field ) } );") ;
979
+ }
980
+ WriteLine ( "sb.append(\" ]\" );" ) ;
981
+
982
+ WriteLine ( "return sb.toString();" ) ;
983
+ WriteLine ( "} // toString()" ) ;
984
+ }
985
+
967
986
}
968
987
}
You can’t perform that action at this time.
0 commit comments