PrimNd.st
changeset 140 1ef1d1395146
parent 135 aa4f7b8f121e
child 148 ef0e604209ec
equal deleted inserted replaced
139:65eaf1a009f5 140:1ef1d1395146
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 StatementNode subclass:#PrimitiveNode
    13 StatementNode subclass:#PrimitiveNode
    14        instanceVariableNames:'code primNumber optional'
    14 	 instanceVariableNames:'code primNumber optional'
    15        classVariableNames:''
    15 	 classVariableNames:''
    16        poolDictionaries:''
    16 	 poolDictionaries:''
    17        category:'System-Compiler-Support'
    17 	 category:'System-Compiler-Support'
    18 !
    18 !
    19 
    19 
    20 !PrimitiveNode class methodsFor:'documentation'!
    20 !PrimitiveNode class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
    29  inclusion of the above copyright notice.   This software may not
    29  inclusion of the above copyright notice.   This software may not
    30  be provided or otherwise made available to, or used by, any
    30  be provided or otherwise made available to, or used by, any
    31  other person.  No title to or ownership of the software is
    31  other person.  No title to or ownership of the software is
    32  hereby transferred.
    32  hereby transferred.
    33 "
    33 "
    34 !
       
    35 
       
    36 version
       
    37     ^ '$Header: /cvs/stx/stx/libcomp/Attic/PrimNd.st,v 1.11 1995-11-11 15:31:26 cg Exp $'
       
    38 !
    34 !
    39 
    35 
    40 documentation
    36 documentation
    41 "
    37 "
    42     node for parse-trees, representing primitive code
    38     node for parse-trees, representing primitive code
    53     To allow autoloaded/filedIn code to be written for best performance, an optional
    49     To allow autoloaded/filedIn code to be written for best performance, an optional
    54     primitive directive (in the primitives first lines comment) may specify an
    50     primitive directive (in the primitives first lines comment) may specify an
    55     optional primitive; these are compiled on systems which do support binary code
    51     optional primitive; these are compiled on systems which do support binary code
    56     loading, and ignored completely on others.
    52     loading, and ignored completely on others.
    57 "
    53 "
       
    54 !
       
    55 
       
    56 version
       
    57     ^ '$Header: /cvs/stx/stx/libcomp/Attic/PrimNd.st,v 1.12 1995-11-23 02:14:23 cg Exp $'
    58 ! !
    58 ! !
    59 
    59 
    60 !PrimitiveNode class methodsFor:'instance creation'!
    60 !PrimitiveNode class methodsFor:'instance creation'!
    61 
    61 
    62 code:aString
    62 code:aString
    63     ^ self basicNew code:aString
    63     ^ self basicNew code:aString
    64 !
    64 !
    65 
    65 
    66 primitiveNumber:anInteger
    66 primitiveNumber:anInteger
    67     ^ self basicNew primitiveNumber:anInteger
    67     ^ self basicNew primitiveNumber:anInteger
    68 ! !
       
    69 
       
    70 !PrimitiveNode methodsFor:'queries'!
       
    71 
       
    72 isConstant
       
    73     ^ false
       
    74 !
       
    75 
       
    76 isOptional
       
    77     ^ optional
       
    78 ! !
    68 ! !
    79 
    69 
    80 !PrimitiveNode methodsFor:'accessing'!
    70 !PrimitiveNode methodsFor:'accessing'!
    81 
    71 
    82 code:aString
    72 code:aString
   102 primitiveNumber:anInteger 
    92 primitiveNumber:anInteger 
   103     optional := false.
    93     optional := false.
   104     primNumber := anInteger
    94     primNumber := anInteger
   105 ! !
    95 ! !
   106 
    96 
   107 !PrimitiveNode methodsFor:'evaluating'!
       
   108 
       
   109 evaluateExpression
       
   110     "catch evaluation"
       
   111 
       
   112     optional ifTrue:[^ nil].
       
   113     self error:'cannot evaluate primitives'
       
   114 !
       
   115 
       
   116 evaluate
       
   117     "catch evaluation"
       
   118 
       
   119     optional ifTrue:[^ nil].
       
   120     self error:'cannot evaluate primitives'
       
   121 ! !
       
   122 
       
   123 !PrimitiveNode methodsFor:'code generation'!
    97 !PrimitiveNode methodsFor:'code generation'!
   124 
    98 
   125 codeForSideEffectOn:aStream inBlock:b for:aCompiler
    99 codeForSideEffectOn:aStream inBlock:b for:aCompiler
   126     "catch code generation"
   100     "catch code generation"
   127 
   101 
   133     "catch code generation"
   107     "catch code generation"
   134 
   108 
   135     optional ifTrue:[^ self].
   109     optional ifTrue:[^ self].
   136     self error:'cannot compile primitives (as yet)'
   110     self error:'cannot compile primitives (as yet)'
   137 ! !
   111 ! !
       
   112 
       
   113 !PrimitiveNode methodsFor:'evaluating'!
       
   114 
       
   115 evaluate
       
   116     "catch evaluation"
       
   117 
       
   118     optional ifTrue:[^ nil].
       
   119     self error:'cannot evaluate primitives'
       
   120 !
       
   121 
       
   122 evaluateExpression
       
   123     "catch evaluation"
       
   124 
       
   125     optional ifTrue:[^ nil].
       
   126     self error:'cannot evaluate primitives'
       
   127 ! !
       
   128 
       
   129 !PrimitiveNode methodsFor:'queries'!
       
   130 
       
   131 isConstant
       
   132     ^ false
       
   133 !
       
   134 
       
   135 isOptional
       
   136     ^ optional
       
   137 ! !
       
   138