Skip to content

Commit

Permalink
add comments on default value
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielleraujo committed Mar 16, 2022
1 parent ea5a309 commit a29ad53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Binary file modified glf
Binary file not shown.
9 changes: 5 additions & 4 deletions src/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ Attribute declareTK_TYPE(string type, Attribute actual, Attribute left, Attribut
{
addSymbolInTable(right.label, type, actual);
Symbol simbolo = getSymbol(right.label);
string message = "// default value";

if(type == "int") { actual.translation = "\t" + simbolo.name + " = " + to_string(DEFAULT_INT) + ";\n"; }
if(type == "float") { actual.translation = "\t" + simbolo.name + " = " + to_string(DEFAULT_FLOAT) + ";\n"; }
if(type == "char") { actual.translation = "\t" + simbolo.name + " = " + "'"+ DEFAULT_CHAR + "'" + ";\n"; }
if(type == "bool") { actual.translation = "\t" + simbolo.name + " = " + DEFAULT_BOOL + ";\n"; }
if(type == "int") { actual.translation = "\t" + simbolo.name + " = " + to_string(DEFAULT_INT) + "; " + message + "\n"; }
if(type == "float") { actual.translation = "\t" + simbolo.name + " = " + to_string(DEFAULT_FLOAT) + "; " + message + "\n"; }
if(type == "char") { actual.translation = "\t" + simbolo.name + " = " + "'"+ DEFAULT_CHAR + "'" + "; " + message + "\n"; }
if(type == "bool") { actual.translation = "\t" + simbolo.name + " = " + DEFAULT_BOOL + "; " + message + "\n"; }

return actual;
}
Expand Down
6 changes: 3 additions & 3 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ bool v3;

int main(void)
{
v1 = false;
v1 = false; // default value
t1 = true;
v1 = t1;
v2 = false;
v3 = false;
v2 = false; // default value
v3 = false; // default value
t2 = v1 || v2;
v3 = t2;
return 0;
Expand Down

0 comments on commit a29ad53

Please sign in to comment.