public Evaluate ( IScriptContext context ) : void | ||
context | IScriptContext | |
return | void |
public override void Evaluate(IScriptContext context) { if (TypeExpr == null && GenericsPostfix == null) { context.Result = RuntimeHost.GetType(Identifier); return; } if (TypeExpr != null) { string name = string.Format("{0}.{1}", EvaluateName(TypeExpr), Identifier); Type type = null; if (GenericsPostfix != null) { Type genericType = RuntimeHost.GetType(GenericsPostfix.GetGenericTypeName(name)); GenericsPostfix.Evaluate(context); type = genericType.MakeGenericType((Type[])context.Result); } else { type = RuntimeHost.GetType(name); } context.Result = type; } else { Type genericType = RuntimeHost.GetType(Identifier); GenericsPostfix.Evaluate(context); context.Result = genericType.MakeGenericType((Type[])context.Result); } }
private void EvaluateGenericType(IScriptContext context) { ScriptGenericsPostfix genericPostfix = (ScriptGenericsPostfix)Modifiers.First(); Type genericType = GetIndentifierValue(context, genericPostfix.GetGenericTypeName(Identifier)) as Type; if (genericType == null || !genericType.IsGenericType) { throw new ScriptException("Given type is not generic"); } genericPostfix.Evaluate(context); context.Result = genericType.MakeGenericType((Type[])context.Result); }