@@ -110,7 +110,7 @@ public static Object As(this Object value, Type targetType, EngineInstance engin
110110 {
111111 var sourceType = value . GetType ( ) ;
112112
113- if ( sourceType == targetType || sourceType . IsSubclassOf ( targetType ) || targetType . IsInstanceOfType ( value ) || targetType . IsAssignableFrom ( sourceType ) )
113+ if ( sourceType == targetType || sourceType . GetTypeInfo ( ) . IsSubclassOf ( targetType ) || targetType . GetTypeInfo ( ) . IsAssignableFrom ( sourceType . GetTypeInfo ( ) ) )
114114 {
115115 return value ;
116116 }
@@ -119,7 +119,7 @@ public static Object As(this Object value, Type targetType, EngineInstance engin
119119 return ( Int32 ) ( Double ) value ;
120120 }
121121
122- if ( targetType . IsSubclassOf ( typeof ( Delegate ) ) && value is FunctionInstance )
122+ if ( targetType . GetTypeInfo ( ) . IsSubclassOf ( typeof ( Delegate ) ) && value is FunctionInstance )
123123 {
124124 return targetType . ToDelegate ( ( FunctionInstance ) value , engine ) ;
125125 }
@@ -139,7 +139,7 @@ public static Object As(this Object value, Type targetType, EngineInstance engin
139139
140140 public static Object GetDefaultValue ( this Type type )
141141 {
142- return type . IsValueType ? Activator . CreateInstance ( type ) : null ;
142+ return type . GetTypeInfo ( ) . IsValueType ? Activator . CreateInstance ( type ) : null ;
143143 }
144144
145145 public static MethodInfo PrepareConvert ( this Type fromType , Type toType )
@@ -222,37 +222,37 @@ public static String[] GetParameterNames(this MethodInfo method)
222222
223223 public static void AddConstructors ( this EngineInstance engine , ObjectInstance obj , Type type )
224224 {
225- foreach ( var exportedType in type . Assembly . ExportedTypes )
225+ foreach ( var exportedType in type . GetTypeInfo ( ) . Assembly . ExportedTypes )
226226 {
227227 engine . AddConstructor ( obj , exportedType ) ;
228228 }
229229 }
230230
231231 public static void AddInstances ( this EngineInstance engine , ObjectInstance obj , Type type )
232232 {
233- foreach ( var exportedType in type . Assembly . ExportedTypes )
233+ foreach ( var exportedType in type . GetTypeInfo ( ) . Assembly . ExportedTypes )
234234 {
235235 engine . AddInstance ( obj , exportedType ) ;
236236 }
237237 }
238238
239239 public static void AddConstructor ( this EngineInstance engine , ObjectInstance obj , Type type )
240240 {
241- var info = type . GetConstructors ( ) . FirstOrDefault ( m =>
241+ var info = type . GetTypeInfo ( ) . DeclaredConstructors . FirstOrDefault ( m =>
242242 m . GetCustomAttributes < DomConstructorAttribute > ( ) . Any ( ) ) ;
243243
244244 if ( info != null )
245245 {
246- var name = type . GetOfficialName ( ) ;
246+ var name = type . GetTypeInfo ( ) . GetOfficialName ( ) ;
247247 var constructor = new DomConstructorInstance ( engine , info ) ;
248248 obj . FastSetProperty ( name , new PropertyDescriptor ( constructor , false , true , false ) ) ;
249249 }
250250 }
251251
252252 public static void AddInstance ( this EngineInstance engine , ObjectInstance obj , Type type )
253253 {
254- var attributes = type . GetCustomAttributes < DomInstanceAttribute > ( ) ;
255- var info = type . GetConstructor ( Type . EmptyTypes ) ;
254+ var attributes = type . GetTypeInfo ( ) . GetCustomAttributes < DomInstanceAttribute > ( ) ;
255+ var info = type . GetTypeInfo ( ) . DeclaredConstructors . FirstOrDefault ( m => m . GetParameters ( ) . Length == 0 ) ;
256256
257257 if ( info != null )
258258 {
0 commit comments