Author: cesar
Date: 2005-04-08 14:55:38 -0400 (Fri, 08 Apr 2005)
New Revision: 42701

Modified:
   trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
   trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs
   trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
Log:
2005-04-08  Cesar Lopez Nataren  <[EMAIL PROTECTED]>

        * Literal.cs: Implement the construction of regular expression literal.
        * Parser.cs: Pass the proper parent to RegExpLiteral.

Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog       
2005-04-08 16:34:22 UTC (rev 42700)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog       
2005-04-08 18:55:38 UTC (rev 42701)
@@ -1,3 +1,8 @@
+2005-04-08  Cesar Lopez Nataren  <[EMAIL PROTECTED]>
+
+       * Literal.cs: Implement the construction of regular expression literal.
+       * Parser.cs: Pass the proper parent to RegExpLiteral.
+
 2005-03-30  Cesar Lopez Nataren  <[EMAIL PROTECTED]>
 
        * TypeOf.cs: take into account Objects.

Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs      
2005-04-08 16:34:22 UTC (rev 42700)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs      
2005-04-08 18:55:38 UTC (rev 42701)
@@ -5,6 +5,7 @@
 //     Cesar Lopez Nataren ([EMAIL PROTECTED])
 //
 // (C) 2003, 2004 Cesar Lopez Nataren 
+// (C) 2005, Novell Inc, (http://novell.com)
 //
 
 //
@@ -29,6 +30,7 @@
 //
 
 using System;
+using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;
 using Microsoft.JScript.Vsa;
@@ -224,7 +226,7 @@
                internal string re;
                internal string flags;
 
-               internal RegExpLiteral (string re, string flags)
+               internal RegExpLiteral (AST parent, string re, string flags)
                {
                        this.re = re;
                        this.flags = flags;
@@ -232,12 +234,36 @@
 
                internal override bool Resolve (IdentificationTable context)
                {
-                       throw new NotImplementedException ();
+                       return true;
                }
 
                internal override void Emit (EmitContext ec)
                {
-                       throw new NotImplementedException ();
+                       ILGenerator ig = ec.ig;
+                       TypeBuilder type = ec.type_builder;
+
+                       FieldBuilder field = type.DefineField 
(SemanticAnalyser.NextAnonymousRegExpObj, typeof (RegExpObject), 
FieldAttributes.Public | FieldAttributes.Static);
+
+                       Label label = ig.DefineLabel ();
+
+                       ig.Emit (OpCodes.Ldsfld, field);
+                       ig.Emit (OpCodes.Brtrue, label);
+
+                       CodeGenerator.load_engine (InFunction, ig);
+                       
+                       ig.Emit (OpCodes.Call, typeof (VsaEngine).GetMethod 
("GetOriginalRegExpConstructor"));
+                       ig.Emit (OpCodes.Ldstr, re);
+
+                       ig.Emit (OpCodes.Ldc_I4_0);
+                       ig.Emit (OpCodes.Ldc_I4_1);
+                       ig.Emit (OpCodes.Ldc_I4_0);
+
+                       ig.Emit (OpCodes.Call, typeof 
(RegExpConstructor).GetMethod ("Construct"));
+                       ig.Emit (OpCodes.Castclass, typeof (RegExpObject));
+                       ig.Emit (OpCodes.Stsfld, field);
+
+                       ig.MarkLabel (label);                   
+                       ig.Emit (OpCodes.Ldsfld, field);
                }
        }               
 }

Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs       
2005-04-08 16:34:22 UTC (rev 42700)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/Parser.cs       
2005-04-08 18:55:38 UTC (rev 42701)
@@ -1122,7 +1122,7 @@
                                string flags = ts.reg_exp_flags;
                                ts.reg_exp_flags = null;
                                string re = ts.GetString;
-                               return new RegExpLiteral (re, flags);
+                               return new RegExpLiteral (parent, re, flags);
                        } else if (tt == Token.NULL) {
                                // FIXME, build the null object;
                                return null;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to