Skip to content

Commit

Permalink
voyage server blocks need to be able to customize the server-side met…
Browse files Browse the repository at this point in the history
…hod for evaluating block with variable bindings ... make it so
  • Loading branch information
dalehenrich committed Jul 27, 2016
1 parent 40cfa6f commit 391880e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 37 deletions.
@@ -1,37 +1,6 @@
server blocks
onServerDo: aBlock serializeBlock: serializeBlock
| serverSource variableBindings stonString blockAst blockScopes blockScope outerContext blockContext |
aBlock numArgs > 0
ifTrue: [ self error: 'only zeroArg blocks may be executed on the server' ].
outerContext := aBlock outerContext.
outerContext hasInstVarRef
ifTrue: [ self error: 'cannot reference instance variables in server block' ].
blockContext := aBlock asContext.
blockAst := aBlock sourceNode.
blockScopes := (OCScopesCollector new visitNode: blockAst) scopes.
blockScope := blockScopes at: 1.
variableBindings := Dictionary new.
blockScope copiedVars
do: [ :tempVar |
| val tempName index |
tempVar isStoringTempVector
ifTrue: [ tempVar tempVectorForTempStoringIt
do: [ :tempVectorVars |
tempName := tempVectorVars name.
index := aBlock asContext tempNames indexOf: tempName.
index > 0
ifTrue: [ val := aBlock asContext namedTempAt: index.
variableBindings at: tempName put: (serializeBlock value: val) ] ] ]
ifFalse: [ tempName := tempVar name.
index := outerContext tempNames indexOf: tempName.
index > 0
ifTrue: [ val := outerContext namedTempAt: index.
variableBindings at: tempName put: (serializeBlock value: val) ] ] ].
serverSource := aBlock sourceNode body formattedCode.
stonString := self session
send: #evaluateSTONSmalltalk:variableBindings:
to: todeServerOopType
withArgs:
{serverSource.
(self objectSerializer toString: variableBindings)}.
^ self objectSerializer fromString: stonString
^ self
onServerDo: aBlock
serializeBlock: serializeBlock
serverSelector: #evaluateSTONSmalltalk:variableBindings:
@@ -0,0 +1,37 @@
server blocks
onServerDo: aBlock serializeBlock: serializeBlock serverSelector: serverSelector
| serverSource variableBindings stonString blockAst blockScopes blockScope outerContext blockContext |
aBlock numArgs > 0
ifTrue: [ self error: 'only zeroArg blocks may be executed on the server' ].
outerContext := aBlock outerContext.
outerContext hasInstVarRef
ifTrue: [ self error: 'cannot reference instance variables in server block' ].
blockContext := aBlock asContext.
blockAst := aBlock sourceNode.
blockScopes := (OCScopesCollector new visitNode: blockAst) scopes.
blockScope := blockScopes at: 1.
variableBindings := Dictionary new.
blockScope copiedVars
do: [ :tempVar |
| val tempName index |
tempVar isStoringTempVector
ifTrue: [ tempVar tempVectorForTempStoringIt
do: [ :tempVectorVars |
tempName := tempVectorVars name.
index := aBlock asContext tempNames indexOf: tempName.
index > 0
ifTrue: [ val := aBlock asContext namedTempAt: index.
variableBindings at: tempName put: (serializeBlock value: val) ] ] ]
ifFalse: [ tempName := tempVar name.
index := outerContext tempNames indexOf: tempName.
index > 0
ifTrue: [ val := outerContext namedTempAt: index.
variableBindings at: tempName put: (serializeBlock value: val) ] ] ].
serverSource := aBlock sourceNode body formattedCode.
stonString := self session
send: serverSelector
to: todeServerOopType
withArgs:
{serverSource.
(self objectSerializer toString: variableBindings)}.
^ self objectSerializer fromString: stonString
Expand Up @@ -27,7 +27,8 @@
"objectSerializer" : "dkh 4/16/2016 19:26",
"objectSerializer:" : "dkh 4/16/2016 19:39",
"onServerDo:" : "dkh 7/26/2016 16:15",
"onServerDo:serializeBlock:" : "dkh 7/26/2016 16:17",
"onServerDo:serializeBlock:" : "dkh 7/26/2016 17:54",
"onServerDo:serializeBlock:serverSelector:" : "dkh 7/26/2016 17:54",
"registerDefaultServices" : "TravisCI 7/22/2016 15:38",
"registerService:for:" : "dkh 4/19/2016 11:20",
"serverApiVersion:" : "dkh 4/16/2016 19:40",
Expand Down
@@ -1 +1 @@
(name 'Tode-Minimal-Client-Core-dkh.25' message 'TDMinimalClient>>onServerDo:serializeBlock: needed to properly transform server block arguments' id '60dd79bc-cff7-4f9d-898c-1939419fc34e' date '26 July 2016' time '4:32:27.075555 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.24' message '#tempVectorForTempStoringIt logic _is_ needed for serverBlocks...' id '35a98450-3423-410f-bedf-18b99f6c6ad4' date '26 July 2016' time '1:40:15.115965 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-TravisCI.23' message 'start work in TDMinimalClient>>onServerDo: ... might be interested in expanding it for handling references to Voyage instances ... or simply using as is ... adding tests as well' id 'd03ddd03-802e-45a7-8d8d-540734f54e1b' date '22 July 2016' time '5:00:40.489453 pm' author 'TravisCI' ancestors ((name 'Tode-Minimal-Client-Core-dkh.22' message '#253 arrange for actual errors to be thrown with a defaultAction to open tode debugger if not handled when interactive is false ... For server applications we don''t want to have the user prompted about whether or not a debugger should pop up...' id '088cdcb8-3bc0-4c73-9bec-b56c0cbb005c' date '5 May 2016' time '4:25:03.950242 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.21' message '#253 fix up behavior when debugger opened ..' id 'f81be88b-d832-4981-a808-78327374fa77' date '30 April 2016' time '8:02:21.419927 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.20' message '#253 tweak logic using effectiveApiVersion' id '657dd889-c069-4859-8765-2714b314289e' date '29 April 2016' time '8:11:44.836743 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.19' message '#253 update clientApiVersion comment' id '28b8048b-642a-4fb2-8218-be003b0c5a06' date '29 April 2016' time '8:04:25.10926 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.18' message '#253 communicate effectiveApi version to server during login' id 'fc779657-47c6-41ea-9de4-c2f9742cc867' date '29 April 2016' time '7:51:08.108213 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.17' message '#253 bump clientVersion to 1.3.0 indicating support for #closeWith: callback' id '9679a191-dddb-4527-adb7-1d442ba875ce' date '29 April 2016' time '7:29:52.09735 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.16' message '#253 bump clientVersion to 1.3.0 indicating support for #closeWith: callback' id '284fcb0a-63ed-448a-ba36-e0bf7eab4b5f' date '29 April 2016' time '7:28:00.417351 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.15' message '#253 bump clientVersion to 1.2.2 indicating support for #closeWith: callback' id '7bace0fc-9015-43d6-ab18-e1f2aa8355a3' date '29 April 2016' time '7:24:00.978572 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.14' message '#253 resume from within debugger will return control to original client process at point that debugger was opened with appropriate result from server ...' id '46212a20-6a71-453a-a56d-17edfb68d2cd' date '29 April 2016' time '6:38:33.871247 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.13' message '#253 step over is functional, but the gui update is not ..' id '49fcebd9-0b30-4124-86c9-dac9d617a72b' date '28 April 2016' time '12:52:24.85588 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.12' message '#253 working on getting the step menu item to work' id '134b6b3e-41a7-4ebb-8853-800406556c69' date '27 April 2016' time '5:43:33.699018 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.11' message '#253 create testClientListElementMenus to illustrate menu handling ... add #asOopType: for backward compatibility with old GCI api' id '9f2f57a4-ec49-47fb-a084-5e27c44a0d40' date '20 April 2016' time '8:36:01.938484 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.10' message '#253 add interactive attribute to minimal client default value answers whether or not the vm is headless, but it can be switched for testing ... modify tests to use interactive ... logStack, halt, and proceed tested now ...' id '512ddbc0-4fe5-47a6-a270-dd9dd18dbcf6' date '19 April 2016' time '8:54:40.76107 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.9' message '#253 gearing up for testing the code paths used for debugging ... more test coverage needed for #logStack and address failing test' id '2902180b-7c2d-4770-9ed5-25b81640375a' date '19 April 2016' time '5:19:21.999055 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.8' message '#253 defer some of the call back tests for later ' id 'be8f8e9a-8e1c-43f6-bcd3-a94b279d7161' date '19 April 2016' time '3:02:23.760295 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.7' message 'implement GsInteraction tests' id '137c6d90-c6ee-421c-8deb-1f6fbe42cb98' date '19 April 2016' time '2:49:10.986355 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.6' message '#253 implement services registry (for server callbacks) in minimal client' id 'e0c3c402-a9c1-4d7b-894e-baf1f655ada8' date '19 April 2016' time '11:33:35.066967 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.5' message '#253 tode command line execution is functional' id '22b068ae-b4b9-4cdd-928f-983733b3d00f' date '19 April 2016' time '10:16:53.881356 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.4' message '#253 implementing TDMinimalClient>>evaluate: which takes a tODE command and executes it ...' id '465a0c1c-f91f-49ee-88cf-da95c3eadf1f' date '19 April 2016' time '6:57:42.543698 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.3' message 'minimal tode client login functional!' id '72ddd092-155e-4988-b8c5-4879fed2b963' date '19 April 2016' time '6:00:35.970673 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.2' message '#253 TDMinimalClient>>loginWith: is working up until the clientForwarder send ... which is pretty good' id 'fb43446c-66d5-4e33-8f32-2fe1f61294b7' date '16 April 2016' time '8:14:01.400538 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.1' message '#253 start work on minimal client implementation ... dependent upong GsDevKit/GsDevKit_home#103 as well' id '04a9011f-075f-4a0c-9874-a9e2cf894f58' date '16 April 2016' time '11:40:28.303675 am' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Tode-Minimal-Client-Core-dkh.26' message 'voyage server blocks need to be able to customize the server-side method for evaluating block with variable bindings ... make it so' id '54ddcdbb-e49c-4c22-b147-2526764e0dad' date '26 July 2016' time '5:58:46.622119 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.25' message 'TDMinimalClient>>onServerDo:serializeBlock: needed to properly transform server block arguments' id '60dd79bc-cff7-4f9d-898c-1939419fc34e' date '26 July 2016' time '4:32:27.075555 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.24' message '#tempVectorForTempStoringIt logic _is_ needed for serverBlocks...' id '35a98450-3423-410f-bedf-18b99f6c6ad4' date '26 July 2016' time '1:40:15.115965 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-TravisCI.23' message 'start work in TDMinimalClient>>onServerDo: ... might be interested in expanding it for handling references to Voyage instances ... or simply using as is ... adding tests as well' id 'd03ddd03-802e-45a7-8d8d-540734f54e1b' date '22 July 2016' time '5:00:40.489453 pm' author 'TravisCI' ancestors ((name 'Tode-Minimal-Client-Core-dkh.22' message '#253 arrange for actual errors to be thrown with a defaultAction to open tode debugger if not handled when interactive is false ... For server applications we don''t want to have the user prompted about whether or not a debugger should pop up...' id '088cdcb8-3bc0-4c73-9bec-b56c0cbb005c' date '5 May 2016' time '4:25:03.950242 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.21' message '#253 fix up behavior when debugger opened ..' id 'f81be88b-d832-4981-a808-78327374fa77' date '30 April 2016' time '8:02:21.419927 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.20' message '#253 tweak logic using effectiveApiVersion' id '657dd889-c069-4859-8765-2714b314289e' date '29 April 2016' time '8:11:44.836743 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.19' message '#253 update clientApiVersion comment' id '28b8048b-642a-4fb2-8218-be003b0c5a06' date '29 April 2016' time '8:04:25.10926 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.18' message '#253 communicate effectiveApi version to server during login' id 'fc779657-47c6-41ea-9de4-c2f9742cc867' date '29 April 2016' time '7:51:08.108213 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.17' message '#253 bump clientVersion to 1.3.0 indicating support for #closeWith: callback' id '9679a191-dddb-4527-adb7-1d442ba875ce' date '29 April 2016' time '7:29:52.09735 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.16' message '#253 bump clientVersion to 1.3.0 indicating support for #closeWith: callback' id '284fcb0a-63ed-448a-ba36-e0bf7eab4b5f' date '29 April 2016' time '7:28:00.417351 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.15' message '#253 bump clientVersion to 1.2.2 indicating support for #closeWith: callback' id '7bace0fc-9015-43d6-ab18-e1f2aa8355a3' date '29 April 2016' time '7:24:00.978572 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.14' message '#253 resume from within debugger will return control to original client process at point that debugger was opened with appropriate result from server ...' id '46212a20-6a71-453a-a56d-17edfb68d2cd' date '29 April 2016' time '6:38:33.871247 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.13' message '#253 step over is functional, but the gui update is not ..' id '49fcebd9-0b30-4124-86c9-dac9d617a72b' date '28 April 2016' time '12:52:24.85588 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.12' message '#253 working on getting the step menu item to work' id '134b6b3e-41a7-4ebb-8853-800406556c69' date '27 April 2016' time '5:43:33.699018 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.11' message '#253 create testClientListElementMenus to illustrate menu handling ... add #asOopType: for backward compatibility with old GCI api' id '9f2f57a4-ec49-47fb-a084-5e27c44a0d40' date '20 April 2016' time '8:36:01.938484 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.10' message '#253 add interactive attribute to minimal client default value answers whether or not the vm is headless, but it can be switched for testing ... modify tests to use interactive ... logStack, halt, and proceed tested now ...' id '512ddbc0-4fe5-47a6-a270-dd9dd18dbcf6' date '19 April 2016' time '8:54:40.76107 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.9' message '#253 gearing up for testing the code paths used for debugging ... more test coverage needed for #logStack and address failing test' id '2902180b-7c2d-4770-9ed5-25b81640375a' date '19 April 2016' time '5:19:21.999055 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.8' message '#253 defer some of the call back tests for later ' id 'be8f8e9a-8e1c-43f6-bcd3-a94b279d7161' date '19 April 2016' time '3:02:23.760295 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.7' message 'implement GsInteraction tests' id '137c6d90-c6ee-421c-8deb-1f6fbe42cb98' date '19 April 2016' time '2:49:10.986355 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.6' message '#253 implement services registry (for server callbacks) in minimal client' id 'e0c3c402-a9c1-4d7b-894e-baf1f655ada8' date '19 April 2016' time '11:33:35.066967 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.5' message '#253 tode command line execution is functional' id '22b068ae-b4b9-4cdd-928f-983733b3d00f' date '19 April 2016' time '10:16:53.881356 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.4' message '#253 implementing TDMinimalClient>>evaluate: which takes a tODE command and executes it ...' id '465a0c1c-f91f-49ee-88cf-da95c3eadf1f' date '19 April 2016' time '6:57:42.543698 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.3' message 'minimal tode client login functional!' id '72ddd092-155e-4988-b8c5-4879fed2b963' date '19 April 2016' time '6:00:35.970673 am' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.2' message '#253 TDMinimalClient>>loginWith: is working up until the clientForwarder send ... which is pretty good' id 'fb43446c-66d5-4e33-8f32-2fe1f61294b7' date '16 April 2016' time '8:14:01.400538 pm' author 'dkh' ancestors ((name 'Tode-Minimal-Client-Core-dkh.1' message '#253 start work on minimal client implementation ... dependent upong GsDevKit/GsDevKit_home#103 as well' id '04a9011f-075f-4a0c-9874-a9e2cf894f58' date '16 April 2016' time '11:40:28.303675 am' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Expand Down

0 comments on commit 391880e

Please sign in to comment.