forked from utwente-fmt/vercors
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: delay freezing scopes until we know what kind
- Loading branch information
1 parent
523623e
commit 65b0c6e
Showing
16 changed files
with
119 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package vct.col.rewrite | ||
|
||
import vct.col.ast.Declaration | ||
|
||
class SuccessorProviderChain[A, B, C, AD <: Declaration[A], BD <: Declaration[ | ||
B | ||
], CD <: Declaration[C]]( | ||
left: SuccessorProvider[A, B, AD, BD], | ||
right: SuccessorProvider[B, C, BD, CD], | ||
) extends SuccessorProvider[A, C, AD, CD] { | ||
override def computeSucc(decl: AD): Option[CD] = | ||
left.computeSucc(decl).flatMap(right.computeSucc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package vct.col.rewrite | ||
|
||
import vct.col.ast.Declaration | ||
|
||
class SuccessorProviderNothing[Pre, Post, PreDecl <: Declaration[ | ||
Pre | ||
], PostDecl <: Declaration[Post]](crash: => Nothing) | ||
extends SuccessorProvider[Pre, Post, PreDecl, PostDecl] { | ||
override def computeSucc(decl: PreDecl): Nothing = crash | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package vct.col.rewrite | ||
|
||
import vct.col.ast.Declaration | ||
|
||
class SuccessorProviderTrafo[Pre, Post, PreDecl <: Declaration[ | ||
Pre | ||
], PostDecl <: Declaration[Post]]( | ||
inner: SuccessorProvider[Pre, Post, PreDecl, PostDecl] | ||
) extends SuccessorProvider[Pre, Post, PreDecl, PostDecl] { | ||
def preTransform[I <: PreDecl, O <: PostDecl](pre: I): Option[O] = None | ||
def postTransform[T <: PostDecl](pre: PreDecl, post: Option[T]): Option[T] = | ||
post | ||
|
||
override def computeSucc(decl: PreDecl): Option[PostDecl] = | ||
preTransform(decl).orElse(postTransform(decl, inner.computeSucc(decl))) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package vct.col.util | ||
|
||
import vct.col.ast.{ | ||
Declaration, | ||
SuccessorsProviderNothing, | ||
SuccessorsProviderTrafo, | ||
} | ||
import vct.result.VerificationError.Unreachable | ||
|
||
class IdentitySuccessorsProvider[G] | ||
extends SuccessorsProviderTrafo[G, G](new SuccessorsProviderNothing( | ||
throw Unreachable("Always preTransformed") | ||
)) { | ||
override def preTransform[I <: Declaration[G], O <: Declaration[G]]( | ||
pre: I | ||
): Option[O] = Some(pre.asInstanceOf[O]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters