Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2005-08-25 13:22:40 +0400
committerAtsushi Eno <atsushieno@gmail.com>2005-08-25 13:22:40 +0400
commitc9e22a72a54ae884d0f981893ff22c9892c8c165 (patch)
treebaf958e6021546cd8f26d1a12a7208f6874d3ee6 /mcs/class/System.XML/Mono.Xml.Xsl
parente3e16b74d4ed51f092d59940a3e0c973bb56d6a1 (diff)
2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
* ScriptCompilerInfo.cs : It should not be "#line" when the source is not C#. It should fix bug #75789. svn path=/trunk/mcs/; revision=48822
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.Xsl')
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog5
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs44
2 files changed, 44 insertions, 5 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
index b8ce61c38f5..d419ff209ac 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ScriptCompilerInfo.cs : It should not be "#line" when the source is
+ not C#. It should fix bug #75789.
+
2005-08-05 Atsushi Enomoto <atsushi@ximian.com>
* XslKey.cs : Fixed match pattern in xsl:key to check attribute nodes.
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs b/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs
index cc2a12194bf..ef619c36801 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs
@@ -67,6 +67,8 @@ namespace Mono.Xml.Xsl
public abstract string SourceTemplate { get; }
+ public abstract string FormatSource (IXmlLineInfo li, string file, string code);
+
public virtual string GetCompilerArguments (string targetFileName)
{
return String.Concat (DefaultCompilerOptions, " ", targetFileName);
@@ -95,12 +97,12 @@ namespace Mono.Xml.Xsl
// get source location
IXmlLineInfo li = scriptNode as IXmlLineInfo;
- string lineInfoLine =
- li != null && li.LineNumber > 0 ?
- String.Format (CultureInfo.InvariantCulture, "\n#line {0} \"{1}\"", li.LineNumber, filename) :
- String.Empty;
- string source = SourceTemplate.Replace ("{0}", DateTime.Now.ToString ()).Replace ("{1}", classSuffix).Replace ("{2}", lineInfoLine + code);
+ string source = SourceTemplate.Replace ("{0}",
+ DateTime.Now.ToString (CultureInfo.InvariantCulture))
+ .Replace ("{1}", classSuffix)
+ .Replace ("{2}", code);
+ source = FormatSource (li, filename, code);
CompilerResults res = compiler.CompileAssemblyFromSource (parameters, source);
foreach (CompilerError err in res.Errors)
@@ -174,6 +176,13 @@ public class Script{1}
}";
}
}
+
+ public override string FormatSource (IXmlLineInfo li, string file, string source)
+ {
+ if (li == null)
+ return source;
+ return String.Format (CultureInfo.InvariantCulture, "#line {0} \"{1}\"\n{2}", li.LineNumber, file, source);
+ }
}
internal class VBCompilerInfo : ScriptCompilerInfo
@@ -216,6 +225,13 @@ end namespace
";
}
}
+
+ public override string FormatSource (IXmlLineInfo li, string file, string source)
+ {
+ if (li == null)
+ return source;
+ return String.Format (CultureInfo.InvariantCulture, "# ExternalSource ({1}, line {0})\n{2}\n#end ExternalSource", li.LineNumber, file, source);
+ }
}
internal class JScriptCompilerInfo : ScriptCompilerInfo
@@ -269,6 +285,24 @@ class Script{1} {
";
}
}
+
+ public override string FormatSource (IXmlLineInfo li, string file, string source)
+ {
+#if true // remove when mjs got @set @position support
+ return source;
+#else
+ if (li == null)
+ return source;
+ return String.Format (CultureInfo.InvariantCulture,
+ "@set @position ({0}{1}{2}line={3};column={4})\n{5}",
+ file != null ? "file=" : String.Empty,
+ file,
+ file != null ? "; " : String.Empty,
+ li.LineNumber,
+ li.LinePosition,
+ source);
+#endif
+ }
}
}