Retval is not a reserved keyword, fixes 643345
[mono.git] / mcs / ilasm / parser / ILParser.jay
index bf9820bc5ba0a1fba8075132532ded6ffc830710..523c5ffe1a236bcd21cfa40e6ab7fa0d7f998cb4 100644 (file)
@@ -305,13 +305,14 @@ namespace Mono.ILASM {
 %token K_OUT\r
 %token K_OPT\r
 // %token K_LCID\r
-%token K_RETVAL\r
+//%token K_RETVAL\r
 %token K_STATIC\r
 %token K_PUBLIC\r
 %token K_PRIVATE\r
 %token K_FAMILY\r
 %token K_INITONLY\r
 %token K_RTSPECIALNAME\r
+%token K_STRICT\r
 %token K_SPECIALNAME\r
 %token K_ASSEMBLY\r
 %token K_FAMANDASSEM\r
@@ -1919,6 +1920,7 @@ meth_attr         : /* EMPTY */                   { $$ = new MethAttr (); }
                        | meth_attr K_REQSECOBJ         { $$ = (MethAttr) $1 | MethAttr.RequireSecObject; }\r
                        | meth_attr K_SPECIALNAME       { $$ = (MethAttr) $1 | MethAttr.SpecialName; }\r
                        | meth_attr K_RTSPECIALNAME     { $$ = (MethAttr) $1 | MethAttr.RTSpecialName; }\r
+                       | meth_attr K_STRICT            { $$ = (MethAttr) $1 | MethAttr.Strict; }\r
                         | meth_attr K_COMPILERCONTROLLED { /* Do nothing */ }\r
                        | meth_attr K_UNMANAGEDEXP      \r
                        | meth_attr K_PINVOKEIMPL OPEN_PARENS comp_qstring K_AS\r
@@ -2156,9 +2158,7 @@ method_decl               : D_EMITBYTE int32
 \r
                                 if (param == null) {\r
                                         Report.Warning (tokenizer.Location, String.Format ("invalid param index ({0}) with .param", index));\r
-                                        break;\r
-                                }\r
-                                if ($5 != null)\r
+                                } else if ($5 != null)\r
                                         param.AddDefaultValue ((Constant) $5);\r
                           }\r
                        | param_type_decl\r
@@ -2243,12 +2243,14 @@ scope_block             : scope_block_begin method_decls CLOSE_BRACE
                           {\r
                                 $$ = new HandlerBlock ((LabelInfo) $1,\r
                                         codegen.CurrentMethodDef.AddLabel ());\r
+                                codegen.CurrentMethodDef.EndLocalsScope ();\r
                           }\r
                        ;\r
 \r
 scope_block_begin       : OPEN_BRACE\r
                           {\r
                                 $$ = codegen.CurrentMethodDef.AddLabel ();\r
+                                codegen.CurrentMethodDef.BeginLocalsScope ();\r
                           }\r
                         ;\r
                         \r
@@ -2298,12 +2300,12 @@ seh_clauses             : seh_clause
                           }\r
                        ;\r
 \r
-seh_clause             : K_CATCH generic_class_ref handler_block\r
+seh_clause             : K_CATCH type handler_block\r
                           {\r
                                if ($2.GetType () == typeof (PrimitiveTypeRef))\r
                                        Report.Error ("Exception not be of a primitive type.");\r
                                        \r
-                                BaseClassRef type = (BaseClassRef) $2;\r
+                                BaseTypeRef type = (BaseTypeRef) $2;\r
                                 CatchBlock cb = new CatchBlock (type);\r
                                 cb.SetHandlerBlock ((HandlerBlock) $3);\r
                                 $$ = cb;\r
@@ -2360,8 +2362,8 @@ handler_block             : scope_block
                           }\r
                        | K_HANDLER int32 K_TO int32\r
                          {\r
-                               LabelInfo from = codegen.CurrentMethodDef.AddLabelRef ((string) $2);\r
-                               LabelInfo to = codegen.CurrentMethodDef.AddLabelRef ((string) $4);\r
+                               LabelInfo from = codegen.CurrentMethodDef.AddLabel ((int) $2);\r
+                               LabelInfo to = codegen.CurrentMethodDef.AddLabel ((int) $4);\r
 \r
                                $$ = new HandlerBlock (from, to);\r
                          }\r
@@ -2380,6 +2382,8 @@ instr                     : INSTR_NONE
                         | INSTR_LOCAL id\r
                           {\r
                                 int slot = codegen.CurrentMethodDef.GetNamedLocalSlot ((string) $2);\r
+                                if (slot < 0)\r
+                                        Report.Error (String.Format ("Undeclared identifier '{0}'", (string) $2));\r
                                 codegen.CurrentMethodDef.AddInstr (\r
                                         new IntInstr ((IntOp) $1, slot, tokenizer.Location));\r
                           }\r
@@ -2405,6 +2409,8 @@ instr                     : INSTR_NONE
                        | INSTR_I id\r
                           {\r
                                 int slot = codegen.CurrentMethodDef.GetNamedLocalSlot ((string) $2);\r
+                                if (slot < 0)\r
+                                        Report.Error (String.Format ("Undeclared identifier '{0}'", (string) $2));\r
                                 codegen.CurrentMethodDef.AddInstr (new\r
                                         IntInstr ((IntOp) $1, slot, tokenizer.Location));\r
                           }\r
@@ -3266,7 +3272,7 @@ float64                   : FLOAT64
                           {\r
                                 int i = (int) $3;\r
                                 byte[] intb = BitConverter.GetBytes (i);\r
-                                $$ = (double) BitConverter.ToSingle (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
+                                $$ = (double) BitConverter.ToSingle (intb, 0);\r
                           }\r
                         | K_FLOAT32 OPEN_PARENS INT64 CLOSE_PARENS\r
                           {\r
@@ -3277,12 +3283,12 @@ float64                 : FLOAT64
                        | K_FLOAT64 OPEN_PARENS INT64 CLOSE_PARENS\r
                           {\r
                                 byte[] intb = BitConverter.GetBytes ((long) $3);\r
-                               $$ = BitConverter.ToDouble (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
+                               $$ = BitConverter.ToDouble (intb, 0);\r
                           }\r
                         | K_FLOAT64 OPEN_PARENS INT32 CLOSE_PARENS\r
                           {\r
                                 byte[] intb = BitConverter.GetBytes ((int) $3);\r
-                                $$ = (double) BitConverter.ToSingle (intb, BitConverter.IsLittleEndian ? 0 : 4);\r
+                                $$ = (double) BitConverter.ToSingle (intb, 0);\r
                           }\r
                        ;\r
 \r