-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(irBuilder): Support
try
and try-catch
statements
Closes #40
- Loading branch information
1 parent
9385648
commit 94aa43a
Showing
19 changed files
with
305 additions
and
19 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 @@ | ||
digraph "try-1" { | ||
node [shape=box]; | ||
subgraph "cluster_test" { | ||
label="test"; | ||
"test_141" [label="let a: Int = 42"]; | ||
"test_142" [label="try"]; | ||
"test_144" [label="a += 1"]; | ||
"test_146" [label="return 42",style=filled,fillcolor="#66A7DB"]; | ||
"test_141" -> "test_142"; | ||
"test_142" -> "test_144"; | ||
"test_144" -> "test_146"; | ||
} | ||
} |
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,66 @@ | ||
{ | ||
"projectName": "try-1", | ||
"functions": [ | ||
{ | ||
"name": "test", | ||
"cfg": { | ||
"nodes": [ | ||
{ | ||
"id": 141, | ||
"stmtID": 58765, | ||
"srcEdges": [], | ||
"dstEdges": [ | ||
143 | ||
] | ||
}, | ||
{ | ||
"id": 142, | ||
"stmtID": 58769, | ||
"srcEdges": [ | ||
143 | ||
], | ||
"dstEdges": [ | ||
145 | ||
] | ||
}, | ||
{ | ||
"id": 144, | ||
"stmtID": 58768, | ||
"srcEdges": [ | ||
145 | ||
], | ||
"dstEdges": [ | ||
147 | ||
] | ||
}, | ||
{ | ||
"id": 146, | ||
"stmtID": 58771, | ||
"srcEdges": [ | ||
147 | ||
], | ||
"dstEdges": [] | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"id": 143, | ||
"src": 141, | ||
"dst": 142 | ||
}, | ||
{ | ||
"id": 145, | ||
"src": 142, | ||
"dst": 144 | ||
}, | ||
{ | ||
"id": 147, | ||
"src": 144, | ||
"dst": 146 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"contracts": [] | ||
} |
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 @@ | ||
|
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,7 @@ | ||
fun test(): Int { | ||
let a: Int = 42; | ||
try { | ||
a += 1; | ||
} | ||
return 42; | ||
} |
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,9 @@ | ||
digraph "try-2" { | ||
node [shape=box]; | ||
subgraph "cluster_test" { | ||
label="test"; | ||
"test_141" [label="try"]; | ||
"test_142" [label="return 42",style=filled,fillcolor="#66A7DB"]; | ||
"test_141" -> "test_142"; | ||
} | ||
} |
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,36 @@ | ||
{ | ||
"projectName": "try-2", | ||
"functions": [ | ||
{ | ||
"name": "test", | ||
"cfg": { | ||
"nodes": [ | ||
{ | ||
"id": 141, | ||
"stmtID": 61840, | ||
"srcEdges": [], | ||
"dstEdges": [ | ||
143 | ||
] | ||
}, | ||
{ | ||
"id": 142, | ||
"stmtID": 61842, | ||
"srcEdges": [ | ||
143 | ||
], | ||
"dstEdges": [] | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"id": 143, | ||
"src": 141, | ||
"dst": 142 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"contracts": [] | ||
} |
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 @@ | ||
|
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,5 @@ | ||
fun test(): Int { | ||
try { /* empty */ } | ||
return 42; | ||
} | ||
|
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,15 @@ | ||
digraph "try-3" { | ||
node [shape=box]; | ||
subgraph "cluster_test" { | ||
label="test"; | ||
"test_141" [label="let a: Int = 0"]; | ||
"test_142" [label="try ... catch (err)"]; | ||
"test_144" [label="a = 19"]; | ||
"test_146" [label="dump(err)",style=filled,fillcolor="#66A7DB"]; | ||
"test_148" [label="return a",style=filled,fillcolor="#66A7DB"]; | ||
"test_141" -> "test_142"; | ||
"test_142" -> "test_144"; | ||
"test_142" -> "test_146"; | ||
"test_144" -> "test_148"; | ||
} | ||
} |
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,80 @@ | ||
{ | ||
"projectName": "try-3", | ||
"functions": [ | ||
{ | ||
"name": "test", | ||
"cfg": { | ||
"nodes": [ | ||
{ | ||
"id": 141, | ||
"stmtID": 64907, | ||
"srcEdges": [], | ||
"dstEdges": [ | ||
143 | ||
] | ||
}, | ||
{ | ||
"id": 142, | ||
"stmtID": 64916, | ||
"srcEdges": [ | ||
143 | ||
], | ||
"dstEdges": [ | ||
145, | ||
147 | ||
] | ||
}, | ||
{ | ||
"id": 144, | ||
"stmtID": 64910, | ||
"srcEdges": [ | ||
145 | ||
], | ||
"dstEdges": [ | ||
149 | ||
] | ||
}, | ||
{ | ||
"id": 146, | ||
"stmtID": 64915, | ||
"srcEdges": [ | ||
147 | ||
], | ||
"dstEdges": [] | ||
}, | ||
{ | ||
"id": 148, | ||
"stmtID": 64918, | ||
"srcEdges": [ | ||
149 | ||
], | ||
"dstEdges": [] | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"id": 143, | ||
"src": 141, | ||
"dst": 142 | ||
}, | ||
{ | ||
"id": 145, | ||
"src": 142, | ||
"dst": 144 | ||
}, | ||
{ | ||
"id": 147, | ||
"src": 142, | ||
"dst": 146 | ||
}, | ||
{ | ||
"id": 149, | ||
"src": 144, | ||
"dst": 148 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"contracts": [] | ||
} |
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 @@ | ||
|
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 @@ | ||
fun test(): Int { | ||
let a: Int = 0; | ||
try { | ||
a = 19; | ||
} catch (err) { | ||
dump(err); | ||
} | ||
return a; | ||
} | ||
|
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
Oops, something went wrong.