File: IntermediateFunction.C

package info (click to toggle)
guavac 1.0-5
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 2,716 kB
  • ctags: 2,357
  • sloc: cpp: 19,765; yacc: 1,629; makefile: 492; lex: 348; ansic: 284; sh: 280
file content (57 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 1996  David Engberg  All rights reserved
// $Id: IntermediateFunction.C,v 1.6 1997/11/10 00:48:06 geppetto Exp $
#pragma implementation
#include "IntermediateFunction.h"
#include "Statement.h"

//
//  Method name : CIntermediateFunction
//  Description : Constructs an intermediate function out of its parts.
//
CIntermediateFunction::CIntermediateFunction(
			const CJavaMethodSignature& signature,
			const CJavaAccessFlags& modifiers,
			deque<unicode_string>* adoptThrows,
			unsigned long startLineNumber,
			bool deprecated)
  : fSignature(signature),
    fMaxLocalVariables(0),
    fRealParametersSize(0),
    fSyntheticParametersSize(0),
    fBlock(0),
    fAccessFlags(modifiers),
    fStartLineNumber(startLineNumber),
    fDeprecated(deprecated),
    fMethodInfoAlias(0)
{
  if (adoptThrows != 0) {
    fThrows = *adoptThrows;
    delete adoptThrows;
  }
}

//
//  Method name : ~CIntermediateFunction
//  Description : Destructor
//
CIntermediateFunction::~CIntermediateFunction()
{
  delete fBlock;
}

//
//  Method name : GetLocalVariableLocation
//  Description : The local variable offsets that are originally assigned
//    are later thrown off by the stupid synthetic constructor parameters
//    that need to be inserted to support access to outer final local
//    variables.  As a result, any access to a local variable slot needs
//    to call this to make sure its offset is correct.
//
unsigned short
CIntermediateFunction::GetLocalVariableLocation(unsigned short from) const
{
  if (from >= fRealParametersSize) {
    return from + fSyntheticParametersSize;
  }
  return from;
}