eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ReturnNode':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ReturnNode


Inheritance:

   Object
   |
   +--ParseNode
      |
      +--StatementNode
         |
         +--ReturnNode
            |
            +--JavaScriptParser::JavaScriptReturnNode

Package:
stx:libcomp
Category:
System-Compiler-Support
Version:
rev: 1.51 date: 2023/06/04 09:30:13
user: cg
file: ReturnNode.st directory: libcomp
module: stx stc-classLibrary: libcomp

Description:


node for parse-trees, representing return expressions
This is a helper class for the compiler.

copyright

COPYRIGHT (c) 1989 by Claus Gittinger 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.

Instance protocol:

accessing
o  expression: e
any block, which is returned cannot be inlined.

o  home

o  home: someOne blockHome: aBlockNode

o  lineNumber: something
set lineNr

checks
o  plausibilityCheckIn: aParser
check for return-in-return, as in
^ foo ifTrue:[ ^x]
that is (currently) not compilable by stc (generates bad C-code for it).
TODO: rewite to use lint/lint rules and apply them before accepting

code generation
o  basicCodeOn: aStream inBlock: b for: aCompiler
Transcript showCR:'====> %1 [%2]' with:lineNr with:expression printString.

o  codeForSideEffectOn: aStream inBlock: b for: aCompiler
redefined - drop not needed since notreached

o  codeForSimpleReturnOn: aStream inBlock: b lineNumber: lineNrOrNil for: aCompiler
generate code to return myself as a simple method return

o  codeLocalReturnOn: aStream inBlock: b for: aCompiler

o  codeOn: aStream inBlock: b for: aCompiler
aCompiler parserFlags allowPossibleSTCCompilationProblems ifFalse:[

enumerating
o  nodeDo: anEnumerator
helper for parse tree walking

enumeration
o  childrenDo: aBlock

evaluation
o  evaluateExpressionIn: anEnvironment
when we arrive here, the parser context is already gone
- try block-return

printing & storing
o  printOn: aStream indent: i

queries
o  isJavaScriptReturnNode

o  isReturnNode

o  isSimpleConstant

o  isSimpleExpression

o  isSimpleVariable

visiting
o  acceptVisitor: aVisitor
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 22 Dec 2024 01:31:44 GMT