Source

pynie / src / classes / pynietype.pir

.sub '' :anon :init
    # setup type Class
    $P0 = newclass [ 'type' ]
    addattribute $P0, '_class'

    # XXX there should be a type object wrapping the type class
.end

.namespace [ 'type' ]

.sub 'make_type_object'
    .param pmc _class

    .local pmc init_args
    init_args = new 'Hash'
    init_args['_class'] = _class

    $P1 = new [ 'type' ], init_args

    .return ($P1)
.end

.sub 'wrap_class'
    .param string name
    .param pmc _class
    
    .local pmc make_type_object
    make_type_object = get_global 'make_type_object'
    $P0 = make_type_object(_class)
    
    set_hll_global name, $P0
.end

.sub 'invoke' :vtable
    .param pmc args :slurpy
    .param pmc kwargs :named :slurpy

    $P0 = getattribute self, '_class'
    # XXX $P1 should be an instance of self
    $P1 = new $P0

    $I0 = can $P1, '__init__'
    unless $I0 goto done
    $P1.'__init__'(args :flat, kwargs :flat)

done:
    .return ($P1)
.end

.sub 'get_string' :vtable
    $P0 = getattribute self, '_class'
    $S0 = $P0.'name'()

    $S1 = "<class '"
    $S1 .= $S0
    $S1 .= "'>"

    .return ($S1)
.end

.namespace []
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.