Skip to content

Commit

Permalink
This adds an error handler to try to create an UndefinedSlot in case …
Browse files Browse the repository at this point in the history
…something goes wrong when loading a class that uses a slot where the slot class is not yet loaded.

This PR is needed to load Ronnie's SmartData experiment.
  • Loading branch information
MarcusDenker committed Jul 10, 2020
1 parent a2ba9b1 commit 7ef67ed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Monticello/MCClassDefinition.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ MCClassDefinition >> createClass [
do: [ :ex | ex resume ]
]

{ #category : #installing }
MCClassDefinition >> createVariableFromString: aString [
^[ Smalltalk compiler evaluate: aString ]
on: Error
do: [
"if an error happens, we parse the slot definition to an ast.
and create a UndefinedSlot"
| ast slotName |
ast := RBParser parseExpression: aString.
slotName := ast receiver value.
UndefinedSlot named: slotName ast: ast ]
]

{ #category : #initializing }
MCClassDefinition >> defaultCommentStamp [
^ String new
Expand Down Expand Up @@ -557,6 +570,7 @@ MCClassDefinition >> variables [
{ #category : #installing }
MCClassDefinition >> variablesOfType: aSymbol [
"version for complex vars, { definition . definition }"
^(((self selectVariables: aSymbol) collect: [:each | Smalltalk compiler evaluate: each])) asArray.

^((self selectVariables: aSymbol)
collect: [:each | self createVariableFromString: each])
as: Array
]

0 comments on commit 7ef67ed

Please sign in to comment.