Quellcode durchsuchen

Merge pull request #648 from bmx-ng/task/auto-superstrict

Added auto-superstrict, and option to disable it.
Brucey vor 1 Jahr
Ursprung
Commit
663dfcfadf
2 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen
  1. 4 0
      options.bmx
  2. 9 2
      parser.bmx

+ 4 - 0
options.bmx

@@ -134,6 +134,8 @@ Global opt_filepath:String
 
 
 Global opt_coverage:Int = False
 Global opt_coverage:Int = False
 
 
+Global opt_no_auto_superstrict:Int = False
+
 Function CmdError(details:String = Null, fullUsage:Int = False)
 Function CmdError(details:String = Null, fullUsage:Int = False)
 	Local s:String = "Compile Error"
 	Local s:String = "Compile Error"
 	If details Then
 	If details Then
@@ -248,6 +250,8 @@ Function ParseArgs:String[](args:String[])
 				opt_legacy_incbin=True
 				opt_legacy_incbin=True
 			Case "cov"
 			Case "cov"
 				opt_coverage=True
 				opt_coverage=True
+			Case "nas"
+				opt_no_auto_superstrict=True
 		End Select
 		End Select
 	
 	
 		count:+ 1
 		count:+ 1

+ 9 - 2
parser.bmx

@@ -4285,8 +4285,15 @@ End Rem
 			End Select
 			End Select
 		Wend
 		Wend
 
 
-		If opt_need_strict And Not (_module.attrs & (MODULE_STRICT | MODULE_SUPERSTRICT)) Then
-			Err "Strict or SuperStrict must be declared at the start of the file."
+		' auto enable superstrict mode?
+		If Not (_module.attrs & (MODULE_STRICT | MODULE_SUPERSTRICT)) Then
+			If opt_no_auto_superstrict Then
+				If opt_need_strict And Not (_module.attrs & (MODULE_STRICT | MODULE_SUPERSTRICT)) Then
+					Err "Strict or SuperStrict must be declared at the start of the file."
+				End If
+			Else
+				_module.attrs :| MODULE_SUPERSTRICT
+			End If
 		End If
 		End If
 
 
 		'Parse header - imports etc.
 		'Parse header - imports etc.