Merge pull request #1995 from nspcc-dev/compiler-verify-notify

compiler: disallow `runtime.Notify` in `Verify` function
This commit is contained in:
Roman Khimov 2021-06-06 11:34:42 +03:00 committed by GitHub
commit efb814a97e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 2 deletions

View file

@ -353,6 +353,12 @@ func isInitFunc(decl *ast.FuncDecl) bool {
decl.Type.Results.NumFields() == 0
}
func (c *codegen) isVerifyFunc(decl *ast.FuncDecl) bool {
return decl.Name.Name == "Verify" && decl.Recv == nil &&
decl.Type.Results.NumFields() == 1 &&
isBool(c.typeOf(decl.Type.Results.List[0].Type))
}
func (c *codegen) clearSlots(n int) {
for i := 0; i < n; i++ {
emit.Opcodes(c.prog.BinWriter, opcode.PUSHNULL)