Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Julien Lopez
qir
Commits
83e14a0f
Commit
83e14a0f
authored
8 years ago
by
Julien Lopez
Browse files
Options
Downloads
Patches
Plain Diff
Fixes in QIR evaluation
parent
e5f8c299
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/qir/visitor/QIREvaluationVisitor.java
+4
-4
4 additions, 4 deletions
src/qir/visitor/QIREvaluationVisitor.java
with
4 additions
and
4 deletions
src/qir/visitor/QIREvaluationVisitor.java
+
4
−
4
View file @
83e14a0f
...
@@ -29,7 +29,7 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
...
@@ -29,7 +29,7 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
if
(!(
input
instanceof
QIRLcons
))
if
(!(
input
instanceof
QIRLcons
))
throw
new
QIRException
(
"Typing error: project expected list as input, got: "
+
input
.
getClass
().
getName
()
+
"."
);
throw
new
QIRException
(
"Typing error: project expected list as input, got: "
+
input
.
getClass
().
getName
()
+
"."
);
for
(
QIRNode
e
=
input
;
e
instanceof
QIRLcons
;
e
=
((
QIRLcons
)
e
).
getTail
())
for
(
QIRNode
e
=
input
;
e
instanceof
QIRLcons
;
e
=
((
QIRLcons
)
e
).
getTail
())
tmp
.
push
(
new
QIRApply
(
null
,
formatter
,
e
).
accept
(
this
));
tmp
.
push
(
new
QIRApply
(
null
,
formatter
,
((
QIRLcons
)
e
).
getValue
()
).
accept
(
this
));
while
(!
tmp
.
isEmpty
())
while
(!
tmp
.
isEmpty
())
result
=
new
QIRLcons
(
null
,
tmp
.
pop
(),
result
);
result
=
new
QIRLcons
(
null
,
tmp
.
pop
(),
result
);
return
result
;
return
result
;
...
@@ -114,9 +114,9 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
...
@@ -114,9 +114,9 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
return
fun
.
getBody
();
return
fun
.
getBody
();
final
String
varName
=
var
.
getId
();
final
String
varName
=
var
.
getId
();
env
.
put
(
varName
,
right
);
env
.
put
(
varName
,
right
);
final
QIR
Lambda
res
=
(
QIRLambda
)
fun
.
accept
(
this
);
final
QIR
Node
res
=
fun
.
getBody
()
.
accept
(
this
);
env
.
remove
(
varName
);
env
.
remove
(
varName
);
return
res
.
getBody
()
;
return
res
;
}
}
if
(
left
instanceof
QIRTruffleNode
)
if
(
left
instanceof
QIRTruffleNode
)
throw
new
QIRException
(
"Evaluation of Truffle application not implemented yet."
);
throw
new
QIRException
(
"Evaluation of Truffle application not implemented yet."
);
...
@@ -326,7 +326,7 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
...
@@ -326,7 +326,7 @@ public final class QIREvaluationVisitor implements IQIRVisitor<QIRNode> {
final
String
colName
=
qirTdestr
.
getColName
();
final
String
colName
=
qirTdestr
.
getColName
();
for
(
QIRNode
current
=
tuple
;
current
instanceof
QIRTcons
;
current
=
((
QIRTcons
)
current
).
getTail
())
for
(
QIRNode
current
=
tuple
;
current
instanceof
QIRTcons
;
current
=
((
QIRTcons
)
current
).
getTail
())
if
(
colName
==
((
QIRTcons
)
current
).
getId
())
if
(
colName
.
equals
(
((
QIRTcons
)
current
).
getId
())
)
return
((
QIRTcons
)
current
).
getValue
();
return
((
QIRTcons
)
current
).
getValue
();
throw
new
QIRException
(
"Typing error: destructor of tuple could not find "
+
colName
+
" in tuple "
+
tuple
+
"."
);
throw
new
QIRException
(
"Typing error: destructor of tuple could not find "
+
colName
+
" in tuple "
+
tuple
+
"."
);
}
}
...
...
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