Merge pull request #1221 from wvdschel/patch-1

Cleaned up formatting in gd_compiler.h
This commit is contained in:
Juan Linietsky 2015-01-17 09:43:34 -03:00
commit 8df47f59d5

View File

@ -37,16 +37,11 @@ class GDCompiler {
const GDParser *parser; const GDParser *parser;
struct CodeGen { struct CodeGen {
GDScript *script; GDScript *script;
const GDParser::ClassNode *class_node; const GDParser::ClassNode *class_node;
const GDParser::FunctionNode *function_node; const GDParser::FunctionNode *function_node;
bool debug_stack; bool debug_stack;
List< Map<StringName,int> > stack_id_stack; List< Map<StringName,int> > stack_id_stack;
Map<StringName,int> stack_identifiers; Map<StringName,int> stack_identifiers;
@ -54,12 +49,9 @@ class GDCompiler {
List< Map<StringName,int> > block_identifier_stack; List< Map<StringName,int> > block_identifier_stack;
Map<StringName,int> block_identifiers; Map<StringName,int> block_identifiers;
void add_stack_identifier(const StringName& p_id,int p_stackpos) { void add_stack_identifier(const StringName& p_id,int p_stackpos) {
stack_identifiers[p_id]=p_stackpos; stack_identifiers[p_id]=p_stackpos;
if (debug_stack) { if (debug_stack) {
block_identifiers[p_id]=p_stackpos; block_identifiers[p_id]=p_stackpos;
GDFunction::StackDebug sd; GDFunction::StackDebug sd;
sd.added=true; sd.added=true;
@ -71,7 +63,6 @@ class GDCompiler {
} }
void push_stack_identifiers() { void push_stack_identifiers() {
stack_id_stack.push_back( stack_identifiers ); stack_id_stack.push_back( stack_identifiers );
if (debug_stack) { if (debug_stack) {
@ -81,7 +72,6 @@ class GDCompiler {
} }
void pop_stack_identifiers() { void pop_stack_identifiers() {
stack_identifiers = stack_id_stack.back()->get(); stack_identifiers = stack_id_stack.back()->get();
stack_id_stack.pop_back(); stack_id_stack.pop_back();
@ -98,7 +88,6 @@ class GDCompiler {
block_identifiers=block_identifier_stack.back()->get(); block_identifiers=block_identifier_stack.back()->get();
block_identifier_stack.pop_back(); block_identifier_stack.pop_back();
} }
} }
@ -107,7 +96,6 @@ class GDCompiler {
Map<StringName,int> name_map; Map<StringName,int> name_map;
int get_name_map_pos(const StringName& p_identifier) { int get_name_map_pos(const StringName& p_identifier) {
int ret; int ret;
if (!name_map.has(p_identifier)) { if (!name_map.has(p_identifier)) {
ret=name_map.size(); ret=name_map.size();
@ -118,11 +106,7 @@ class GDCompiler {
return ret; return ret;
} }
int get_constant_pos(const Variant& p_constant) { int get_constant_pos(const Variant& p_constant) {
if (constant_map.has(p_constant)) if (constant_map.has(p_constant))
return constant_map[p_constant]; return constant_map[p_constant];
int pos = constant_map.size(); int pos = constant_map.size();