Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java @ 12452:5f022aa41631
Truffle-DSL: fixed an NPE if invalid TypeData are compared.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 16 Oct 2013 18:25:16 +0200 |
parents | 2fb276f5e3e9 |
children |
comparison
equal
deleted
inserted
replaced
12404:47eb670c1634 | 12452:5f022aa41631 |
---|---|
43 return targetType; | 43 return targetType; |
44 } | 44 } |
45 | 45 |
46 @Override | 46 @Override |
47 public int compareTo(TemplateMethod o) { | 47 public int compareTo(TemplateMethod o) { |
48 if (o instanceof ImplicitCastData) { | 48 if (o instanceof ImplicitCastData && sourceType != null) { |
49 // implicit casts are ordered by source type since | 49 // implicit casts are ordered by source type since |
50 // its also the order in which they are checked. | 50 // its also the order in which they are checked. |
51 TypeData otherSourceType = ((ImplicitCastData) o).getSourceType(); | 51 TypeData otherSourceType = ((ImplicitCastData) o).getSourceType(); |
52 return this.sourceType.compareTo(otherSourceType); | 52 if (otherSourceType != null) { |
53 return this.sourceType.compareTo(otherSourceType); | |
54 } | |
53 } | 55 } |
54 return super.compareTo(o); | 56 return super.compareTo(o); |
55 } | 57 } |
56 | |
57 } | 58 } |