File: VariableDeclaration.h

package info (click to toggle)
guavac 1.2-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,728 kB
  • ctags: 2,387
  • sloc: cpp: 20,367; yacc: 1,664; makefile: 504; lex: 348; ansic: 286; sh: 263
file content (52 lines) | stat: -rw-r--r-- 1,694 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
// Copyright (c) 1995  David Engberg  All rights reserved
// $Id: VariableDeclaration.h,v 1.6 1997/08/21 16:30:12 geppetto Exp $
#ifndef _VariableDeclaration_h
#define _VariableDeclaration_h

#include "unicode_string.h"
#include "JavaFieldSignature.h"
class CExpression;
class CCodeSequence;
class CCompileError;
class CJavaMethodInfo;
class CJavaClassFile;
class CCompiler;
class CJavaAccessFlags;
class CCompileContext;

//
//  Class name : CVariableDeclaration
//  Description : This class is used as the intermediate representation of
//    a field or variable declaration in Java source, including the
//    initializer.  This value is either a straightforward expression or
//    a CArrayInitializer, which allows shorthand initialization of arrays.
//
class CVariableDeclaration {
public:
  CVariableDeclaration();
  CVariableDeclaration(const CJavaTypeSignature& type,
		       const unicode_string& name,
		       CExpression* adoptInitializer = 0,
		       bool final = false);
  CVariableDeclaration(const CVariableDeclaration& source);
  ~CVariableDeclaration();

  CJavaTypeSignature GetType() const;
  void SetType(const CJavaTypeSignature& type);
  const CJavaFieldSignature& GetSignature() const { return fSignature; }
  unicode_string GetName() const;
  virtual CCompileError* GenerateCode(CCodeSequence& code,
		 CCompileContext& context, const CJavaAccessFlags& modifiers,
	         unsigned short& stackUsed);
  CCompileError* GetConstantValue(CExpression*& intoPointer,
				  CCompileContext& context);
  bool IsFinal() const { return fFinal; }
  void SetFinal(bool final);

private:
  CJavaFieldSignature fSignature;
  CExpression* fInitializer;
  bool fFinal;
};

#endif