Exemple #1
0
 /// <inheritdoc />
 public Node Visit(TypedParameterParseNode tppn)
 {
     ErrorReporting.ReportStaticError(tppn.Token.Module,
                                      tppn.Line, "P1023",
                                      new Dictionary <string, string> {
         { "token", "" + tppn.Token }
     },
                                      "Unexpected ':' in argument list");
     return(null);
 }
Exemple #2
0
 /// <inheritdoc/>
 public override ParseNode Visit(IdentifierParseNode ipn)
 {
     // A bare identifier that matches an element of the
     // set of disallowed names will always raise an error,
     // but the other cases below avoid visiting such a
     // node if it is in a valid place.
     if (_names.Contains(ipn.Name))
     {
         ErrorReporting.ReportStaticError(ipn.Token.Module,
                                          ipn.Line, "P1043",
                                          new Dictionary <string, string> {
             { "name", ipn.Name }
         },
                                          "Invalid use of parent name");
     }
     return(ipn);
 }
Exemple #3
0
        /// <inheritdoc />
        public Node Visit(UsesParseNode upn)
        {
            var frm = upn.From.Visit(this);

            if (!(frm is RequestNode))
            {
                ErrorReporting.ReportStaticError(upn.From.Token.Module,
                                                 upn.From.Line, "P1045",
                                                 new Dictionary <string, string> {
                },
                                                 "Can only inherit from method requests");
            }
            return(new InheritsNode(upn.Token, upn, frm,
                                    from x in upn.Aliases select
                                    new KeyValuePair <string, SignatureNode>(x.NewName.Name,
                                                                             (SignatureNode)x.OldName.Visit(this)),
                                    from x in upn.Excludes select x.Name.Name));
        }
Exemple #4
0
        /// <inheritdoc />
        public Node Visit(BindParseNode bpn)
        {
            var ret   = bpn.Left.Visit(this);
            var right = bpn.Right.Visit(this);
            var lrrn  = ret as RequestNode;

            if (lrrn != null)
            {
                lrrn.MakeBind(right);
                if (bpn.Left is OperatorParseNode ||
                    bpn.Left is InterpolatedStringParseNode)
                {
                    lrrn = null;
                }
            }
            if (lrrn == null)
            {
                var name = ret.GetType().Name;
                name = name.Substring(0, name.Length - 4);
                if (bpn.Left is OperatorParseNode)
                {
                    name = "Operator";
                }
                if (bpn.Left is InterpolatedStringParseNode)
                {
                    name = "StringLiteral";
                }
                ErrorReporting.ReportStaticError(bpn.Token.Module,
                                                 bpn.Line, "P1044",
                                                 new Dictionary <string, string> {
                    { "lhs", name }
                },
                                                 "Cannot assign to " + name);
            }
            return(ret);
        }
Exemple #5
0
 private void reportError(string code, string localDescription)
 {
     ErrorReporting.ReportStaticError(moduleName, line,
                                      code, localDescription);
 }
Exemple #6
0
 private void reportError(string code, Dictionary <string, string> vars,
                          string localDescription)
 {
     ErrorReporting.ReportStaticError(moduleName, line,
                                      code, vars, localDescription);
 }