diff options
author | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-19 22:12:36 -0700 |
---|---|---|
committer | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-19 22:12:36 -0700 |
commit | 487c6e48d305d57994b801440d4b62f1a4bfdd06 (patch) | |
tree | b9fbca7af347050072d6505f44a9ae3ccdf7d3a1 /Source/Dafny/Rewriter.cs | |
parent | e5f9a4cbf74f7794ad13b2a5bd831fd54c20629c (diff) |
Factor out some AST visiting code
Diffstat (limited to 'Source/Dafny/Rewriter.cs')
-rw-r--r-- | Source/Dafny/Rewriter.cs | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/Source/Dafny/Rewriter.cs b/Source/Dafny/Rewriter.cs index 83f49a12..230d9349 100644 --- a/Source/Dafny/Rewriter.cs +++ b/Source/Dafny/Rewriter.cs @@ -47,21 +47,7 @@ namespace Microsoft.Dafny var finder = new Triggers.QuantifierCollector(reporter);
foreach (var decl in ModuleDefinition.AllCallables(m.TopLevelDecls)) {
- if (decl is Function) {
- var function = (Function)decl;
- finder.Visit(function.Ens, null);
- finder.Visit(function.Req, null);
- if (function.Body != null) {
- finder.Visit(function.Body, null);
- }
- } else if (decl is Method) {
- var method = (Method)decl;
- finder.Visit(method.Ens, null);
- finder.Visit(method.Req, null);
- if (method.Body != null) {
- finder.Visit(method.Body, null);
- }
- }
+ finder.Visit(decl, null);
}
var triggersCollector = new Triggers.TriggersCollector();
@@ -80,21 +66,7 @@ namespace Microsoft.Dafny internal override void PostResolve(ModuleDefinition m) {
var splitter = new Triggers.QuantifierSplitter();
foreach (var decl in ModuleDefinition.AllCallables(m.TopLevelDecls)) {
- if (decl is Function) {
- var function = (Function)decl;
- splitter.Visit(function.Ens);
- splitter.Visit(function.Req);
- if (function.Body != null) {
- splitter.Visit(function.Body);
- }
- } else if (decl is Method) {
- var method = (Method)decl;
- splitter.Visit(method.Ens);
- splitter.Visit(method.Req);
- if (method.Body != null) {
- splitter.Visit(method.Body);
- }
- }
+ splitter.Visit(decl);
}
}
}
|