Bug 43541

GemStone/S 64 Bit

3.3.5, 3.3.4, 3.3.3, 3.3.1, 3.3, 3.2.16, 3.2.15, 3.2.14, 3.2.13, 3.2.12, 3.2.11, 3.2.10, 3.2.9, 3.2.8.1, 3.2.8, 3.2.7, 3.2.6, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2, 3.1.0.6, 3.1.0.5, 3.1.0.4, 3.1.0.3, 3.1.0.2, 3.1.0.1, 3.1, 3.0.1, 3.0

All Platforms

3.4

Pragmas not currently functional in base product without Seaside

While pragmas are compiled properly, they require additional support provided
by the Seaside framework to be fully functional.  Attempts to retrieve
pragmas using only the base product will always return nil.

Workaround

The following code provides basic support for pragmas.  Read the comments
for details.  File-in as SystemUser and commit.

! Special code for compiling and accessing Pragmas 
! until feature request 43541 is implemented.
!
! Note that this establishes an IdentityDictionary in Globals
! for holding the pragmas.  The eventual implementation of pragmas
! in the product is likely to use a different mechanism requiring
! that all code with pragmas be recompiled.
!

! Install the PragmaDictionary.
!
! This dictionary contains classes as keys and IdentityDictionaries
! as values.  The secondary IdentityDictionaries contain method selector
! symbols as keys and the associated pragmas as values.
!
run
Globals at: #PragmaDictionary put: IdentityDictionary new.
%


category: 'Updating the Method Dictionary'
method: Behavior
compileMethodWithPragmas: sourceString
category: categoryString

"Compiles sourceString and records any pragmas in PragmaDictionary."

  | pragmas meth pclass |
  pragmas := Array new.
  meth := 
     self compileMethod: sourceString
          dictionaries: System myUserProfile symbolList
          category: categoryString asSymbol
          intoMethodDict: nil
          intoCategories: nil
          intoPragmas: pragmas
          environmentId: 0.
  (pragmas size) > 0 ifTrue: [
    pclass := PragmaDictionary at: self ifAbsent: [ nil ].
    pclass ifNil: [ 
      pclass := IdentityDictionary new. 
      PragmaDictionary at: self put: pclass ].
    pclass at: meth selector put: pragmas ].
  ^ meth
%

category: 'Pragmas'
method: GsNMethod
myPragmas

  "Returns the pragmas associated with this method."

  | pclass |
  pclass := PragmaDictionary at: self inClass ifAbsent: [ ^nil ].
  ^pclass at: self selector ifAbsent: [ nil ].
%

category: 'Pragmas'
method: GsMethod
myPragmas

  "Returns the pragmas associated with this method."

  | pclass |
  pclass := PragmaDictionary at: self inClass ifAbsent: [ ^nil ].
  ^pclass at: self selector ifAbsent: [ nil ].
%


Last updated: 4/9/14