Ejemplo n.º 1
0
 public VariableValue(NamedTarget name)
 {
     Name = name;
 }
Ejemplo n.º 2
0
        public void ParseSet(MingeTokenizer tk)
        {
            Token tok = NextNonWhiteSpaceToken (tk);
            if (tok.Type != TokenType.TOKEN_NAME)
                RaiseFailure (tk, String.Format ("Invalid token found in set statement, expected a name got a {0}", tok.Value));

            NamedTarget target = new NamedTarget (tok.Value);

            tok = NextNonWhiteSpaceToken (tk);
            if (tok.Type != TokenType.TOKEN_ASSIGN)
                RaiseFailure (tk, String.Format ("Invalid token found in set statement, expected an = got a {0}", tok.Value));

            Expression expression = ParseExpression (tk, TokenType.TOKEN_BLOCK_END);

            current_page.EmitSet (target, expression);
        }
Ejemplo n.º 3
0
        public void EmitSet(NamedTarget target, Expression expression)
        {
            expression.ResolveType (application, this);

            PropertyDefinition property = FindProperty (target.Name, expression.ResolvedType);
            if (property == null)
                property = AddProperty (target.Name, expression.ResolvedType);

            //
            // Property setting happens in the ctor
            //

            ILProcessor processor = ctor.Body.GetILProcessor ();
            processor.Emit (OpCodes.Ldarg_0);
            expression.Emit (application, this, processor);
            processor.Emit (OpCodes.Call, property.SetMethod);
        }