Skip to content

Commit

Permalink
Add hook for vendor-specific __traits
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanEngelen committed Jun 6, 2016
1 parent 5ca456f commit 51d40ba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ddmd/hooks.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Compiler implementation of the D programming language
// Copyright (c) 1999-2016 by Digital Mars
// All Rights Reserved
// http://www.digitalmars.com
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt

module ddmd.hooks;

import ddmd.dscope;
import ddmd.expression;

Expression semanticTraitsHook(TraitsExp e, Scope* sc)
{
return null;
}
5 changes: 5 additions & 0 deletions ddmd/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import ddmd.expression;
import ddmd.func;
import ddmd.globals;
import ddmd.hdrgen;
import ddmd.hooks;
import ddmd.id;
import ddmd.identifier;
import ddmd.mtype;
Expand Down Expand Up @@ -1191,6 +1192,10 @@ extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc)
{
return pointerBitmap(e);
}
if (Expression ret = semanticTraitsHook(e, sc))
{
return ret;
}

extern (D) void* trait_search_fp(const(char)* seed, ref int cost)
{
Expand Down

0 comments on commit 51d40ba

Please sign in to comment.