Ejemplo n.º 1
0
        /// <summary>
        /// Gets whether 'rr' is considered a static access on the target identifier.
        /// </summary>
        /// <param name="rr">Resolve Result of the MemberReferenceExpression</param>
        /// <param name="invocationRR">Resolve Result of the InvocationExpression</param>
        bool IsStaticResult(Expression rr, Expression invocationRR)
        {
            if (rr is TypeExpression)
            {
                return(true);
            }
            MemberExpressionStatement mrr = (rr is MethodGroupExpression ? invocationRR : rr) as MemberExpressionStatement;

            return(mrr != null && mrr.Member.IsStatic);
        }
Ejemplo n.º 2
0
        // TODO:Resolve Automatic property
        //TODO: Remove Apply Modifiers (All Is*** must evaluate modifiers)

        void CreateAutomaticProperty(ResolveContext rc)
        {
            // Create backing field
            BackingField = new PropertyBackingField(this, Initializer == null && Setter == null);


            if (Initializer != null)
            {
                BackingField.Initializer = expr;
                BackingField.ModFlags   |= Modifiers.READONLY;
            }
            BackingField.DoResolve(rc);

            MemberExpressionStatement fe = null;


            if ((BackingField.ModFlags & Modifiers.STATIC) == 0)
            {
                fe = new MemberExpressionStatement(new SelfReference(rc.CurrentTypeDefinition, Location), BackingField.ResolvedField, BackingField.ResolvedMemberType);
            }
            else
            {
                fe = new MemberExpressionStatement(new TypeExpression(rc.CurrentTypeDefinition, Location), BackingField.ResolvedField, BackingField.ResolvedMemberType);
            }

            ////
            //// Create get block but we careful with location to
            //// emit only single sequence point per accessor. This allow
            //// to set a breakpoint on it even with no user code
            ////
            //(Getter as GetterDeclaration).Block = new ToplevelBlock(rc, ParametersCompiled.EmptyReadOnlyParameters, Location.Null);
            //Return r = new Return(fe, Getter.Location);
            //(Getter as GetterDeclaration).Block.AddStatement(r);


            //// Create set block
            //if (Setter != null)
            //{
            //    (Setter as MethodCore).Block = new ToplevelBlock(Compiler, Setter.ParameterInfo, Location.Null);
            //    Assign a = new SimpleAssign(fe, new SimpleName("value", Location.Null), Location.Null);
            //    (Setter as MethodCore).Block.AddStatement(new StatementExpression(a, Set.Location));
            //    Setter.ModFlags |= Modifiers.COMPILER_GENERATED;
            //}
        }
Ejemplo n.º 3
0
 public Invocation(Expression targetResult, IParameterizedMember member,
                   IList <Expression> arguments,
                   OverloadResolutionErrors overloadResolutionErrors = OverloadResolutionErrors.None,
                   bool isExtensionMethodInvocation = false,
                   bool isExpandedForm                      = false,
                   bool isDelegateInvocation                = false,
                   IList <int> argumentToParameterMap       = null,
                   IList <Expression> initializerStatements = null,
                   IType returnTypeOverride                 = null)
 {
     this.ResolvedType                = returnTypeOverride ?? MemberExpressionStatement.ComputeType(member);
     _resolved                        = true;
     this.targetResult                = targetResult;
     this.member                      = member;
     this.RArguments                  = arguments ?? EmptyList <AST.Expression> .Instance;
     this.InitializerStatements       = initializerStatements ?? EmptyList <AST.Expression> .Instance;
     this.OverloadResolutionErrors    = overloadResolutionErrors;
     this.IsExtensionMethodInvocation = isExtensionMethodInvocation;
     this.IsExpandedForm              = isExpandedForm;
     this.IsDelegateInvocation        = isDelegateInvocation;
     this.argumentToParameterMap      = argumentToParameterMap;
     eclass = ExprClass.Value;
 }