Esempio n. 1
0
        public override IAstElement ProcessBeforeChildren(IdentifierExpression identifier, ProcessingContext context)
        {
            var resolved = context.ResolveIdentifier(identifier.Name);

            RequireExactlyOne(resolved, identifier.Name);

            var result = (IAstElement)resolved[0];

            var property = result as IAstPropertyReference;

            if (property != null)
            {
                result = new AstPropertyExpression(new AstThisExpression(), property);
            }

            var function = result as IAstMethodReference;

            if (function != null)
            {
                result = new AstFunctionReferenceExpression(new AstThisExpression(), function);
            }

            result.SourceSpan = identifier.SourceSpan;
            return(result);
        }
Esempio n. 2
0
        private void CompileFieldOrPropertyAssignment(ILProcessor processor, AstPropertyExpression property, IAstExpression value, CilCompilationContext context)
        {
            processor.Emit(OpCodes.Ldarg_0);
            context.Compile(value);
            var fieldOrProperty = context.ConvertReference(property.Reference);
            var field           = fieldOrProperty.As <FieldReference>();

            if (field == null)
            {
                throw new NotImplementedException("AssignmentCompiler: Assignment to " + fieldOrProperty + " is not yet supported.");
            }

            processor.Emit(OpCodes.Stfld, field);
        }
Esempio n. 3
0
 protected virtual void AppendPropertyExpression(StringBuilder builder, AstPropertyExpression propertyExpression)
 {
     builder.Append(propertyExpression);
 }