public override ScriptVariableType Process(ScriptParser parser, int level) { base.Process(parser, level); bool hadErrors = false; try { LType = LValue.Process(parser, level + 1); } catch (ScriptCriticalErrorException) { hadErrors = true; } try { RType = RValue.Process(parser, level + 1); } catch (ScriptCriticalErrorException) { hadErrors = true; } if (hadErrors) { throw new ScriptCriticalErrorException(); // we are not going to try the operator because one of nodes had an error } dynamic a, b, c; a = LType.GetSampleValue(); b = RType.GetSampleValue(); try { c = ApplyOperator(a, b); ResultType = ScriptVariableTypeExtension.GetScriptVariableType(c); } catch (UserFriendlyException) { throw; } catch { parser.Errors.Add(new ErrorInfo(ErrorLevel.CriticalError, ErrorCode.OperatorCannotBeApplied2, this, LType, RType)); throw new ScriptCriticalErrorException(); } return(ResultType); }
public override ScriptVariableType Process(ScriptParser parser, int level) { base.Process(parser, level); ValueType = Value.Process(parser, level + 1); dynamic a, b; a = ValueType.GetSampleValue(); try { b = ApplyOperator(ref a); ResultType = ScriptVariableTypeExtension.GetScriptVariableType(b); } catch (UserFriendlyException) { throw; } catch { parser.Errors.Add(new ErrorInfo(ErrorLevel.CriticalError, ErrorCode.OperatorCannotBeApplied1, this, ValueType)); throw new ScriptCriticalErrorException(); } return(ValueType); }