Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pharoversion: [ Pharo64-12, Pharo64-11, Pharo64-10 ]
pharoversion: [ Pharo64-alpha, Pharo64-13, Pharo64-12, Pharo64-11, Pharo64-10 ]
name: ${{ matrix.pharoversion }}
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 9 additions & 4 deletions repository/Mustache-Core/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Extension { #name : 'Object' }

{ #category : '*mustache-core' }
Object >> mustacheDefaultWhenLookupFails [
Object >> mustacheDefaultWhenLookupFails: failingPartString [

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need change the sender of this method as well. Now we get a DNU


^ nil
]

Expand All @@ -17,10 +18,14 @@ Object >> mustacheDo: aBlock inverted: aBoolean [

{ #category : '*mustache-core' }
Object >> mustacheLookup: aString [
"The lookup supports navigation between objects using messages expressed by $.

For example {{{ site.configuration }}} means that the template accesses the value returned by the message configuration sent to the result of the message site."

(aString = '.') ifTrue: [ ^ self ].
^ [ self perform: aString asSymbol ]
on: MessageNotUnderstood
do: [ :err | self mustacheLookupComplex: aString ]
^ (self respondsTo: aString asSymbol)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to change that. Asking before performing is way slower and unnecessary. I think a piece of code should support the intended case first. Just execution method assumes that it goes well most of the time so no check needed, just a guard. Defensively asking before is rather the exception that it often does not respondTo: . A short check turns out this new version is more than 5 times slower

ifTrue: [ self perform: aString asSymbol ]
ifFalse: [ self mustacheLookupComplex: aString ]
]

{ #category : '*mustache-core' }
Expand Down
Loading