Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
a3c36705
Commit
a3c36705
authored
14 years ago
by
Ali Sinan Köksal
Browse files
Options
Downloads
Patches
Plain Diff
Revert FunCheck code extraction
parent
37a4180a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/funcheck/CodeExtraction.scala
+0
-37
0 additions, 37 deletions
src/funcheck/CodeExtraction.scala
with
0 additions
and
37 deletions
src/funcheck/CodeExtraction.scala
+
0
−
37
View file @
a3c36705
...
@@ -26,17 +26,6 @@ trait CodeExtraction extends Extractors {
...
@@ -26,17 +26,6 @@ trait CodeExtraction extends Extractors {
private
val
defsToDefs
:
scala.collection.mutable.Map
[
Symbol
,
FunDef
]
=
private
val
defsToDefs
:
scala.collection.mutable.Map
[
Symbol
,
FunDef
]
=
scala
.
collection
.
mutable
.
Map
.
empty
[
Symbol
,
FunDef
]
scala
.
collection
.
mutable
.
Map
.
empty
[
Symbol
,
FunDef
]
private
val
reverseVarSubsts_
:
scala.collection.mutable.Map
[
Expr
,
Symbol
]
=
scala
.
collection
.
mutable
.
Map
.
empty
[
Expr
,
Symbol
]
private
val
reverseClassesToClasses_
:
scala.collection.mutable.Map
[
ClassTypeDef
,
Symbol
]
=
scala
.
collection
.
mutable
.
Map
.
empty
[
ClassTypeDef
,
Symbol
]
def
reverseVarSubsts
:
scala.collection.immutable.Map
[
Expr
,
Symbol
]
=
scala
.
collection
.
immutable
.
Map
()
++
reverseVarSubsts_
def
reverseClassesToClasses
:
scala.collection.immutable.Map
[
ClassTypeDef
,
Symbol
]
=
scala
.
collection
.
immutable
.
Map
()
++
reverseClassesToClasses_
def
extractCode
(
unit
:
CompilationUnit
)
:
Program
=
{
def
extractCode
(
unit
:
CompilationUnit
)
:
Program
=
{
import
scala.collection.mutable.HashMap
import
scala.collection.mutable.HashMap
...
@@ -270,10 +259,6 @@ trait CodeExtraction extends Extractors {
...
@@ -270,10 +259,6 @@ trait CodeExtraction extends Extractors {
stopIfErrors
stopIfErrors
// Reverse map for Scala class symbols
reverseClassesToClasses_
++=
classesToClasses
.
map
{
case
(
a
,
b
)
=>
(
b
,
a
)
}
reverseVarSubsts_
++=
varSubsts
.
map
{
case
(
a
,
b
)
=>
(
b
(),
a
)
}
val
programName
:
Identifier
=
unit
.
body
match
{
val
programName
:
Identifier
=
unit
.
body
match
{
case
PackageDef
(
name
,
_
)
=>
FreshIdentifier
(
name
.
toString
)
case
PackageDef
(
name
,
_
)
=>
FreshIdentifier
(
name
.
toString
)
case
_
=>
FreshIdentifier
(
"<program>"
)
case
_
=>
FreshIdentifier
(
"<program>"
)
...
@@ -283,28 +268,6 @@ trait CodeExtraction extends Extractors {
...
@@ -283,28 +268,6 @@ trait CodeExtraction extends Extractors {
Program
(
programName
,
topLevelObjDef
)
Program
(
programName
,
topLevelObjDef
)
}
}
def
extractPredicate
(
unit
:
CompilationUnit
,
params
:
Seq
[
ValDef
],
body
:
Tree
)
:
FunDef
=
{
def
st2ps
(
tree
:
Type
)
:
purescala.TypeTrees.TypeTree
=
{
try
{
scalaType2PureScala
(
unit
,
true
)(
tree
)
}
catch
{
case
ImpureCodeEncounteredException
(
_
)
=>
stopIfErrors
;
scala
.
Predef
.
error
(
"unreachable error."
)
}
}
val
newParams
=
params
.
map
(
p
=>
{
val
ptpe
=
st2ps
(
p
.
tpt
.
tpe
)
val
newID
=
FreshIdentifier
(
p
.
name
.
toString
).
setType
(
ptpe
)
varSubsts
(
p
.
symbol
)
=
(()
=>
Variable
(
newID
))
VarDecl
(
newID
,
ptpe
)
})
val
fd
=
new
FunDef
(
FreshIdentifier
(
"predicate"
),
BooleanType
,
newParams
)
val
bodyAttempt
=
try
{
Some
(
scala2PureScala
(
unit
,
true
)(
body
))
}
catch
{
case
ImpureCodeEncounteredException
(
_
)
=>
None
}
fd
.
body
=
bodyAttempt
fd
}
/** An exception thrown when non-purescala compatible code is encountered. */
/** An exception thrown when non-purescala compatible code is encountered. */
sealed
case
class
ImpureCodeEncounteredException
(
tree
:
Tree
)
extends
Exception
sealed
case
class
ImpureCodeEncounteredException
(
tree
:
Tree
)
extends
Exception
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment