Nicolas Cellier uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-nice.440.mcz ==================== Summary ==================== Name: EToys-nice.440 Author: nice Time: 13 April 2021, 5:54:56.04842 pm UUID: ff17f473-468b-dd40-b397-46da19a4bee7 Ancestors: EToys-nice.439 Simplify Symbol lookup a little bit. Similar to rewrite rule same assignment in both ifTrue:ifFalse: branches. Essentially same change as super. =============== Diff against EToys-nice.439 =============== Item was changed: ----- Method: DialectParser>>messagePart:repeat:initialKeyword: (in category 'as yet unclassified') ----- messagePart: level repeat: repeat initialKeyword: kwdIfAny | start receiver selector args precedence words keywordStart | [receiver := parseNode. (self matchKeyword and: [level >= 3]) ifTrue: [start := self startOfNextToken. selector := WriteStream on: (String new: 32). selector nextPutAll: kwdIfAny. args := OrderedCollection new. words := OrderedCollection new. [self matchKeyword] whileTrue: [keywordStart := self startOfNextToken + requestorOffset. selector nextPutAll: self advance , ':'. words addLast: (keywordStart to: hereEnd + requestorOffset). self primaryExpression ifFalse: [^ self expected: 'Argument']. args addLast: parseNode]. + selector := (Symbol lookup: selector contents) + ifNil: [ self correctSelector: selector contents + wordIntervals: words + exprInterval: (start to: self endOfLastToken) + ifAbort: [ ^ self fail ] ]. - (Symbol hasInterned: selector contents ifTrue: [ :sym | selector := sym]) - ifFalse: [ selector := self correctSelector: selector contents - wordIntervals: words - exprInterval: (start to: self endOfLastToken) - ifAbort: [ ^ self fail ] ]. precedence := 3] ifFalse: [((hereType == #binary or: [hereType == #verticalBar]) and: [level >= 2]) ifTrue: [start := self startOfNextToken. selector := self advance asSymbol. self primaryExpression ifFalse: [^self expected: 'Argument']. self messagePart: 1 repeat: true. args := Array with: parseNode. precedence := 2] ifFalse: [(hereType == #word and: [(#(leftParenthesis leftBracket leftBrace) includes: tokenType) not]) ifTrue: [start := self startOfNextToken. selector := self advance. args := #(). words := OrderedCollection with: (start + requestorOffset to: self endOfLastToken + requestorOffset). + selector := (Symbol lookup: selector) + ifNil: [ self correctSelector: selector + wordIntervals: words + exprInterval: (start to: self endOfLastToken) + ifAbort: [ ^ self fail ] ]. - (Symbol hasInterned: selector ifTrue: [ :sym | selector := sym]) - ifFalse: [ selector := self correctSelector: selector - wordIntervals: words - exprInterval: (start to: self endOfLastToken) - ifAbort: [ ^ self fail ] ]. precedence := 1] ifFalse: [^args notNil]]]. parseNode := MessageNode new receiver: receiver selector: selector arguments: args precedence: precedence from: encoder sourceRange: (start to: self endOfLastToken). repeat] whileTrue: []. ^true! |
Free forum by Nabble | Edit this page |