forked from accordproject/ergo
-
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.
feature(setState) New 'set state.Name = Expr; Stmt' support accordpro…
…ject#143 Signed-off-by: Jerome Simeon <[email protected]>
- Loading branch information
1 parent
bf43a97
commit fe38933
Showing
15 changed files
with
3,584 additions
and
3,439 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
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,37 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace org.accordproject.helloworldstate | ||
|
||
contract HelloWorldState over TemplateModel state State { | ||
// Simple Clause | ||
clause helloworldstate(request : MyRequest) : MyResponse { | ||
set state State{ | ||
counter: state.counter + 1.0, | ||
lastInput: request.input | ||
}; | ||
return MyResponse{ | ||
output: "Hello " ++ contract.name ++ | ||
" (" ++ request.input ++ ")" ++ " (" ++ toString(state.counter) ++ ")" | ||
} | ||
} | ||
|
||
clause init() : Unit { | ||
set state State{ | ||
counter: 0.0, | ||
lastInput: "" | ||
}; | ||
return | ||
} | ||
} |
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ transaction MyResponse { | |
|
||
concept State { | ||
o Double counter | ||
o String lastInput | ||
} | ||
|
||
/** | ||
|
File renamed without changes.
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,4 @@ | ||
{ | ||
"$class": "org.accordproject.helloworldstate.MyRequest", | ||
"input": "Linux Foundation" | ||
} |
3 changes: 2 additions & 1 deletion
3
examples/helloworldstate/state.json → examples/helloworldstate/state1.json
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"$class": "org.accordproject.helloworldstate.State", | ||
"counter" : 0 | ||
"counter" : 0, | ||
"lastInput" : "" | ||
} |
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 @@ | ||
{ | ||
"$class": "org.accordproject.helloworldstate.State", | ||
"counter" : 1, | ||
"lastInput" : "Accord Project" | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
2,272 changes: 1,134 additions & 1,138 deletions
2,272
packages/ergo-compiler/extracted/compilercore.js
Large diffs are not rendered by default.
Oops, something went wrong.
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