summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-07-01 14:43:21 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-03 23:27:02 -0700
commitca10a1ec838b7d468a2b43894af659c111a0e9b1 (patch)
tree16601ac01a6f644015188db074e1c2b69bdc5789 /parse/gram.y
parentddb327c92ebe3f96c5c816ec61996440551de401 (diff)
downloadmc-ca10a1ec838b7d468a2b43894af659c111a0e9b1.tar.gz
Add impl(type, name) to retrieve a particular implementation of a trait decl
This avoids having to create a temporary variable when you know what implementation your want for a generic constant or function with generic return value. Re-use the impl keyword for this expression to avoid invalidating existing programs.
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 3839a92..bcf9713 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -380,7 +380,7 @@ typedeclcore
name : Tident {$$ = mkname($1->loc, $1->id);}
| Tident Tdot Tident {
- $$ = mkname($3->loc, $3->id); setns($$, $1->id);
+ $$ = mknsname($3->loc, $1->id, $3->id);
}
;
@@ -755,6 +755,10 @@ atomicexpr
}
| Tsizeof Toparen type Tcparen
{$$ = mkexpr($1->loc, Osize, mkpseudodecl($1->loc, $3), NULL);}
+ | Timpl Toparen name Tcomma type Tcparen {
+ $$ = mkexpr($1->loc, Ovar, $3, NULL);
+ $$->expr.param = $5;
+ }
;
tupbody : tuphead tuprest