Skip to content

Commit

Permalink
Replace [FALSE] asserts with failProcs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatwayBurkow committed Jan 12, 2021
1 parent 408381a commit 30f0570
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Var.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ getVirtualValue: [
]
VarImport [VarImport pointeeVar.data.get @result.cat]
[
[FALSE] "Wrong type for virtual reference!" assert
"Wrong type for virtual reference!" failProc
]
) case
] if
Expand All @@ -342,7 +342,7 @@ getVirtualValue: [
refToVar isPlain [
refToVar getPlainConstantIR @result.cat
] [
[FALSE] "Wrong type for virtual value!" assert
"Wrong type for virtual value!" failProc
] if
]
) case
Expand Down Expand Up @@ -414,7 +414,7 @@ getPlainConstantIR: [
var.data.getTag VarReal32 = [VarReal32 var.data.get.end Real32 cast Real64 cast bitView @result set] [
var.data.getTag VarReal64 = [VarReal64 var.data.get.end bitView @result set] [
("Tag = " makeStringView var.data.getTag Int32 cast) addLog
[FALSE] "Unknown plain struct while getting IR value" assert
"Unknown plain struct while getting IR value" failProc
] if
] if
] if
Expand Down
2 changes: 1 addition & 1 deletion builtinImpl.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ staticityOfBinResult: [
varSchema: refToSchema getVar;
schemaOfResult: RefToVar;
varSchema.data.getTag VarRef = [
[FALSE] "Unable in current semantic!" assert
"Unable in current semantic!" failProc
] [
refToSchema @schemaOfResult set
] if
Expand Down
4 changes: 2 additions & 2 deletions codeNode.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ addNameInfo: [
# do nothing
FALSE @addInfo set
] [
[FALSE] "wrong name info case" assert
"wrong name info case" failProc
] if
] if
] if
Expand Down Expand Up @@ -2445,7 +2445,7 @@ addLambdaEvent: [
implNode.varNameInfo 0 < ~ [
gnr: implNode.varNameInfo @processor @block getNameEverywhere;
processor compilable ~ [
[FALSE] "Name of new lambda is not visible!" assert
"Name of new lambda is not visible!" failProc
] [
cnr: @gnr 0 dynamic @processor @block processor.positions.last.file captureName;
cnr.refToVar @result.@refToVar set
Expand Down
6 changes: 3 additions & 3 deletions debugWriter.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ getPlainTypeDebugDeclaration: [
var.data.getTag VarReal32 = [processor.debugInfo.unit 13 +] [
var.data.getTag VarReal64 = [processor.debugInfo.unit 14 +] [
var.data.getTag VarString = [processor.debugInfo.unit 15 +] [
[FALSE] "Unknown plain struct while getting debug declaration index" assert
"Unknown plain struct while getting debug declaration index" failProc
-1
] if
] if
Expand Down Expand Up @@ -169,7 +169,7 @@ getTypeDebugDeclaration: [
compileOnce
var: refToVar getVar;
refToVar isVirtualType [
[FALSE] "virtual type has not debug declaration" assert
"virtual type has not debug declaration" failProc
-1
] [
refToVar isPlain [var.data.getTag VarString =] || [
Expand Down Expand Up @@ -223,7 +223,7 @@ getTypeDebugDeclaration: [
")") assembleString addDebugString
index
] [
[FALSE] "Unknown type in getTypeDebugDeclaration!" assert
"Unknown type in getTypeDebugDeclaration!" failProc
-1
] if
] if
Expand Down
4 changes: 2 additions & 2 deletions irWriter.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ getStaticStructIR: [
@unfinishedVars.popBack

current isVirtual [
[FALSE] "Virtual field cannot be processed in static array constant!" assert
"Virtual field cannot be processed in static array constant!" failProc
] [
current isPlain [
(current @processor getIrType " " current getPlainConstantIR) @result.catMany
Expand Down Expand Up @@ -68,7 +68,7 @@ getStaticStructIR: [
] when
] times
] [
[FALSE] "Unknown type in static struct!" assert
"Unknown type in static struct!" failProc
] if
] if
] if
Expand Down
4 changes: 2 additions & 2 deletions parser.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ parseNode: [
pc: makeParserConstants;

unfinishedPositions: PositionInfo Array;
unfinishedLabelNames: String Array;
unfinishedNodes: AstNodeArray Array;
unfinishedLabelNames: String Array dynamic;
unfinishedNodes: AstNodeArray Array dynamic;
unfinishedTerminators: Nat32 Array;

fileId @currentPosition.@fileId set
Expand Down
4 changes: 2 additions & 2 deletions processSubNodes.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ fixOutputRefsRec: [
currentFromStack @stackEntryVar.@sourceOfValue set
] if
] [
[FALSE] "Source of value is unknown!" assert
"Source of value is unknown!" failProc
] if

[currentFromStack hasGoodSource] "Stack var source invariant failed!" assert
Expand Down Expand Up @@ -1471,7 +1471,7 @@ useMatchingInfoOnly: [
oldSuccess [
[email protected] ~ [-1 @processor.@result clearProcessorResult] when
] [
[FALSE] "Has compilerError before trying compiling pre!" assert
"Has compilerError before trying compiling pre!" failProc
] if

newNode.uncompilable ~ [
Expand Down
2 changes: 1 addition & 1 deletion schemas.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ VariableSchema: [{
] times

[
[FALSE] "invalid tag in VariableSchema" assert
"invalid tag in VariableSchema" failProc
FALSE
]
) case
Expand Down
12 changes: 6 additions & 6 deletions variable.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ getPlainDataIRType: [
VarReal64 ["double" toString @result set]
[
("Tag = " var.data.getTag) addLog
[FALSE] "Unknown plain struct while getting IR type" assert
"Unknown plain struct while getting IR type" failProc
]
) case

Expand All @@ -152,7 +152,7 @@ getPlainDataMPLType: [
VarReal64 ["r64" toString @result set]
[
("Tag = " var.data.getTag) addLog
[FALSE] "Unknown plain struct MPL type" assert
"Unknown plain struct MPL type" failProc
]
) case

Expand Down Expand Up @@ -541,7 +541,7 @@ makeDbgTypeId: [
"}" @resultDBG.cat
] when
]
[[FALSE] "Unknown variable for IR type" assert]
["Unknown variable for IR type" failProc]
) cond

@resultDBG @processor makeStringId
Expand Down Expand Up @@ -591,7 +591,7 @@ makeDbgTypeId: [
] if
] when
]
[[FALSE] "Unknown variable for IR type" assert]
["Unknown variable for IR type" failProc]
) cond

irTypeId: Int32;
Expand Down Expand Up @@ -650,7 +650,7 @@ makeDbgTypeId: [
] loop
"}" @resultMPL.cat
] [
[FALSE] "Unknown variable for IR type" assert
"Unknown variable for IR type" failProc
] if
] if
] if
Expand Down Expand Up @@ -714,7 +714,7 @@ zeroValue: [
tag VarReal32 = [0.0r64] [
tag VarReal64 = [0.0r64] [
("Tag = " makeStringView .getTag 0 cast) addLog
[FALSE] "Unknown plain struct while getting Zero value" assert
"Unknown plain struct while getting Zero value" failProc
] if
] if
] if
Expand Down

0 comments on commit 30f0570

Please sign in to comment.