Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java @ 8245:703c09f8640c
Implemented support for @NodeClass annotation to support builtins.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 06 Mar 2013 18:32:33 +0100 |
parents | 6b74ffe38183 |
children | c4c3f50fa9c2 |
comparison
equal
deleted
inserted
replaced
8244:10d37f893471 | 8245:703c09f8640c |
---|---|
163 return false; | 163 return false; |
164 } | 164 } |
165 | 165 |
166 public static Set<Modifier> modifiers(Modifier... modifier) { | 166 public static Set<Modifier> modifiers(Modifier... modifier) { |
167 return new LinkedHashSet<>(Arrays.asList(modifier)); | 167 return new LinkedHashSet<>(Arrays.asList(modifier)); |
168 } | |
169 | |
170 public static String getTypeId(TypeMirror mirror) { | |
171 switch (mirror.getKind()) { | |
172 case BOOLEAN: | |
173 return "Boolean"; | |
174 case BYTE: | |
175 return "Byte"; | |
176 case CHAR: | |
177 return "Char"; | |
178 case DOUBLE: | |
179 return "Double"; | |
180 case FLOAT: | |
181 return "Float"; | |
182 case SHORT: | |
183 return "Short"; | |
184 case INT: | |
185 return "Int"; | |
186 case LONG: | |
187 return "Long"; | |
188 case DECLARED: | |
189 return ((DeclaredType) mirror).asElement().getSimpleName().toString(); | |
190 case ARRAY: | |
191 return getTypeId(((ArrayType) mirror).getComponentType()) + "Array"; | |
192 case VOID: | |
193 return "Void"; | |
194 case WILDCARD: | |
195 StringBuilder b = new StringBuilder(); | |
196 WildcardType type = (WildcardType) mirror; | |
197 if (type.getExtendsBound() != null) { | |
198 b.append("Extends").append(getTypeId(type.getExtendsBound())); | |
199 } else if (type.getSuperBound() != null) { | |
200 b.append("Super").append(getTypeId(type.getExtendsBound())); | |
201 } | |
202 return b.toString(); | |
203 case TYPEVAR: | |
204 return "Any"; | |
205 default: | |
206 throw new RuntimeException("Unknown type specified " + mirror.getKind() + " mirror: " + mirror); | |
207 } | |
168 } | 208 } |
169 | 209 |
170 public static String getSimpleName(TypeElement element) { | 210 public static String getSimpleName(TypeElement element) { |
171 return getSimpleName(element.asType()); | 211 return getSimpleName(element.asType()); |
172 } | 212 } |