mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 13:20:19 +01:00 
			
		
		
		
	o sets of enums are handled as JUEnumSet instances, others as JUBitSet
     derivatives (both smallsets and varsets, to make interoperability with
     Java easier)
   o special handling of set constants: these have to be constructed at run
     time. In case of constants in the code, create an internal constsym to
     represent them. These and regular constsyms are then aliased by an
     another internal staticvarsym that is used to initialise them in the
     unit initialisation code.
   o until they are constructed at run time, set constants are encoded as
     constant Java strings (with the characters containing the set bits)
   o hlcgobj conversion of tcginnode.pass_generate_code() for the genjumps
     part (that's the only part of the generic code that's used by the JVM
     target)
   o as far as explicit typecasting support is concerned, currently the
     following ones are supported (both from/to setdefs): ordinal types,
     enums, any other set types (whose size is the same on native targets)
   o enum setdefs also emit signatures
   o overloading routines for different ordinal set types, or for different
     enum set types, is not supported on the JVM target
git-svn-id: branches/jvmbackend@18662 -
		
	
			
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
{
 | 
						|
    Copyright (c) 2011 by Jonas Maebe
 | 
						|
 | 
						|
    Generates nodes for typed constant declarations
 | 
						|
 | 
						|
    This program is free software; you can redistribute it and/or modify
 | 
						|
    it under the terms of the GNU General Public License as published by
 | 
						|
    the Free Software Foundation; either version 2 of the License, or
 | 
						|
    (at your option) any later version.
 | 
						|
 | 
						|
    This program is distributed in the hope that it will be useful,
 | 
						|
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						|
    GNU General Public License for more details.
 | 
						|
 | 
						|
    You should have received a copy of the GNU General Public License
 | 
						|
    along with this program; if not, write to the Free Software
 | 
						|
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
						|
 | 
						|
 ****************************************************************************
 | 
						|
}
 | 
						|
unit njvmtcon;
 | 
						|
 | 
						|
{$i fpcdefs.inc}
 | 
						|
 | 
						|
interface
 | 
						|
 | 
						|
    uses
 | 
						|
      node,
 | 
						|
      symdef,
 | 
						|
      ngtcon;
 | 
						|
 | 
						|
 | 
						|
    type
 | 
						|
      tjvmtypedconstbuilder = class(tnodetreetypedconstbuilder)
 | 
						|
       protected
 | 
						|
        procedure tc_emit_setdef(def: tsetdef; var node: tnode);override;
 | 
						|
      end;
 | 
						|
 | 
						|
implementation
 | 
						|
 | 
						|
    uses
 | 
						|
      njvmcon;
 | 
						|
 | 
						|
 | 
						|
    procedure tjvmtypedconstbuilder.tc_emit_setdef(def: tsetdef; var node: tnode);
 | 
						|
      begin
 | 
						|
        { indicate that set constant nodes have to be transformed into
 | 
						|
          constructors here }
 | 
						|
        if node.nodetype=setconstn then
 | 
						|
          tjvmsetconstnode(node).setconsttype:=sct_construct;
 | 
						|
        inherited tc_emit_setdef(def,node);
 | 
						|
      end;
 | 
						|
 | 
						|
begin
 | 
						|
  ctypedconstbuilder:=tjvmtypedconstbuilder;
 | 
						|
end.
 |