Browse Source

Desugar a type to test whether it is primitive or not.

pull/219/merge
Elias Holzer 11 years ago committed by triton
parent
commit
55bbba46dd
  1. 2
      src/AST/TypeExtensions.cs
  2. 5
      tests/Basic/Basic.h

2
src/AST/TypeExtensions.cs

@ -10,7 +10,7 @@
public static bool IsPrimitiveType(this Type t, out PrimitiveType primitive) public static bool IsPrimitiveType(this Type t, out PrimitiveType primitive)
{ {
var builtin = t as BuiltinType; var builtin = t.Desugar() as BuiltinType;
if (builtin != null) if (builtin != null)
{ {
primitive = builtin.Type; primitive = builtin.Type;

5
tests/Basic/Basic.h

@ -303,9 +303,12 @@ struct EmptyNamedNestedEnum
enum { Value = 10 }; enum { Value = 10 };
}; };
typedef unsigned long foo_t;
typedef struct SomeStruct typedef struct SomeStruct
{ {
const foo_t& operator[](int i) const { return p[i]; }
foo_t& operator[](int i) { return p[i]; }
foo_t* p;
} }
SomeStruct; SomeStruct;

Loading…
Cancel
Save