Cface__TypeCollector.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 10 Jul 2008 20:56:08 +0000
changeset 6 ae25dce94003
parent 5 c110eef5b9ef
child 14 1f730d82496e
permissions -rw-r--r--
Added SVNMapping. Now it is able to parse libsvn.def

"{ Package: 'cvut:fel/cface' }"

"{ NameSpace: Cface }"

CNodeVisitor subclass:#TypeCollector
	instanceVariableNames:'typeMap'
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-Visitors'
!

!TypeCollector class methodsFor:'documentation'!

history

    "Created: / 12-11-2007 / 08:41:12 / haja"
    "Created: #typeMap / 12-11-2007 / 08:43:31 / haja"
    "Created: #typeMap: / 12-11-2007 / 08:43:31 / haja"
    "Created: #parseTree / 12-11-2007 / 08:43:31 / haja"
    "Created: #parseTree: / 12-11-2007 / 08:43:31 / haja"
    "Created: #visitSequenceableCollection:with: / 12-11-2007 / 08:44:18 / haja"
    "Created: #visitConstNode: / 12-11-2007 / 08:44:23 / haja"
    "Created: #visitArrayNode: / 12-11-2007 / 08:44:23 / haja"
    "Created: #visitEnumFieldNode: / 12-11-2007 / 08:44:23 / haja"
    "Created: #visitEnumNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitFileNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitFunctionNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitPointerNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitStructFieldNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitStructNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitTypeDefNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitUnionFieldNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitUnionNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitParseTree: / 12-11-2007 / 08:44:24 / haja"
    "Created: #visitIdNode: / 12-11-2007 / 08:44:24 / haja"
    "Created: #initialize / 12-11-2007 / 08:45:48 / haja"
    "Created: #new / 12-11-2007 / 08:45:48 / haja"
    "Created: #on: / 12-11-2007 / 08:46:02 / haja"
    "Created: #find: / 12-11-2007 / 09:08:54 / haja"
    "Modified: #find: / 19-11-2007 / 09:48:44 / haja"
! !

!TypeCollector class methodsFor:'instance creation'!

new
    ^ self basicNew initialize.

    "Created: / 12-11-2007 / 08:45:48 / haja"
! !

!TypeCollector methodsFor:'accessing'!

typeMap
    ^ typeMap

    "Created: / 12-02-2008 / 23:43:44 / janfrog"
! !

!TypeCollector methodsFor:'initialization'!

initialize

    super initialize.
    typeMap := Dictionary new

    "Created: / 12-02-2008 / 22:55:40 / janfrog"
! !

!TypeCollector methodsFor:'visiting'!

visitCDerivedTypeNode: node

    | oldNode |
    oldNode := typeMap at: node cName ifAbsent:nil.
    oldNode
        ifNil:
            [typeMap at: node cName put: node]
        ifNotNil:
            [node isForeign ifFalse:
                [typeMap at: node cName put: node]]

    "Created: / 09-07-2008 / 20:46:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCEnumNode: anObject

    self visitCDerivedTypeNode: anObject

    "Created: / 12-02-2008 / 23:44:04 / janfrog"
    "Modified: / 04-07-2008 / 15:02:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCStructNode: anObject

    self visitCDerivedTypeNode: anObject

    "Created: / 12-02-2008 / 23:44:14 / janfrog"
    "Modified: / 04-07-2008 / 15:02:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCTypedefNode: node

    | oldNode |
    node cName = node type cName ifTrue:[^self].
    oldNode := typeMap at: node cName ifAbsent:nil.
    oldNode
        ifNil:
            [typeMap at: node cName put: node type]
        ifNotNil:
            [node isForeign ifFalse:
                    [typeMap at: node cName put: node type]]

    "Created: / 12-02-2008 / 22:55:53 / janfrog"
    "Modified: / 10-07-2008 / 20:10:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCUnionNode: anObject

    self visitCDerivedTypeNode: anObject

    "Created: / 12-02-2008 / 23:44:09 / janfrog"
    "Modified: / 04-07-2008 / 15:02:40 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!TypeCollector class methodsFor:'documentation'!

version
    ^ '$Header: /opt/data/cvs/cvut-fel/cface/Cface__TypeCollector.st,v 1.1 2008/02/26 18:25:29 vranyj1 Exp $'
! !