@@ -55,16 +55,6 @@ public static JsValue ToJsValue(this Object obj, EngineInstance engine)
55
55
return JsValue . Null ;
56
56
}
57
57
58
- public static Object RunScript ( this EngineInstance engine , String source )
59
- {
60
- return engine . RunScript ( source , engine . Window ) ;
61
- }
62
-
63
- public static Object RunScript ( this EngineInstance engine , String source , INode context )
64
- {
65
- return engine . RunScript ( source , context . ToJsValue ( engine ) ) ;
66
- }
67
-
68
58
public static ClrFunctionInstance AsValue ( this Engine engine , Func < JsValue , JsValue [ ] , JsValue > func )
69
59
{
70
60
return new ClrFunctionInstance ( engine , func ) ;
@@ -98,13 +88,7 @@ public static Object FromJsValue(this JsValue val)
98
88
case Types . Object :
99
89
var obj = val . AsObject ( ) ;
100
90
var node = obj as DomNodeInstance ;
101
-
102
- if ( node != null )
103
- {
104
- return node . Value ;
105
- }
106
-
107
- return obj ;
91
+ return node != null ? node . Value : obj ;
108
92
case Types . Undefined :
109
93
return "undefined" ;
110
94
case Types . Null :
@@ -137,9 +121,7 @@ public static Object As(this Object value, Type targetType, EngineInstance engin
137
121
var method = sourceType . PrepareConvert ( targetType ) ;
138
122
139
123
if ( method == null )
140
- {
141
124
throw new JavaScriptException ( "[Internal] Could not find corresponding cast target." ) ;
142
- }
143
125
144
126
return method . Invoke ( value , null ) ;
145
127
}
@@ -279,6 +261,16 @@ public static void AddInstance(this EngineInstance engine, ObjectInstance obj, T
279
261
}
280
262
}
281
263
264
+ public static Object RunScript ( this EngineInstance engine , String source )
265
+ {
266
+ return engine . RunScript ( source , engine . Window ) ;
267
+ }
268
+
269
+ public static Object RunScript ( this EngineInstance engine , String source , INode context )
270
+ {
271
+ return engine . RunScript ( source , context . ToJsValue ( engine ) ) ;
272
+ }
273
+
282
274
public static String GetOfficialName ( this MemberInfo member )
283
275
{
284
276
var names = member . GetCustomAttributes < DomNameAttribute > ( ) ;
0 commit comments