public MemberReferenceExpression MapToContextReference(EvaluationContextEntity entity) { ActiveScriptEntity scriptEntity = entity as ActiveScriptEntity; if (scriptEntity != null) { Evaluator.Taint(this.get_CompileUnit()); return this.GetActiveScriptEntityReference(scriptEntity); } return this.get_CodeBuilder().CreateMemberReference(this.get_CodeBuilder().CreateReference(this.GetTargetFieldContext(entity)), entity.Delegate); }
public MemberReferenceExpression MapToContextReference(EvaluationContextEntity entity) { ActiveScriptEntity scriptEntity = entity as ActiveScriptEntity; if (scriptEntity != null) { Evaluator.Taint(this.CompileUnit); return(this.GetActiveScriptEntityReference(scriptEntity)); } return(this.CodeBuilder.CreateMemberReference(this.CodeBuilder.CreateReference(this.GetTargetFieldContext(entity)), entity.Delegate)); }
public override void OnReferenceExpression(ReferenceExpression node) { base.OnReferenceExpression(node); EvaluationContextEntity entity = node.Entity as EvaluationContextEntity; if (entity != null) { if (!this.ValidateContext(entity)) { IMember member = entity.Delegate; this.Errors.Add(CompilerErrorFactory.InstanceRequired(node, member)); } node.ParentNode.Replace(node, this.MapToContextReference(entity)); } }
public bool ValidateContext(EvaluationContextEntity entity) { return (this._evaluationContext.IsStaticContext ? (!entity.Delegate.get_IsStatic() ? this.IsEvaluationContextMember(entity) : true) : true); }
public bool IsEvaluationContextMember(EvaluationContextEntity entity) { return (entity.Delegate.get_DeclaringType() == this.get_TypeSystemServices().Map(this._evaluationContext.GetType())); }
public IField GetTargetFieldContext(EvaluationContextEntity entity) { return (!this.IsEvaluationContextMember(entity) ? this.GetScriptContainerField() : this.GetEvaluationContextField()); }
public bool ValidateContext(EvaluationContextEntity entity) => (this._evaluationContext.IsStaticContext ? (!entity.Delegate.IsStatic ? this.IsEvaluationContextMember(entity) : true) : true);
public bool IsEvaluationContextMember(EvaluationContextEntity entity) => (entity.Delegate.DeclaringType == this.TypeSystemServices.Map(this._evaluationContext.GetType()));
public IField GetTargetFieldContext(EvaluationContextEntity entity) => (!this.IsEvaluationContextMember(entity) ? this.GetScriptContainerField() : this.GetEvaluationContextField());