Permalink
Browse files

Moved Legacy code to the Runtime assembly.

  • Loading branch information...
1 parent 8ae97dc commit 6ac3f63fa6c8d54c49a4e8b76af792917840679f @otac0n otac0n committed Jul 4, 2011
View
@@ -5,6 +5,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "IronJS.CLR2", "IronJS\IronJ
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "REPL.CLR2", "Tools\REPL\REPL.CLR2.fsproj", "{0F78334F-EA74-4C5C-8232-B7D329BE2226}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronJS.Runtime.CLR2", "IronJS.Runtime\IronJS.Runtime.CLR2.csproj", "{E186E25A-34FF-4BD9-BBBE-B0B15849A828}"
+EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = CLR4.vsmdi
@@ -22,6 +24,10 @@ Global
{0F78334F-EA74-4C5C-8232-B7D329BE2226}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F78334F-EA74-4C5C-8232-B7D329BE2226}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F78334F-EA74-4C5C-8232-B7D329BE2226}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E186E25A-34FF-4BD9-BBBE-B0B15849A828}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E186E25A-34FF-4BD9-BBBE-B0B15849A828}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E186E25A-34FF-4BD9-BBBE-B0B15849A828}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E186E25A-34FF-4BD9-BBBE-B0B15849A828}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E186E25A-34FF-4BD9-BBBE-B0B15849A828}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>IronJS.Runtime.CLR2</RootNamespace>
+ <AssemblyName>IronJS.Runtime.CLR2</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;CLR2;LEGACY_BIGINT;LEGACY_DELEGATES_HIGH_ARITY</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;CLR2;LEGACY_BIGINT;LEGACY_DELEGATES_HIGH_ARITY</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="FSharp.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Legacy.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -33,13 +33,15 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Numerics" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Legacy.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -0,0 +1,109 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace IronJS.Runtime
+{
+#if LEGACY_HASHSET
+ public class HashSet<T> : ICollection<T>
+ {
+ object slug = new object();
+ Dictionary<T, object> storage = new Dictionary<T, object>();
+
+ public void Add(T item)
+ {
+ this.storage[item] = slug;
+ }
+
+ public void Clear()
+ {
+ this.storage.Clear();
+ }
+
+ public bool Contains(T item)
+ {
+ return this.storage.ContainsKey(item);
+ }
+
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ this.storage.Keys.CopyTo(array, arrayIndex);
+ }
+
+ public int Count
+ {
+ get { return this.storage.Count; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public bool Remove(T item)
+ {
+ return this.storage.Remove(item);
+ }
+
+ public IEnumerator<T> GetEnumerator()
+ {
+ return this.storage.Keys.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
+ }
+#endif
+
+#if LEGACY_DELEGATES
+ public delegate void Action();
+ public delegate void Action<in T>(T obj);
+ public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
+ public delegate void Action<in T1, in T2, in T3>(T1 arg1, T2 arg2, T3 arg3);
+
+ public delegate TResult Func<out TResult>();
+ public delegate TResult Func<in T, out TResult>(T arg);
+ public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
+ public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
+ public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
+#endif
+
+#if LEGACY_DELEGATES_HIGH_ARITY
+ public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
+ public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
+#endif
+
+#if LEGACY_SORTED_DICT
+ public class SortedDictionary<TKey, TValue>
+ {
+ }
+#endif
+
+#if LEGACY_BIGINT
+ public static class BigIntegerParser
+ {
+ public static bool TryParse(string value, out System.Numerics.BigInteger result)
+ {
+ return TryParse(value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out result);
+ }
+
+ public static bool TryParse(string value, System.Globalization.NumberStyles style, System.Globalization.CultureInfo culture, out System.Numerics.BigInteger result)
+ {
+ try
+ {
+ result = System.Numerics.BigInteger.Parse(value);
+ return true;
+ }
+ catch (FormatException)
+ {
+ result = System.Numerics.BigInteger.Zero;
+ return false;
+ }
+ }
+ }
+#endif
+}
@@ -4,6 +4,7 @@ open System
open System.Globalization
open IronJS
+open IronJS.Runtime
open IronJS.Support.Aliases
open IronJS.Compiler
View
@@ -236,15 +236,23 @@ module CSharp =
context |> FSharp.getFunctionAs<'T> name
///
+#if CLR2
+ member x.Execute(source) : obj =
+#else
member x.Execute(source) : [<return: System.Runtime.CompilerServices.Dynamic>]obj =
+#endif
context |> FSharp.execute source
///
member x.Execute<'T>(source) =
context |> FSharp.executeAs<'T> source
///
+#if CLR2
+ member x.ExecuteFile(path) : obj =
+#else
member x.ExecuteFile(path) : [<return: System.Runtime.CompilerServices.Dynamic>]obj =
+#endif
context |> FSharp.executeFile path
///
@@ -2,6 +2,7 @@
open System
open IronJS
+open IronJS.Runtime
///
type InlinePropertyGetCache(env:Env, throwOnMissing:bool) =
@@ -41,7 +41,6 @@
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
- <Compile Include="Legacy.fs" />
<Compile Include="FSharp.fs" />
<Compile Include="Dlr.fs" />
<Compile Include="Support.fs" />
@@ -101,6 +100,13 @@
<Reference Include="FSharp.Core" />
<Reference Include="System" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\IronJS.Runtime\IronJS.Runtime.CLR2.csproj">
+ <Name>IronJS.Runtime.CLR2</Name>
+ <Project>{e186e25a-34ff-4bd9-bbbe-b0b15849a828}</Project>
+ <Private>True</Private>
+ </ProjectReference>
+ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
View
@@ -41,7 +41,6 @@
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
- <Compile Include="Legacy.fs" />
<Compile Include="FSharp.fs" />
<Compile Include="Dlr.fs" />
<Compile Include="Support.fs" />
View
@@ -1,74 +0,0 @@
-namespace IronJS
-
-// This file contains support classes needed in IronJS
-// that are not available on Mono and .NET version that
-// are earlier then 4.0
-
-open System.Collections
-open System.Collections.Generic
-
-#if LEGACY_HASHSET
-type HashSet<'a when 'a : equality>() =
- let o = obj()
- let storage = new Dictionary<'a, obj>();
-
- member x.Add(item) = (x :> ICollection<'a>).Add(item)
- member x.Clear() = (x :> ICollection<'a>).Clear()
- member x.Contains(item) = (x :> ICollection<'a>).Contains(item)
- member x.CopyTo(a, b) = (x :> ICollection<'a>).CopyTo(a, b)
- member x.Count = (x :> ICollection<'a>).Count
- member x.IsReadOnly = (x :> ICollection<'a>).IsReadOnly
- member x.GetEnumerator() : IEnumerator<'a> = (x :> ICollection<'a>).GetEnumerator()
-
- interface ICollection<'a> with
- member x.Add(item) = storage.[item] <- o;
- member x.Clear() = storage.Clear();
- member x.Contains(item) = storage.ContainsKey(item);
- member x.CopyTo(_:'a array,_:int) : unit = failwith "Not implemented"
- member x.Count = storage.Count
- member x.IsReadOnly = false
- member x.Remove(item) = storage.Remove(item)
-
- member x.GetEnumerator() : IEnumerator<'a> =
- (seq { for x in storage do yield x.Key }).GetEnumerator()
-
- member x.GetEnumerator() : IEnumerator =
- (seq { for x in storage do yield x.Key }).GetEnumerator() :> IEnumerator
-#endif
-
-#if LEGACY_DELEGATES
-type Action = delegate of unit -> unit
-type Action<'a, 'b> = delegate of 'a * 'b -> unit
-type Action<'a, 'b, 'c> = delegate of 'a * 'b * 'c -> unit
-type Action<'a, 'b, 'c, 'd> = delegate of 'a * 'b * 'c * 'd -> unit
-
-type Func<'r> = delegate of unit -> 'r
-type Func<'a, 'r> = delegate of 'a -> 'r
-type Func<'a, 'b, 'r> = delegate of 'a * 'b -> 'r
-type Func<'a, 'b, 'c, 'r> = delegate of 'a * 'b * 'c -> 'r
-type Func<'a, 'b, 'c, 'd, 'r> = delegate of 'a * 'b * 'c * 'd -> 'r
-#endif
-
-#if LEGACY_DELEGATES_HIGH_ARITY
-type Func<'a, 'b, 'c, 'd, 'e, 'r> = delegate of 'a * 'b * 'c * 'd * 'e -> 'r
-type Func<'a, 'b, 'c, 'd, 'e, 'f, 'r> = delegate of 'a * 'b * 'c * 'd * 'e * 'f -> 'r
-#endif
-
-#if LEGACY_SORTED_DICT
-type SortedDictionary<'k, 'v>() =
- class
-
- end
-#endif
-
-#if LEGACY_BIGINT
-type BigIntegerParser() =
-
- static member TryParse(s, f, i, bi:bigint byref) =
- try
- bi <- System.Numerics.BigInteger.Parse(s)
- true
-
- with
- | _ -> false
-#endif
@@ -3,6 +3,7 @@
open System
open System.Reflection
open IronJS
+open IronJS.Runtime
open IronJS.Support.CustomOperators
///
View
@@ -5,6 +5,9 @@
#nowarn "9"
open IronJS
+#if CLR2
+open IronJS.Runtime
+#endif
open IronJS.Support.Aliases
open IronJS.Support.CustomOperators

0 comments on commit 6ac3f63

Please sign in to comment.