Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 15775:4293efaaab76
Add description and language to the NodeInfo annotation
author | Christian Wirth <christian.wirth@oracle.com> |
---|---|
date | Mon, 19 May 2014 18:52:39 +0200 |
parents | dd624471bd30 |
children | 915ebb306fcc |
comparison
equal
deleted
inserted
replaced
15774:402a74c6bc14 | 15775:4293efaaab76 |
---|---|
504 throw e; | 504 throw e; |
505 } catch (Exception e) { | 505 } catch (Exception e) { |
506 throw new RuntimeException(e); | 506 throw new RuntimeException(e); |
507 } | 507 } |
508 } | 508 } |
509 | |
510 /** | |
511 * Returns a user-readable description of the purpose of the Node, or "" if no description is | |
512 * available. | |
513 */ | |
514 public String getDescription() { | |
515 NodeInfo info = getClass().getAnnotation(NodeInfo.class); | |
516 if (info != null) { | |
517 return info.description(); | |
518 } | |
519 return ""; | |
520 } | |
521 | |
522 /** | |
523 * Returns a string representing the language this node has been implemented for. If the | |
524 * language is unknown, returns "". | |
525 */ | |
526 public String getLanguage() { | |
527 NodeInfo info = getClass().getAnnotation(NodeInfo.class); | |
528 if (info != null && info.language() != null && info.language().length() > 0) { | |
529 return info.language(); | |
530 } | |
531 if (parent != null) { | |
532 return parent.getLanguage(); | |
533 } | |
534 return ""; | |
535 } | |
509 } | 536 } |