A new version of Environments was added to project The Inbox:
http://source.squeak.org/inbox/Environments-cwp.43.mcz ==================== Summary ==================== Name: Environments-cwp.43 Author: cwp Time: 1 January 2014, 1:27:27.436 pm UUID: 3ccd33e2-0400-405d-b213-fc170cf0a3e6 Ancestors: Environments-cwp.42 Rewrite import/export to be eager, rather than lazy. (step 1 of 3) =============== Diff against Environments-cwp.42 =============== Item was removed: - ----- Method: BindingPolicy class>>namespace: (in category 'create') ----- - namespace: aDictionary - ^ self namespace: aDictionary next: nil! Item was removed: - ----- Method: BindingPolicy class>>namespace:next: (in category 'create') ----- - namespace: aDictionary next: anImport - ^ self - namespace: aDictionary - policy: AllNamePolicy new - next: anImport! Item was removed: - ----- Method: BindingPolicy class>>namespace:policy: (in category 'create') ----- - namespace: aDictionary policy: aNamePolicy - ^ self - namespace: aDictionary - policy: aNamePolicy - next: nil! Item was removed: - ----- Method: BindingPolicy class>>namespace:policy:next: (in category 'create') ----- - namespace: aDictionary policy: aNamePolicy next: anImport - ^ self new - initializeWithNamespace: aDictionary - policy: aNamePolicy - next: anImport! Item was removed: - ----- Method: BindingPolicy class>>null (in category 'create') ----- - null - ^ self namespace: IdentityDictionary new! Item was removed: - ----- Method: BindingPolicy>>forgetName: (in category 'private') ----- - forgetName: aSymbol - self name: aSymbol do: [:foreign | - namespace removeKey: foreign ifAbsent: [ - next ifNotNil: [next forgetName: aSymbol]]].! Item was removed: - ----- Method: BindingPolicy>>initializeWithNamespace:policy:next: (in category 'initialize-release') ----- - initializeWithNamespace: aDictionary policy: aNamePolicy next: anImport - namespace := aDictionary. - policy := aNamePolicy. - next := anImport! Item was changed: Object subclass: #Environment + instanceVariableNames: 'info declarations bindings undeclared policies observers' - instanceVariableNames: 'info imports exports declarations references public undeclared bindings policies observers' classVariableNames: 'Default Instances' poolDictionaries: '' category: 'Environments-Core'! !Environment commentStamp: 'cmm 12/20/2013 14:10' prior: 0! I am a context for compiling methods. I maintain the namespace of classes and global variables that are visible to the methods compiled within me. I have the following instance variables: info <EnvironmentInfo> Metadata about me and the code I contain. imports <Import> Rules for importing globals from other environments. exports <Export> Rules for exposing globals to other environments. declarations <IdentityDictionary> Bindings for globals that have been declared inside me. references <IdentityDictionary> Bindings for globals that are used by methods compiled inside me. public <IdentityDictionary> Bindings for classes that have been declared inside me, and which satisfy the export rules contain in 'exports'. undeclared <Dictionary> Bindings for globals that are used by methods compiled inside me, but which aren't present in 'references' and couldn't be found via the rules in 'imports'.! Item was removed: - ----- Method: Environment>>migrate (in category 'initialize-release') ----- - migrate - | newDeclarations source dest index policy | - bindings := IdentityDictionary new. - newDeclarations := IdentityDictionary new. - source := Array new: declarations size. - dest := Array new: declarations size. - index := 1. - declarations associationsDo: - [:ea || binding | - binding := ea key => ea value. - source at: index put: ea. - dest at: index put: binding. - newDeclarations add: binding. - bindings add: binding. - index := index + 1]. - declarations := newDeclarations. - source elementsForwardIdentityTo: dest. - - policy := BindingPolicy - environment: self - policy: AllNamePolicy new - addSelector: #showBinding: - removeSelector: #hideBinding:. - policies := Array with: policy. - - observers := IdentitySet new.. - ! Item was removed: - ----- Method: Environment>>public (in category 'accessing') ----- - public - ^ public! Item was removed: - ----- Method: Environment>>publicizeContents (in category 'private') ----- - publicizeContents - declarations associationsDo: [:binding | exports bind: binding]. - ! Item was removed: - ----- Method: Environment>>rebindUndeclared (in category 'private') ----- - rebindUndeclared - undeclared keys do: - [:name | - (imports valueOf: name) ifNotNil: - [:v | - references declare: name from: undeclared. - references at: name put: v]]! Item was removed: - BindingPolicy subclass: #Export - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Environments-Policies'! Item was removed: - ----- Method: Export>>bind: (in category 'binding') ----- - bind: aBinding - - self name: aBinding key do: - [:foreign | ^ namespace add: (aBinding asBinding: foreign)]. - ^ next ifNotNil: [next bind: aBinding]! Item was removed: - ----- Method: Export>>bind:to: (in category 'binding') ----- - bind: aSymbol to: anObject - ^ self bind: aSymbol -> anObject! Item was removed: - BindingPolicy subclass: #Import - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Environments-Policies'! Item was removed: - ----- Method: Import>>bindingOf: (in category 'binding') ----- - bindingOf: aSymbol - self name: aSymbol do: - [:foreign | - ^ namespace - associationAt: foreign - ifAbsent: [next ifNotNil: [next bindingOf: aSymbol]]]. - ^ next ifNotNil: [next bindingOf: aSymbol]! Item was removed: - ----- Method: Import>>valueOf: (in category 'binding') ----- - valueOf: aSymbol - ^ (self bindingOf: aSymbol) value! Item was added: + (PackageInfo named: 'Environments') postscript: '"Recompile all methods to fix errant bindings" + Compiler recompileAll. + '! |
Free forum by Nabble | Edit this page |