Skip to content

Commit

Permalink
nixd/Syntax: change some field name to make gcc happy
Browse files Browse the repository at this point in the history
../nixd/include/nixd/Syntax/Nodes.inc:25:12: error: declaration of ‘nixd::syntax::Formals* nixd::syntax::Function::Formals’ changes meaning of ‘Formals’ [-fpermissive]
   25 |   Formals *Formals;
  • Loading branch information
inclyc committed Sep 17, 2023
1 parent 5f5127d commit 1a2290c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions nixd/include/nixd/Syntax/Nodes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NODE(Formals, {
})
NODE(Function, {
Identifier *Arg;
Formals *Formals;
Formals *FunctionFormals;
Node *Body;
COMMON_METHOD
})
Expand Down Expand Up @@ -131,15 +131,15 @@ NODE(Attribute, {
})

NODE(InheritedAttribute, {
Attrs *Attrs;
Attrs *InheritedAttrs;
Node *E;
COMMON_METHOD
})

NODE(Select, {
Node *Body;

AttrPath *AttrPath;
AttrPath *Path;

/// expr1 '.' attrpath 'or' expr2
/// expr2 is the default value if we cannot select
Expand Down Expand Up @@ -167,13 +167,13 @@ NODE(Braced, {
})

NODE(AttrSet, {
Binds *Binds;
Binds *AttrBinds;
bool Recursive;
COMMON_METHOD
})

NODE(LegacyLet, {
Binds *Binds;
Binds *AttrBinds;
COMMON_METHOD
})

Expand Down
20 changes: 10 additions & 10 deletions nixd/lib/Syntax/Parser/Parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ expr_function
: identifier ':' expr_function {
auto N = decorateNode(new Function, yylloc, *Data);
N->Arg = $1;
N->Formals = nullptr;
N->FunctionFormals = nullptr;
N->Body = $3;
$$ = N;
}
| '{' formals '}' ':' expr_function {
auto N = decorateNode(new Function, yylloc, *Data);
N->Arg = nullptr;
N->Formals = $2;
N->FunctionFormals = $2;
N->Body = $5;
$$ = N;
}
| '{' formals '}' '@' identifier ':' expr_function {
auto N = decorateNode(new Function, yylloc, *Data);
N->Arg = $5;
N->Formals = $2;
N->FunctionFormals = $2;
N->Body = $7;
$$ = N;
}
Expand Down Expand Up @@ -210,14 +210,14 @@ expr_select
: expr_simple '.' attrpath {
auto N = decorateNode(new Select, yylloc, *Data);
N->Body = $1;
N->AttrPath = $3;
N->Path = $3;
N->Default = nullptr;
$$ = N;
}
| expr_simple '.' attrpath OR_KW expr_select {
auto N = decorateNode(new Select, yylloc, *Data);
N->Body = $1;
N->AttrPath = $3;
N->Path = $3;
N->Default = $5;
$$ = N;
}
Expand Down Expand Up @@ -266,18 +266,18 @@ expr_simple
}
| LET '{' binds '}' {
auto N = decorateNode(new LegacyLet, yylloc, *Data);
N->Binds = $3;
N->AttrBinds = $3;
$$ = N;
}
| REC '{' binds '}' {
auto N = decorateNode(new AttrSet, yylloc, *Data);
N->Binds = $3;
N->AttrBinds = $3;
N->Recursive = true;
$$ = N;
}
| '{' binds '}' {
auto N = decorateNode(new AttrSet, yylloc, *Data);
N->Binds = $2;
N->AttrBinds = $2;
N->Recursive = false;
$$ = N;
}
Expand Down Expand Up @@ -401,12 +401,12 @@ binds
inherited_attribute
: INHERIT attrs ';' {
$$ = decorateNode(new InheritedAttribute, yylloc, *Data);
$$->Attrs = $2;
$$->InheritedAttrs = $2;
$$->E = nullptr;
}
| INHERIT '(' expr ')' attrs ';' {
$$ = decorateNode(new InheritedAttribute, yylloc, *Data);
$$->Attrs = $5;
$$->InheritedAttrs = $5;
$$->E = $3;
}

Expand Down

0 comments on commit 1a2290c

Please sign in to comment.