compiler/PPCMessagePredicateNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 15 Apr 2015 11:28:09 +0100
changeset 422 116d2b2af905
parent 421 7e08b31e0dae
child 438 20598d7ce9fa
permissions -rw-r--r--
To fold

"{ Package: 'stx:goodies/petitparser/compiler' }"

"{ NameSpace: Smalltalk }"

PPCAbstractPredicateNode subclass:#PPCMessagePredicateNode
	instanceVariableNames:'message'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!

!PPCMessagePredicateNode methodsFor:'accessing'!

asInlined
	^ PPCInlineMessagePredicateNode new
		message: message;
		predicate: predicate;
		name: name;
		yourself
!

message
	
	^ message
!

message: anObject
	
	message := anObject
! !

!PPCMessagePredicateNode methodsFor:'as yet unclassified'!

bodyOfPredicate: compiler
	compiler addOnLine: '(context peek ', self message, ')'.
	compiler indent.
	compiler add: 'ifFalse: [ self error: ''predicate not found'' ]'.
	compiler add: 'ifTrue: [ context next ].'.
	compiler dedent.
! !

!PPCMessagePredicateNode methodsFor:'comparing'!

= anotherNode
	super = anotherNode ifFalse: [ ^ false ].
	^ message = anotherNode message.
!

hash
	^ super hash bitXor: message hash
! !