lists.squeakfoundation.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Packages
January 2013
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
packages@lists.squeakfoundation.org
1 participants
219 discussions
Start a n
N
ew thread
The Trunk: Environments-cwp.7.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-cwp.7.mcz
==================== Summary ==================== Name: Environments-cwp.7 Author: cwp Time: 1 January 2013, 6:53:18.035 pm UUID: de965a02-dce2-4ece-9299-c73b235a251d Ancestors: Environments-cwp.6 Environments bootstrap - stage 1 =============== Diff against Environments-cwp.6 =============== Item was changed: ----- Method: Environment class>>initialize (in category 'as yet unclassified') ----- initialize + self install! - self uninstall!
1
0
0
0
The Trunk: Environments-cwp.7.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-cwp.7.mcz
==================== Summary ==================== Name: Environments-cwp.7 Author: cwp Time: 1 January 2013, 6:53:18.035 pm UUID: de965a02-dce2-4ece-9299-c73b235a251d Ancestors: Environments-cwp.6 Environments bootstrap - stage 1 =============== Diff against Environments-cwp.6 =============== Item was changed: ----- Method: Environment class>>initialize (in category 'as yet unclassified') ----- initialize + self install! - self uninstall!
1
0
0
0
The Trunk: System-cwp.507.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cwp.507.mcz
==================== Summary ==================== Name: System-cwp.507 Author: cwp Time: 1 January 2013, 6:50:59.79 pm UUID: cba427fe-eae7-47a5-9178-8a188aec1afe Ancestors: System-fbs.506 Environments bootstrap - stage 1 =============== Diff against System-fbs.506 =============== Item was added: + ----- Method: ImageSegment>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: InternalTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | aString newTranslations assoc currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [Locale + currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: NaturalLanguageTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | newTranslations currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [| aString assoc | + Locale currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: ObjectScanner>>scanFrom:environment: (in category 'scanning') ----- + scanFrom: aByteStream environment: anEnvironment + "This should probably be reimplemented using an environment + for compilation. For now, don't change anything" + ^ self scanFrom: aByteStream! Item was added: + ----- Method: PseudoClass>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral! Item was added: + ----- Method: SmartRefStream class>>scanFrom:environment: (in category 'i/o') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SmartRefStream>>scanFrom:environment: (in category 'read write') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SystemDictionary>>bindingOf:ifAbsent: (in category 'accessing') ----- + bindingOf: varName ifAbsent: aBlock + "SystemDictionary includes Symbols only" + ^super bindingOf: varName asSymbol ifAbsent: aBlock! Item was added: + ----- Method: SystemDictionary>>undeclared (in category 'accessing') ----- + undeclared + ^ self at: #Undeclared!
1
0
0
0
The Trunk: System-cwp.507.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cwp.507.mcz
==================== Summary ==================== Name: System-cwp.507 Author: cwp Time: 1 January 2013, 6:50:59.79 pm UUID: cba427fe-eae7-47a5-9178-8a188aec1afe Ancestors: System-fbs.506 Environments bootstrap - stage 1 =============== Diff against System-fbs.506 =============== Item was added: + ----- Method: ImageSegment>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: InternalTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | aString newTranslations assoc currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [Locale + currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: NaturalLanguageTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | newTranslations currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [| aString assoc | + Locale currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: ObjectScanner>>scanFrom:environment: (in category 'scanning') ----- + scanFrom: aByteStream environment: anEnvironment + "This should probably be reimplemented using an environment + for compilation. For now, don't change anything" + ^ self scanFrom: aByteStream! Item was added: + ----- Method: PseudoClass>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral! Item was added: + ----- Method: SmartRefStream class>>scanFrom:environment: (in category 'i/o') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SmartRefStream>>scanFrom:environment: (in category 'read write') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SystemDictionary>>bindingOf:ifAbsent: (in category 'accessing') ----- + bindingOf: varName ifAbsent: aBlock + "SystemDictionary includes Symbols only" + ^super bindingOf: varName asSymbol ifAbsent: aBlock! Item was added: + ----- Method: SystemDictionary>>undeclared (in category 'accessing') ----- + undeclared + ^ self at: #Undeclared!
1
0
0
0
The Trunk: System-cwp.507.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cwp.507.mcz
==================== Summary ==================== Name: System-cwp.507 Author: cwp Time: 1 January 2013, 6:50:59.79 pm UUID: cba427fe-eae7-47a5-9178-8a188aec1afe Ancestors: System-fbs.506 Environments bootstrap - stage 1 =============== Diff against System-fbs.506 =============== Item was added: + ----- Method: ImageSegment>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: InternalTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | aString newTranslations assoc currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [Locale + currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: NaturalLanguageTranslator>>scanFrom:environment: (in category 'fileIn/fileOut') ----- + scanFrom: aStream environment: anEnvironment + "Read a definition of dictionary. + Make sure current locale corresponds my locale id" + | newTranslations currentPlatform | + newTranslations := Dictionary new. + currentPlatform := Locale currentPlatform. + [| aString assoc | + Locale currentPlatform: (Locale localeID: id). + [aString := aStream nextChunk withSqueakLineEndings. + aString size > 0] whileTrue: + [assoc := Compiler evaluate: aString environment: anEnvironment. + assoc value = '' + ifTrue: [self class registerPhrase: assoc key] + ifFalse: [newTranslations add: assoc]]] + ensure: [Locale currentPlatform: currentPlatform]. + self mergeTranslations: newTranslations! Item was added: + ----- Method: ObjectScanner>>scanFrom:environment: (in category 'scanning') ----- + scanFrom: aByteStream environment: anEnvironment + "This should probably be reimplemented using an environment + for compilation. For now, don't change anything" + ^ self scanFrom: aByteStream! Item was added: + ----- Method: PseudoClass>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral! Item was added: + ----- Method: SmartRefStream class>>scanFrom:environment: (in category 'i/o') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SmartRefStream>>scanFrom:environment: (in category 'read write') ----- + scanFrom: aByteStream environment: anEnvironment + ^ self scanFrom: aByteStream! Item was added: + ----- Method: SystemDictionary>>bindingOf:ifAbsent: (in category 'accessing') ----- + bindingOf: varName ifAbsent: aBlock + "SystemDictionary includes Symbols only" + ^super bindingOf: varName asSymbol ifAbsent: aBlock! Item was added: + ----- Method: SystemDictionary>>undeclared (in category 'accessing') ----- + undeclared + ^ self at: #Undeclared!
1
0
0
0
The Trunk: Kernel-cwp.726.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-cwp.726.mcz
==================== Summary ==================== Name: Kernel-cwp.726 Author: cwp Time: 1 January 2013, 6:49:20.367 pm UUID: f9e0f27b-a0ec-4827-a765-1b85d58cbfe8 Ancestors: Kernel-nice.725 Environments bootstrap - stage 1 =============== Diff against Kernel-nice.725 =============== Item was added: + ----- Method: Behavior>>bindingOf:environment: (in category 'testing method dictionary') ----- + bindingOf: varName environment: anEnvironment + ^superclass bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>classBindingOf:environment: (in category 'testing method dictionary') ----- + classBindingOf: varName environment: anEnvironment + ^self bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + "Postprocesses a literal scanned by Scanner scanToken (esp. xLitQuote). + If scannedLiteral is not an association, answer it. + Else, if it is of the form: + nil->#NameOfMetaclass + answer nil->theMetaclass, if any has that name, else report an error. + Else, if it is of the form: + #NameOfGlobalVariable->anythiEng + answer the global, class, or pool association with that nameE, if any, else + add it to Undeclared a answer the new Association." + + | key value | + (scannedLiteral isVariableBinding) + ifFalse: [^ scannedLiteral]. + key := scannedLiteral key. + value := scannedLiteral value. + key ifNil: "###<metaclass soleInstance name>" + [(self bindingOf: value environment: anEnvironment) ifNotNil: + [:assoc| + (assoc value isKindOf: Behavior) ifTrue: + [^ nil->assoc value class]]. + requestor notify: 'No such metaclass'. + ^false]. + (key isSymbol) ifTrue: "##<global var name>" + [(self bindingOf: key environment: anEnvironment) ifNotNil: + [:assoc | ^assoc]. + ^ anEnvironment undeclared: key]. + requestor notify: '## must be followed by a non-local variable name'. + ^false + + " Form literalScannedAs: 14 notifying: nil 14 + Form literalScannedAs: #OneBitForm notiEfying: nil OneBitForm + Form literalScannedAs: ##OneBitForm notifying: nil OneBitForm->a Form + Form literalScannedAs: ##Form notifying: nil Form->Form + Form literalScannedAs: ###Form notifying: nil nilE->Form class + "! Item was added: + ----- Method: Categorizer>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: Class>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + "Answer the binding of some variable resolved in the scope of the receiver" + | aSymbol binding | + aSymbol := varName asSymbol. + + "First look in classVar dictionary." + binding := self classPool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Next look in shared pools." + self sharedPools do:[:pool | + binding := pool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + ]. + + "Next look in declared environment." + binding := anEnvironment bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Finally look higher up the superclass chain and fail at the end." + superclass == nil + ifTrue: [^ nil] + ifFalse: [^ superclass bindingOf: aSymbol]. + + ! Item was added: + ----- Method: ClassCategoryReader>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + "File in methods from the stream, aStream." + | methodText | + [methodText := aStream nextChunkText. + methodText size > 0] whileTrue: + [class + compile: methodText + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: nil]! Item was added: + ----- Method: ClassCommentReader>>scanFrom:environment: (in category 'as yet unclassified') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor + ^ self + compile: text + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: requestor + logSource: self acceptsLoggingOfCompilation! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying:logSource: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor logSource: logSource + | methodAndNode context methodNode | + context := CompilationCue + source: text + class: self + environment: anEnvironment + category: category + requestor: requestor. + methodNode := self newCompiler compile: context ifFail: [^ nil]. + methodAndNode := CompiledMethodWithNode + generateMethodFromNode: methodNode + trailer: self defaultMethodTrailer. + + logSource ifTrue: [ + self logMethodSource: text forMethodWithNode: methodAndNode + inCategory: category withStamp: changeStamp notifying: requestor. + ]. + self addAndClassifySelector: methodAndNode selector withMethod: methodAndNode + method inProtocol: category notifying: requestor. + self instanceSide noteCompilationOf: methodAndNode selector meta: self isClassSide. + ^ methodAndNode selector! Item was added: + ----- Method: Metaclass>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + ^ thisClass classBindingOf: varName environment: anEnvironment! Item was added: + ----- Method: UndefinedObject>>literalScannedAs:environment:notifying: (in category 'class hierarchy') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral!
1
0
0
0
The Trunk: Kernel-cwp.726.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-cwp.726.mcz
==================== Summary ==================== Name: Kernel-cwp.726 Author: cwp Time: 1 January 2013, 6:49:20.367 pm UUID: f9e0f27b-a0ec-4827-a765-1b85d58cbfe8 Ancestors: Kernel-nice.725 Environments bootstrap - stage 1 =============== Diff against Kernel-nice.725 =============== Item was added: + ----- Method: Behavior>>bindingOf:environment: (in category 'testing method dictionary') ----- + bindingOf: varName environment: anEnvironment + ^superclass bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>classBindingOf:environment: (in category 'testing method dictionary') ----- + classBindingOf: varName environment: anEnvironment + ^self bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + "Postprocesses a literal scanned by Scanner scanToken (esp. xLitQuote). + If scannedLiteral is not an association, answer it. + Else, if it is of the form: + nil->#NameOfMetaclass + answer nil->theMetaclass, if any has that name, else report an error. + Else, if it is of the form: + #NameOfGlobalVariable->anythiEng + answer the global, class, or pool association with that nameE, if any, else + add it to Undeclared a answer the new Association." + + | key value | + (scannedLiteral isVariableBinding) + ifFalse: [^ scannedLiteral]. + key := scannedLiteral key. + value := scannedLiteral value. + key ifNil: "###<metaclass soleInstance name>" + [(self bindingOf: value environment: anEnvironment) ifNotNil: + [:assoc| + (assoc value isKindOf: Behavior) ifTrue: + [^ nil->assoc value class]]. + requestor notify: 'No such metaclass'. + ^false]. + (key isSymbol) ifTrue: "##<global var name>" + [(self bindingOf: key environment: anEnvironment) ifNotNil: + [:assoc | ^assoc]. + ^ anEnvironment undeclared: key]. + requestor notify: '## must be followed by a non-local variable name'. + ^false + + " Form literalScannedAs: 14 notifying: nil 14 + Form literalScannedAs: #OneBitForm notiEfying: nil OneBitForm + Form literalScannedAs: ##OneBitForm notifying: nil OneBitForm->a Form + Form literalScannedAs: ##Form notifying: nil Form->Form + Form literalScannedAs: ###Form notifying: nil nilE->Form class + "! Item was added: + ----- Method: Categorizer>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: Class>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + "Answer the binding of some variable resolved in the scope of the receiver" + | aSymbol binding | + aSymbol := varName asSymbol. + + "First look in classVar dictionary." + binding := self classPool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Next look in shared pools." + self sharedPools do:[:pool | + binding := pool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + ]. + + "Next look in declared environment." + binding := anEnvironment bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Finally look higher up the superclass chain and fail at the end." + superclass == nil + ifTrue: [^ nil] + ifFalse: [^ superclass bindingOf: aSymbol]. + + ! Item was added: + ----- Method: ClassCategoryReader>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + "File in methods from the stream, aStream." + | methodText | + [methodText := aStream nextChunkText. + methodText size > 0] whileTrue: + [class + compile: methodText + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: nil]! Item was added: + ----- Method: ClassCommentReader>>scanFrom:environment: (in category 'as yet unclassified') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor + ^ self + compile: text + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: requestor + logSource: self acceptsLoggingOfCompilation! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying:logSource: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor logSource: logSource + | methodAndNode context methodNode | + context := CompilationCue + source: text + class: self + environment: anEnvironment + category: category + requestor: requestor. + methodNode := self newCompiler compile: context ifFail: [^ nil]. + methodAndNode := CompiledMethodWithNode + generateMethodFromNode: methodNode + trailer: self defaultMethodTrailer. + + logSource ifTrue: [ + self logMethodSource: text forMethodWithNode: methodAndNode + inCategory: category withStamp: changeStamp notifying: requestor. + ]. + self addAndClassifySelector: methodAndNode selector withMethod: methodAndNode + method inProtocol: category notifying: requestor. + self instanceSide noteCompilationOf: methodAndNode selector meta: self isClassSide. + ^ methodAndNode selector! Item was added: + ----- Method: Metaclass>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + ^ thisClass classBindingOf: varName environment: anEnvironment! Item was added: + ----- Method: UndefinedObject>>literalScannedAs:environment:notifying: (in category 'class hierarchy') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral!
1
0
0
0
The Trunk: Kernel-cwp.726.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-cwp.726.mcz
==================== Summary ==================== Name: Kernel-cwp.726 Author: cwp Time: 1 January 2013, 6:49:20.367 pm UUID: f9e0f27b-a0ec-4827-a765-1b85d58cbfe8 Ancestors: Kernel-nice.725 Environments bootstrap - stage 1 =============== Diff against Kernel-nice.725 =============== Item was added: + ----- Method: Behavior>>bindingOf:environment: (in category 'testing method dictionary') ----- + bindingOf: varName environment: anEnvironment + ^superclass bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>classBindingOf:environment: (in category 'testing method dictionary') ----- + classBindingOf: varName environment: anEnvironment + ^self bindingOf: varName environment: anEnvironment! Item was added: + ----- Method: Behavior>>literalScannedAs:environment:notifying: (in category 'printing') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + "Postprocesses a literal scanned by Scanner scanToken (esp. xLitQuote). + If scannedLiteral is not an association, answer it. + Else, if it is of the form: + nil->#NameOfMetaclass + answer nil->theMetaclass, if any has that name, else report an error. + Else, if it is of the form: + #NameOfGlobalVariable->anythiEng + answer the global, class, or pool association with that nameE, if any, else + add it to Undeclared a answer the new Association." + + | key value | + (scannedLiteral isVariableBinding) + ifFalse: [^ scannedLiteral]. + key := scannedLiteral key. + value := scannedLiteral value. + key ifNil: "###<metaclass soleInstance name>" + [(self bindingOf: value environment: anEnvironment) ifNotNil: + [:assoc| + (assoc value isKindOf: Behavior) ifTrue: + [^ nil->assoc value class]]. + requestor notify: 'No such metaclass'. + ^false]. + (key isSymbol) ifTrue: "##<global var name>" + [(self bindingOf: key environment: anEnvironment) ifNotNil: + [:assoc | ^assoc]. + ^ anEnvironment undeclared: key]. + requestor notify: '## must be followed by a non-local variable name'. + ^false + + " Form literalScannedAs: 14 notifying: nil 14 + Form literalScannedAs: #OneBitForm notiEfying: nil OneBitForm + Form literalScannedAs: ##OneBitForm notifying: nil OneBitForm->a Form + Form literalScannedAs: ##Form notifying: nil Form->Form + Form literalScannedAs: ###Form notifying: nil nilE->Form class + "! Item was added: + ----- Method: Categorizer>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: Class>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + "Answer the binding of some variable resolved in the scope of the receiver" + | aSymbol binding | + aSymbol := varName asSymbol. + + "First look in classVar dictionary." + binding := self classPool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Next look in shared pools." + self sharedPools do:[:pool | + binding := pool bindingOf: aSymbol. + binding ifNotNil:[^binding]. + ]. + + "Next look in declared environment." + binding := anEnvironment bindingOf: aSymbol. + binding ifNotNil:[^binding]. + + "Finally look higher up the superclass chain and fail at the end." + superclass == nil + ifTrue: [^ nil] + ifFalse: [^ superclass bindingOf: aSymbol]. + + ! Item was added: + ----- Method: ClassCategoryReader>>scanFrom:environment: (in category 'fileIn/Out') ----- + scanFrom: aStream environment: anEnvironment + "File in methods from the stream, aStream." + | methodText | + [methodText := aStream nextChunkText. + methodText size > 0] whileTrue: + [class + compile: methodText + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: nil]! Item was added: + ----- Method: ClassCommentReader>>scanFrom:environment: (in category 'as yet unclassified') ----- + scanFrom: aStream environment: anEnvironment + ^ self scanFrom: aStream! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor + ^ self + compile: text + environment: anEnvironment + classified: category + withStamp: changeStamp + notifying: requestor + logSource: self acceptsLoggingOfCompilation! Item was added: + ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying:logSource: (in category 'compiling') ----- + compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor logSource: logSource + | methodAndNode context methodNode | + context := CompilationCue + source: text + class: self + environment: anEnvironment + category: category + requestor: requestor. + methodNode := self newCompiler compile: context ifFail: [^ nil]. + methodAndNode := CompiledMethodWithNode + generateMethodFromNode: methodNode + trailer: self defaultMethodTrailer. + + logSource ifTrue: [ + self logMethodSource: text forMethodWithNode: methodAndNode + inCategory: category withStamp: changeStamp notifying: requestor. + ]. + self addAndClassifySelector: methodAndNode selector withMethod: methodAndNode + method inProtocol: category notifying: requestor. + self instanceSide noteCompilationOf: methodAndNode selector meta: self isClassSide. + ^ methodAndNode selector! Item was added: + ----- Method: Metaclass>>bindingOf:environment: (in category 'compiling') ----- + bindingOf: varName environment: anEnvironment + ^ thisClass classBindingOf: varName environment: anEnvironment! Item was added: + ----- Method: UndefinedObject>>literalScannedAs:environment:notifying: (in category 'class hierarchy') ----- + literalScannedAs: scannedLiteral environment: anEnvironment notifying: requestor + ^ scannedLiteral!
1
0
0
0
The Trunk: Compiler-cwp.245.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-cwp.245.mcz
==================== Summary ==================== Name: Compiler-cwp.245 Author: cwp Time: 1 January 2013, 6:47:22.812 pm UUID: ded24bcc-aeee-4129-94fa-2b2da294e964 Ancestors: Compiler-eem.243 Environments bootstrap - stage 1 =============== Diff against Compiler-eem.243 =============== Item was added: + Object subclass: #CompilationCue + instanceVariableNames: 'source context receiver class environment category requestor' + classVariableNames: '' + poolDictionaries: '' + category: 'Compiler-Kernel'! Item was added: + ----- Method: CompilationCue class>>class: (in category 'instance creation') ----- + class: aClass + ^ self + context: nil + class: aClass + requestor: nil! Item was added: + ----- Method: CompilationCue class>>context:class:requestor: (in category 'instance creation') ----- + context: aContext class: aClass requestor: anObject + ^ self + source: nil + context: aContext + receiver: nil + class: aClass + environment: (aClass ifNotNil: [aClass environment]) + category: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:class:environment:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream class: aClass environment: anEnvironment category: aString requestor: anObject + ^ self + source: aTextOrStream + context: nil + receiver: nil + class: aClass + environment: anEnvironment + category: aString + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:class:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext class: aClass category: aString requestor: anObject + ^ self + source: aTextOrStream + context: aContext + receiver: (aContext ifNotNil: [aContext receiver]) + class: aClass + environment: (aClass ifNotNil: [aClass environment]) + category: aString + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:class:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext class: aClass requestor: anObject + ^ self + source: aTextOrStream + context: aContext + class: aClass + category: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:receiver:class:environment:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext receiver: recObject class: aClass environment: anEnvironment category: aString requestor: reqObject + ^ self basicNew + initializeWithSource: aTextOrStream + context: aContext + receiver: recObject + class: aClass + environment: anEnvironment + category: aString + requestor: reqObject! Item was added: + ----- Method: CompilationCue class>>source:environment: (in category 'instance creation') ----- + source: aString environment: anEnvironment + ^ self + source: aString + context: nil + receiver: nil + class: UndefinedObject + environment: anEnvironment + category: nil + requestor: nil! Item was added: + ----- Method: CompilationCue class>>source:requestor: (in category 'instance creation') ----- + source: aTextOrStream requestor: anObject + ^ self + source: aTextOrStream + context: nil + class: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue>>bindingOf: (in category 'binding') ----- + bindingOf: aSymbol + ^ class bindingOf: aSymbol environment: environment! Item was added: + ----- Method: CompilationCue>>category (in category 'accessing') ----- + category + ^ category! Item was added: + ----- Method: CompilationCue>>context (in category 'accessing') ----- + context + ^ context! Item was added: + ----- Method: CompilationCue>>environment (in category 'accessing') ----- + environment + ^ environment! Item was added: + ----- Method: CompilationCue>>getClass (in category 'accessing') ----- + getClass + ^ class! Item was added: + ----- Method: CompilationCue>>initializeWithSource:context:receiver:class:environment:category:requestor: (in category 'initialization') ----- + initializeWithSource: aTextOrString context: aContext receiver: recObject class: aClass environment: anEnvironment category: aString requestor: reqObject + self initialize. + source := aTextOrString isStream ifTrue: [aTextOrString contents] ifFalse: [aTextOrString]. + context := aContext. + receiver := recObject. + class := aClass. + environment := anEnvironment. + category := aString. + requestor := reqObject! Item was added: + ----- Method: CompilationCue>>literalScannedAs:notifying: (in category 'binding') ----- + literalScannedAs: anObject notifying: anEncoder + ^ class literalScannedAs: anObject environment: environment notifying: anEncoder! Item was added: + ----- Method: CompilationCue>>receiver (in category 'accessing') ----- + receiver + ^ receiver! Item was added: + ----- Method: CompilationCue>>requestor (in category 'accessing') ----- + requestor + ^ requestor! Item was added: + ----- Method: CompilationCue>>source (in category 'accessing') ----- + source + ^ source! Item was added: + ----- Method: CompilationCue>>sourceStream (in category 'accessing') ----- + sourceStream + ^ source readStream! Item was changed: Object subclass: #Compiler + instanceVariableNames: 'sourceStream requestor class category context parser cue' - instanceVariableNames: 'sourceStream requestor class category context parser' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Compiler commentStamp: 'cwp 12/26/2012 23:17' prior: 0! - !Compiler commentStamp: '<historical>' prior: 0! The compiler accepts Smalltalk source code and compiles it with respect to a given class. The user of the compiler supplies a context so that temporary variables are accessible during compilation. If there is an error, a requestor (usually a kind of StringHolderController) is sent the message notify:at:in: so that the error message can be displayed. If there is no error, then the result of compilation is a MethodNode, which is the root of a parse tree whose nodes are kinds of ParseNodes. The parse tree can be sent messages to (1) generate code for a CompiledMethod (this is done for compiling methods or evaluating expressions); (2) pretty-print the code (for formatting); or (3) produce a map from object code back to source code (used by debugger program-counter selection). See also Parser, Encoder, ParseNode.! Item was added: + ----- Method: Compiler class>>evaluate:environment: (in category 'evaluating') ----- + evaluate: aString environment: anEnvironment + ^ self + evaluate: aString + environment: anEnvironment + logged: false! Item was added: + ----- Method: Compiler class>>evaluate:environment:logged: (in category 'evaluating') ----- + evaluate: aString environment: anEnvironment logged: aBoolean + | cue | + cue := CompilationCue + source: aString + environment: anEnvironment. + + ^ self new + evaluate: aString + cue: cue + ifFail: [^ nil] + logged: aBoolean! Item was added: + ----- Method: Compiler>>compile:ifFail: (in category 'public access') ----- + compile: aCue ifFail: failBlock + "Answer a MethodNode. If the MethodNode can not be created, notify + the requestor in the contxt. If the requestor is nil, evaluate failBlock + instead. The MethodNode is the root of a parse tree. It can be told + to generate a CompiledMethod to be installed in the method dictionary + of the class specified by the context." + + self setCue: aCue. + self source: cue source. + ^self + translate: sourceStream + noPattern: false + ifFail: failBlock! Item was added: + ----- Method: Compiler>>evaluate:cue:ifFail:logged: (in category 'public access') ----- + evaluate: textOrStream cue: aCue ifFail: failBlock logged: logFlag + "Compiles the sourceStream into a parse tree, then generates code into + a method. Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method + litter on errors." + + | methodNode method value toLog itsSelection itsSelectionString | + self setCue: aCue. + self source: textOrStream. + methodNode := self translate: sourceStream noPattern: true ifFail: [^failBlock value]. + + method := self interactive + ifTrue: [methodNode generateWithTempNames] + ifFalse: [methodNode generate]. + + value := cue receiver + withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}]) + executeMethod: method. + + logFlag ifTrue: + [toLog := ((cue requestor respondsTo: #selection) + and:[(itsSelection := cue requestor selection) notNil + and:[(itsSelectionString := itsSelection asString) isEmptyOrNil not]]) + ifTrue:[itsSelectionString] + ifFalse:[sourceStream contents]. + SystemChangeNotifier uniqueInstance evaluated: toLog context: cue context]. + ^ value + ! Item was added: + ----- Method: Compiler>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Set legacy instance variables for methods that don't use cue yet." + requestor := cue requestor. + class := cue getClass. + category := cue category. + context := cue context.! Item was added: + ----- Method: Compiler>>source: (in category 'private') ----- + source: textOrStream + sourceStream := (textOrStream isKindOf: PositionableStream) + ifTrue: [ textOrStream ] + ifFalse: [ ReadStream on: textOrStream asString ]! Item was added: + ----- Method: Dictionary>>bindingOf:ifAbsent: (in category '*Compiler') ----- + bindingOf: varName ifAbsent: aBlock + + ^self associationAt: varName ifAbsent: aBlock! Item was changed: ParseNode subclass: #Encoder + instanceVariableNames: 'scopeTable nTemps supered requestor class selector literalStream selectorSet litIndSet litSet sourceRanges globalSourceRanges addedSelectorAndMethodClassLiterals optimizedSelectors cue' - instanceVariableNames: 'scopeTable nTemps supered requestor class selector literalStream selectorSet litIndSet litSet sourceRanges globalSourceRanges addedSelectorAndMethodClassLiterals optimizedSelectors' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Encoder commentStamp: 'cwp 12/26/2012 23:29' prior: 0! - !Encoder commentStamp: '<historical>' prior: 0! I encode names and literals into tree nodes with byte codes for the compiler. Byte codes for literals are not assigned until the tree-sizing pass of the compiler, because only then is it known which literals are actually needed. I also keep track of sourceCode ranges during parsing and code generation so I can provide an inverse map for the debugger.! Item was added: + ----- Method: Encoder>>init:notifying: (in category 'initialize-release') ----- + init: aCue notifying: anObject + "The use of the variable requestor is a bit confusing here. This is + *not* the original requestor, which is available through the cue. + It's the Parser instance that is using the encoder." + + self setCue: aCue. + requestor := anObject. + nTemps := 0. + supered := false. + self initScopeAndLiteralTables. + cue getClass variablesAndOffsetsDo: + [:variable "<String|CFieldDefinition>" :offset "<Integer|nil>" | + offset isNil + ifTrue: [scopeTable at: variable name put: (FieldNode new fieldDefinition: variable)] + ifFalse: [scopeTable + at: variable + put: (offset >= 0 + ifTrue: [InstanceVariableNode new + name: variable index: offset] + ifFalse: [MaybeContextInstanceVariableNode new + name: variable index: offset negated])]]. + cue context ~~ nil ifTrue: + [| homeNode | + homeNode := self bindTemp: self doItInContextName. + "0th temp = aContext passed as arg" + cue context tempNames withIndexDo: + [:variable :index| + scopeTable + at: variable + put: (MessageAsTempNode new + receiver: homeNode + selector: #namedTempAt: + arguments: (Array with: (self encodeLiteral: index)) + precedence: 3 + from: self)]]. + sourceRanges := Dictionary new: 32. + globalSourceRanges := OrderedCollection new: 32 + ! Item was added: + ----- Method: Encoder>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Also set legacy instance variables for methods that + don't use cue yet" + class := cue getClass.! Item was changed: Scanner subclass: #Parser + instanceVariableNames: 'here hereType hereMark hereEnd prevMark prevEnd encoder requestor parseNode failBlock requestorOffset tempsMark doitFlag properties category queriedUnusedTemporaries cue' - instanceVariableNames: 'here hereType hereMark hereEnd prevMark prevEnd encoder requestor parseNode failBlock requestorOffset tempsMark doitFlag properties category queriedUnusedTemporaries' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Parser commentStamp: 'cwp 12/26/2012 23:34' prior: 0! - !Parser commentStamp: '<historical>' prior: 0! I parse Smalltalk syntax and create a MethodNode that is the root of the parse tree. I look one token ahead.! Item was added: + ----- Method: Parser>>init:cue:failBlock: (in category 'private') ----- + init: sourceStream cue: aCue failBlock: aBlock + + self setCue: aCue. + failBlock := aBlock. + requestorOffset := 0. + super scan: sourceStream. + prevMark := hereMark := mark. + self advance + ! Item was added: + ----- Method: Parser>>parse:cue:noPattern:ifFail: (in category 'public access') ----- + parse: sourceStream cue: aCue noPattern: noPattern ifFail: aBlock + "Answer a MethodNode for the argument, sourceStream, that is the root of + a parse tree. Parsing is done with respect to the CompilationCue to + resolve variables. Errors in parsing are reported to the cue's requestor; + otherwise aBlock is evaluated. The argument noPattern is a Boolean that is + true if the the sourceStream does not contain a method header (i.e., for DoIts)." + + | methNode repeatNeeded myStream s p subSelection | + myStream := sourceStream. + [repeatNeeded := false. + p := myStream position. + s := myStream upToEnd. + myStream position: p. + subSelection := aCue requestor notNil and: [aCue requestor selectionInterval = (p + 1 to: p + s size)]. + self encoder init: aCue notifying: self. + self init: myStream cue: aCue failBlock: [^ aBlock value]. + doitFlag := noPattern. + failBlock:= aBlock. + [methNode := self method: noPattern context: cue context] + on: ReparseAfterSourceEditing + do: [ :ex | + repeatNeeded := true. + myStream := subSelection + ifTrue: + [ReadStream + on: cue requestor text string + from: cue requestor selectionInterval first + to: cue requestor selectionInterval last] + ifFalse: + [ReadStream on: cue requestor text string]]. + repeatNeeded] whileTrue: + [encoder := self encoder class new]. + methNode sourceText: s. + ^methNode + ! Item was added: + ----- Method: Parser>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Also set legacy variables for methods that don't use cue yet." + requestor := cue requestor. + category := cue category.!
1
0
0
0
The Trunk: Compiler-cwp.245.mcz
by commits@source.squeak.org
02 Jan '13
02 Jan '13
Colin Putney uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-cwp.245.mcz
==================== Summary ==================== Name: Compiler-cwp.245 Author: cwp Time: 1 January 2013, 6:47:22.812 pm UUID: ded24bcc-aeee-4129-94fa-2b2da294e964 Ancestors: Compiler-eem.243 Environments bootstrap - stage 1 =============== Diff against Compiler-eem.243 =============== Item was added: + Object subclass: #CompilationCue + instanceVariableNames: 'source context receiver class environment category requestor' + classVariableNames: '' + poolDictionaries: '' + category: 'Compiler-Kernel'! Item was added: + ----- Method: CompilationCue class>>class: (in category 'instance creation') ----- + class: aClass + ^ self + context: nil + class: aClass + requestor: nil! Item was added: + ----- Method: CompilationCue class>>context:class:requestor: (in category 'instance creation') ----- + context: aContext class: aClass requestor: anObject + ^ self + source: nil + context: aContext + receiver: nil + class: aClass + environment: (aClass ifNotNil: [aClass environment]) + category: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:class:environment:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream class: aClass environment: anEnvironment category: aString requestor: anObject + ^ self + source: aTextOrStream + context: nil + receiver: nil + class: aClass + environment: anEnvironment + category: aString + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:class:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext class: aClass category: aString requestor: anObject + ^ self + source: aTextOrStream + context: aContext + receiver: (aContext ifNotNil: [aContext receiver]) + class: aClass + environment: (aClass ifNotNil: [aClass environment]) + category: aString + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:class:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext class: aClass requestor: anObject + ^ self + source: aTextOrStream + context: aContext + class: aClass + category: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue class>>source:context:receiver:class:environment:category:requestor: (in category 'instance creation') ----- + source: aTextOrStream context: aContext receiver: recObject class: aClass environment: anEnvironment category: aString requestor: reqObject + ^ self basicNew + initializeWithSource: aTextOrStream + context: aContext + receiver: recObject + class: aClass + environment: anEnvironment + category: aString + requestor: reqObject! Item was added: + ----- Method: CompilationCue class>>source:environment: (in category 'instance creation') ----- + source: aString environment: anEnvironment + ^ self + source: aString + context: nil + receiver: nil + class: UndefinedObject + environment: anEnvironment + category: nil + requestor: nil! Item was added: + ----- Method: CompilationCue class>>source:requestor: (in category 'instance creation') ----- + source: aTextOrStream requestor: anObject + ^ self + source: aTextOrStream + context: nil + class: nil + requestor: anObject! Item was added: + ----- Method: CompilationCue>>bindingOf: (in category 'binding') ----- + bindingOf: aSymbol + ^ class bindingOf: aSymbol environment: environment! Item was added: + ----- Method: CompilationCue>>category (in category 'accessing') ----- + category + ^ category! Item was added: + ----- Method: CompilationCue>>context (in category 'accessing') ----- + context + ^ context! Item was added: + ----- Method: CompilationCue>>environment (in category 'accessing') ----- + environment + ^ environment! Item was added: + ----- Method: CompilationCue>>getClass (in category 'accessing') ----- + getClass + ^ class! Item was added: + ----- Method: CompilationCue>>initializeWithSource:context:receiver:class:environment:category:requestor: (in category 'initialization') ----- + initializeWithSource: aTextOrString context: aContext receiver: recObject class: aClass environment: anEnvironment category: aString requestor: reqObject + self initialize. + source := aTextOrString isStream ifTrue: [aTextOrString contents] ifFalse: [aTextOrString]. + context := aContext. + receiver := recObject. + class := aClass. + environment := anEnvironment. + category := aString. + requestor := reqObject! Item was added: + ----- Method: CompilationCue>>literalScannedAs:notifying: (in category 'binding') ----- + literalScannedAs: anObject notifying: anEncoder + ^ class literalScannedAs: anObject environment: environment notifying: anEncoder! Item was added: + ----- Method: CompilationCue>>receiver (in category 'accessing') ----- + receiver + ^ receiver! Item was added: + ----- Method: CompilationCue>>requestor (in category 'accessing') ----- + requestor + ^ requestor! Item was added: + ----- Method: CompilationCue>>source (in category 'accessing') ----- + source + ^ source! Item was added: + ----- Method: CompilationCue>>sourceStream (in category 'accessing') ----- + sourceStream + ^ source readStream! Item was changed: Object subclass: #Compiler + instanceVariableNames: 'sourceStream requestor class category context parser cue' - instanceVariableNames: 'sourceStream requestor class category context parser' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Compiler commentStamp: 'cwp 12/26/2012 23:17' prior: 0! - !Compiler commentStamp: '<historical>' prior: 0! The compiler accepts Smalltalk source code and compiles it with respect to a given class. The user of the compiler supplies a context so that temporary variables are accessible during compilation. If there is an error, a requestor (usually a kind of StringHolderController) is sent the message notify:at:in: so that the error message can be displayed. If there is no error, then the result of compilation is a MethodNode, which is the root of a parse tree whose nodes are kinds of ParseNodes. The parse tree can be sent messages to (1) generate code for a CompiledMethod (this is done for compiling methods or evaluating expressions); (2) pretty-print the code (for formatting); or (3) produce a map from object code back to source code (used by debugger program-counter selection). See also Parser, Encoder, ParseNode.! Item was added: + ----- Method: Compiler class>>evaluate:environment: (in category 'evaluating') ----- + evaluate: aString environment: anEnvironment + ^ self + evaluate: aString + environment: anEnvironment + logged: false! Item was added: + ----- Method: Compiler class>>evaluate:environment:logged: (in category 'evaluating') ----- + evaluate: aString environment: anEnvironment logged: aBoolean + | cue | + cue := CompilationCue + source: aString + environment: anEnvironment. + + ^ self new + evaluate: aString + cue: cue + ifFail: [^ nil] + logged: aBoolean! Item was added: + ----- Method: Compiler>>compile:ifFail: (in category 'public access') ----- + compile: aCue ifFail: failBlock + "Answer a MethodNode. If the MethodNode can not be created, notify + the requestor in the contxt. If the requestor is nil, evaluate failBlock + instead. The MethodNode is the root of a parse tree. It can be told + to generate a CompiledMethod to be installed in the method dictionary + of the class specified by the context." + + self setCue: aCue. + self source: cue source. + ^self + translate: sourceStream + noPattern: false + ifFail: failBlock! Item was added: + ----- Method: Compiler>>evaluate:cue:ifFail:logged: (in category 'public access') ----- + evaluate: textOrStream cue: aCue ifFail: failBlock logged: logFlag + "Compiles the sourceStream into a parse tree, then generates code into + a method. Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method + litter on errors." + + | methodNode method value toLog itsSelection itsSelectionString | + self setCue: aCue. + self source: textOrStream. + methodNode := self translate: sourceStream noPattern: true ifFail: [^failBlock value]. + + method := self interactive + ifTrue: [methodNode generateWithTempNames] + ifFalse: [methodNode generate]. + + value := cue receiver + withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}]) + executeMethod: method. + + logFlag ifTrue: + [toLog := ((cue requestor respondsTo: #selection) + and:[(itsSelection := cue requestor selection) notNil + and:[(itsSelectionString := itsSelection asString) isEmptyOrNil not]]) + ifTrue:[itsSelectionString] + ifFalse:[sourceStream contents]. + SystemChangeNotifier uniqueInstance evaluated: toLog context: cue context]. + ^ value + ! Item was added: + ----- Method: Compiler>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Set legacy instance variables for methods that don't use cue yet." + requestor := cue requestor. + class := cue getClass. + category := cue category. + context := cue context.! Item was added: + ----- Method: Compiler>>source: (in category 'private') ----- + source: textOrStream + sourceStream := (textOrStream isKindOf: PositionableStream) + ifTrue: [ textOrStream ] + ifFalse: [ ReadStream on: textOrStream asString ]! Item was added: + ----- Method: Dictionary>>bindingOf:ifAbsent: (in category '*Compiler') ----- + bindingOf: varName ifAbsent: aBlock + + ^self associationAt: varName ifAbsent: aBlock! Item was changed: ParseNode subclass: #Encoder + instanceVariableNames: 'scopeTable nTemps supered requestor class selector literalStream selectorSet litIndSet litSet sourceRanges globalSourceRanges addedSelectorAndMethodClassLiterals optimizedSelectors cue' - instanceVariableNames: 'scopeTable nTemps supered requestor class selector literalStream selectorSet litIndSet litSet sourceRanges globalSourceRanges addedSelectorAndMethodClassLiterals optimizedSelectors' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Encoder commentStamp: 'cwp 12/26/2012 23:29' prior: 0! - !Encoder commentStamp: '<historical>' prior: 0! I encode names and literals into tree nodes with byte codes for the compiler. Byte codes for literals are not assigned until the tree-sizing pass of the compiler, because only then is it known which literals are actually needed. I also keep track of sourceCode ranges during parsing and code generation so I can provide an inverse map for the debugger.! Item was added: + ----- Method: Encoder>>init:notifying: (in category 'initialize-release') ----- + init: aCue notifying: anObject + "The use of the variable requestor is a bit confusing here. This is + *not* the original requestor, which is available through the cue. + It's the Parser instance that is using the encoder." + + self setCue: aCue. + requestor := anObject. + nTemps := 0. + supered := false. + self initScopeAndLiteralTables. + cue getClass variablesAndOffsetsDo: + [:variable "<String|CFieldDefinition>" :offset "<Integer|nil>" | + offset isNil + ifTrue: [scopeTable at: variable name put: (FieldNode new fieldDefinition: variable)] + ifFalse: [scopeTable + at: variable + put: (offset >= 0 + ifTrue: [InstanceVariableNode new + name: variable index: offset] + ifFalse: [MaybeContextInstanceVariableNode new + name: variable index: offset negated])]]. + cue context ~~ nil ifTrue: + [| homeNode | + homeNode := self bindTemp: self doItInContextName. + "0th temp = aContext passed as arg" + cue context tempNames withIndexDo: + [:variable :index| + scopeTable + at: variable + put: (MessageAsTempNode new + receiver: homeNode + selector: #namedTempAt: + arguments: (Array with: (self encodeLiteral: index)) + precedence: 3 + from: self)]]. + sourceRanges := Dictionary new: 32. + globalSourceRanges := OrderedCollection new: 32 + ! Item was added: + ----- Method: Encoder>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Also set legacy instance variables for methods that + don't use cue yet" + class := cue getClass.! Item was changed: Scanner subclass: #Parser + instanceVariableNames: 'here hereType hereMark hereEnd prevMark prevEnd encoder requestor parseNode failBlock requestorOffset tempsMark doitFlag properties category queriedUnusedTemporaries cue' - instanceVariableNames: 'here hereType hereMark hereEnd prevMark prevEnd encoder requestor parseNode failBlock requestorOffset tempsMark doitFlag properties category queriedUnusedTemporaries' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! + !Parser commentStamp: 'cwp 12/26/2012 23:34' prior: 0! - !Parser commentStamp: '<historical>' prior: 0! I parse Smalltalk syntax and create a MethodNode that is the root of the parse tree. I look one token ahead.! Item was added: + ----- Method: Parser>>init:cue:failBlock: (in category 'private') ----- + init: sourceStream cue: aCue failBlock: aBlock + + self setCue: aCue. + failBlock := aBlock. + requestorOffset := 0. + super scan: sourceStream. + prevMark := hereMark := mark. + self advance + ! Item was added: + ----- Method: Parser>>parse:cue:noPattern:ifFail: (in category 'public access') ----- + parse: sourceStream cue: aCue noPattern: noPattern ifFail: aBlock + "Answer a MethodNode for the argument, sourceStream, that is the root of + a parse tree. Parsing is done with respect to the CompilationCue to + resolve variables. Errors in parsing are reported to the cue's requestor; + otherwise aBlock is evaluated. The argument noPattern is a Boolean that is + true if the the sourceStream does not contain a method header (i.e., for DoIts)." + + | methNode repeatNeeded myStream s p subSelection | + myStream := sourceStream. + [repeatNeeded := false. + p := myStream position. + s := myStream upToEnd. + myStream position: p. + subSelection := aCue requestor notNil and: [aCue requestor selectionInterval = (p + 1 to: p + s size)]. + self encoder init: aCue notifying: self. + self init: myStream cue: aCue failBlock: [^ aBlock value]. + doitFlag := noPattern. + failBlock:= aBlock. + [methNode := self method: noPattern context: cue context] + on: ReparseAfterSourceEditing + do: [ :ex | + repeatNeeded := true. + myStream := subSelection + ifTrue: + [ReadStream + on: cue requestor text string + from: cue requestor selectionInterval first + to: cue requestor selectionInterval last] + ifFalse: + [ReadStream on: cue requestor text string]]. + repeatNeeded] whileTrue: + [encoder := self encoder class new]. + methNode sourceText: s. + ^methNode + ! Item was added: + ----- Method: Parser>>setCue: (in category 'private') ----- + setCue: aCue + cue := aCue. + + "Also set legacy variables for methods that don't use cue yet." + requestor := cue requestor. + category := cue category.!
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Results per page:
10
25
50
100
200