PrimaryNode.st
author Jan Vrany <jan.vrany@labware.com>
Thu, 27 Oct 2022 14:53:59 +0100
branchjv
changeset 4735 3b11fb3ede98
parent 4730 2e7755434a0f
permissions -rw-r--r--
Allow single underscore as method / block argument and temporaries This commit is a follow up for 38b221e.

"
 COPYRIGHT (c) 1989 by Claus Gittinger
 COPYRIGHT (c) 2021 Patrik Svestka
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libcomp' }"

"{ NameSpace: Smalltalk }"

ParseNode subclass:#PrimaryNode
	instanceVariableNames:'value line charIndex'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler-Support'
!

!PrimaryNode class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1989 by Claus Gittinger
 COPYRIGHT (c) 2021 Patrik Svestka
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    node for parse-trees, representing primaries (variables & literals)
    This is a helper class for the compiler.

    [author:]
        Claus Gittinger
"
! !

!PrimaryNode methodsFor:'accessing'!

charIndex
    <resource: #obsolete>
    ^ charIndex
!

charIndex:something
    <resource: #obsolete>
    charIndex := something.
!

line
    ^ line
!

line:something
    line := something.
!

lineNumber

    "Compatibility"

    ^ self line

    "Created: / 24-11-2021 / 10:02:30 / Patrik Svestka <patrik.svestka@gmail.com>"
!

type:t value:val
    type := t.
    value := val
!

value
    ^ value
!

value:val
    value := val
! !

!PrimaryNode methodsFor:'code generation'!

codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler
    ^ self subclassResponsibility
! !

!PrimaryNode methodsFor:'enumeration'!

allSubNodesDo:aBlock
    "no subnodes"

    ^ self
! !

!PrimaryNode methodsFor:'evaluation'!

store:aValue
    ^ self subclassResponsibility
! !

!PrimaryNode methodsFor:'printing & storing'!

printOn:aStream indent:i
    ^ self subclassResponsibility
! !

!PrimaryNode methodsFor:'queries'!

precedence
    ^ 200

    "Created: / 20-04-2005 / 14:12:04 / cg"
! !

!PrimaryNode methodsFor:'testing'!

isArgument
    ^ false
!

isBlockArg
    "return false here; to be redefined in subclass(es)"

    ^ false
!

isBlockVariable
    "return false here; to be redefined in subclass(es)"

    ^ false
!

isClassVariable
    ^ false
!

isInstanceVariable
    ^ false
!

isInstanceVariableNamed:name
    ^ false
!

isLocal
    ^ false
!

isMethodArg
    ^ false
!

isPoolVariable
    "return false here; to be redefined in subclass(es)"

    ^ false
!

isPrimary
    "return true, if this is a node for a primary (i.e. non-send)"

    ^ true
!

isUndeclared
    ^ false
! !

!PrimaryNode class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$ Id $'
! !