Exemplo n.º 1
0
        public static List<Error> Resolve(Assignment ass)
        {
            var errors = new List<Error>();
            IType type, exprType;
            errors.AddRange(IdentifierResolver.ResloveIdentifierType(ass, ass.Variable, out type));
            errors.AddRange(ass.Expr != null
                                ? ExpressionResolver.ResloveExpression(ass, ass.Expr, out exprType)
                                : FunctionInvokeResolver.Resolve(ass, ass.Invoke, out exprType));

            if (type.ToString() != exprType.ToString())
                errors.Add(new Error(ass.GetSourceIdentifier(), ass.Variable.First(),
                                     string.Format(ErrorMessages.TypeMismatch, type.ToString(), exprType.ToString())));
            return errors;
        }
Exemplo n.º 2
0
 private static void EmitAssignment(Assignment st)
 {
     if (st.Invoke == null)
         Source += string.Join(".", st.Variable.Select(x => x.Text)) + "=" + MakeString(st.Expr) + ";\n";
     else
     {
         Source += string.Join(".", st.Variable.Select(x => x.Text)) + "=";
         EmitInvoke(st.Invoke);
     }
 }
Exemplo n.º 3
0
        private static void EmitAssignment(MethodBuilder mb, Assignment ass)
        {
            var il = mb.GetILGenerator();

            il.Emit(OpCodes.Ret);
        }