File: functiondefined.cc

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (33 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#define XERR
#include "symtab.ih"

SemVal Symtab::functionDefined(SemVal &statements)
{
    SemVal function = makeFrame();

// statements.bytes();

    statements.patchFalse(SemVal::END);

// xerr("patched false:");
// statements.bytes();

    function << statements;

    if (not SemVal::returns())
    {
        if (d_functions.isMain())
            function << Opcode::push_0 << Opcode::pop_reg;
        else if (d_functions.type() != e_void)
            Error::msg(Error::RETURN_TYPE) << d_functions.name() << "'\n";

        function << Opcode::ret;
    }

    d_var.resize(1);                // only keep the global variables
                                    // (i.e., nestLevel == 0)

    // reactivate semantic errors, see pendfunction.c

    return function;
}