示例#1
0
def spawnTempVar( bp=None ):
	global tempcount;
	if len( useables ) == 0:
		if bp:
			r = ASTObject( "var" );
			r._data = bp._data.copy();
			r.istemp = True;
			r.name = "_temp#"+str(tempcount);
		else:
			r = ASTObject( "var" , name= "_temp#"+str(tempcount) ,
				 		   istemp = True );
		tempcount += 1;
	else:
		r = useables.pop();
		if bp:
			c = bp._data.copy();
			c["istemp"] = True;
			c["name"] = r.name;
			r._data = c;
	pushCode( "@load" , copy( r ) );
	return r;
示例#2
0
def copy( ast ):
	r = ASTObject( ast.type );
	r._data = ast._data.copy();
	return r;