2 node@(nodes Node traits) bindTo: value &environment: env
7 _@(nodes Placeholder traits) bindTo: val &environment: env
12 literal@(nodes Literal traits) bindTo: val &environment: env
15 (lhs is: Symbol) \/ [lhs is: String]
17 [(nodes UnaryMessage sending: lhs intern to: {nodes ImplicitArgument})
18 bindTo: val &environment: env]
20 [error: 'Cannot bind this type of literal: ' ; lhs printString]
23 load@(nodes LoadVariable traits) bindTo: value &environment: env
26 ifNil: [(load store: value) `unquote]
27 ifNotNil: [error: 'Cannot rebind'])
30 msg@(nodes UnaryMessage traits) bindTo: value &environment: env
32 env isNil \/ [msg arguments first ~= nodes ImplicitArgument]
34 [nodes KeywordMessage sending: #bind:to: to:
35 {msg arguments first. nodes Literal for: msg selector. value}]
37 [(env outermostScopeNotBinding: msg selector)
38 ifNil: [error: 'Cannot rebind']
41 StoreVariable of: value into:
42 (scope addVariableNamed: msg selector &varType: nodes Binding)]]
45 message@(nodes KeywordMessage traits) bindTo: val &environment: env
46 "Expands a message by looking at its selector and picking the right setter."
48 (message selector isKeywordSelector ifTrue:
49 [message selector caseOf: {
50 #addSlotNamed: -> [#bind:to:].
51 #addImmutableSlotNamed: -> [#bind:to:].
53 ifNil: [error: 'Cannot rebind'. message]
55 [| :newSel | message sending: newSel to: (message arguments copyWith: val)]
58 "This is the tricky moment at which we activate the special macro.
59 Above here, it is unavailable, and after here, the definitions is not sound."
60 n@(nodes Node traits) ::= val &environment: env [n bindTo: val &environment: env].