New tests.
[mono.git] / mcs / ilasm / parser / ILParser.jay
index 123e7ed761376154f166849c411dc0a29888d091..b94d64121b1a36638fffc5c6fdd68b3f5c57b352 100644 (file)
@@ -312,6 +312,7 @@ namespace Mono.ILASM {
 %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
@@ -2243,12 +2245,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
@@ -2360,8 +2364,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 +2384,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 +2411,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 +3274,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 +3285,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