Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved various enums and constants into the runtime library.

  • Loading branch information...
commit 66e4415006bca6c4614ab506efad4ece3d4ef080 1 parent 4f5a65b
John Gietzen otac0n authored
8 Src/IronJS.Runtime/ArgumentsLinkArray.cs
View
@@ -0,0 +1,8 @@
+namespace IronJS.Runtime
+{
+ public enum ArgumentsLinkArray : byte
+ {
+ Locals = 0,
+ ClosedOver = 1
+ }
+}
19 Src/IronJS.Runtime/BoxFields.cs
View
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace IronJS.Runtime
+{
+ public static class BoxFields
+ {
+ public const string Bool = "Bool";
+ public const string Number = "Number";
+ public const string Clr = "Clr";
+ public const string Undefined = "Clr";
+ public const string String = "String";
+ public const string SuffixString = "SuffixString";
+ public const string Object = "Object";
+ public const string Function = "Func";
+ }
+}
9 Src/IronJS.Runtime/DefaultValueHint.cs
View
@@ -0,0 +1,9 @@
+namespace IronJS.Runtime
+{
+ public enum DefaultValueHint
+ {
+ None = 0,
+ String = 1,
+ Number = 2
+ }
+}
9 Src/IronJS.Runtime/FunctionType.cs
View
@@ -0,0 +1,9 @@
+namespace IronJS.Runtime
+{
+ public enum FunctionType
+ {
+ UserDefined,
+ NativeConstructor,
+ NativeFunction
+ }
+}
8 Src/IronJS.Runtime/IronJS.Runtime.CLR2.csproj
View
@@ -41,12 +41,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ArgumentsLinkArray.cs" />
+ <Compile Include="BoxFields.cs" />
+ <Compile Include="DefaultValueHint.cs" />
<Compile Include="DescriptorAttrs.cs" />
<Compile Include="Errors.cs" />
+ <Compile Include="FunctionType.cs" />
<Compile Include="Legacy.cs" />
+ <Compile Include="MarshalModes.cs" />
+ <Compile Include="ParameterStorageType.cs" />
+ <Compile Include="ParamsMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SplayTree.cs" />
<Compile Include="SuffixString.cs" />
+ <Compile Include="TypeTags.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.
8 Src/IronJS.Runtime/IronJS.Runtime.csproj
View
@@ -41,12 +41,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ArgumentsLinkArray.cs" />
+ <Compile Include="BoxFields.cs" />
+ <Compile Include="DefaultValueHint.cs" />
<Compile Include="DescriptorAttrs.cs" />
<Compile Include="Errors.cs" />
+ <Compile Include="FunctionType.cs" />
<Compile Include="Legacy.cs" />
+ <Compile Include="MarshalModes.cs" />
+ <Compile Include="ParameterStorageType.cs" />
+ <Compile Include="ParamsMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SplayTree.cs" />
<Compile Include="SuffixString.cs" />
+ <Compile Include="TypeTags.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.
9 Src/IronJS.Runtime/MarshalModes.cs
View
@@ -0,0 +1,9 @@
+namespace IronJS.Runtime
+{
+ public enum MarshalModes
+ {
+ Default = 2,
+ This = 1,
+ Function = 0
+ }
+}
8 Src/IronJS.Runtime/ParameterStorageType.cs
View
@@ -0,0 +1,8 @@
+namespace IronJS.Runtime
+{
+ public enum ParameterStorageType
+ {
+ Private,
+ Shared
+ }
+}
9 Src/IronJS.Runtime/ParamsMode.cs
View
@@ -0,0 +1,9 @@
+namespace IronJS.Runtime
+{
+ public enum ParamsModes : byte
+ {
+ NoParams = 0,
+ ObjectParams = 1,
+ BoxParams = 2
+ }
+}
38 Src/IronJS.Runtime/TypeTags.cs
View
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace IronJS.Runtime
+{
+ public static class TypeTags
+ {
+ public const uint Box = 0x00000000u;
+ public const uint Bool = 0xFFFFFF01u;
+ public const uint Number = 0xFFFFFF02u;
+ public const uint Clr = 0xFFFFFF03u;
+ public const uint String = 0xFFFFFF04u;
+ public const uint SuffixString = 0xFFFFFF05u;
+ public const uint Undefined = 0xFFFFFF06u;
+ public const uint Object = 0xFFFFFF07u;
+ public const uint Function = 0xFFFFFF08u;
+
+ private static readonly Dictionary<uint, string> names = new Dictionary<uint, string>
+ {
+ { Box, "internal" },
+ { Bool, "boolean" },
+ { Number, "number" },
+ { Clr, "clr" },
+ { String, "string" },
+ { SuffixString, "string" },
+ { Undefined, "undefined" },
+ { Object, "object" },
+ { Function, "function" }
+ };
+
+ public static string GetName(uint tag)
+ {
+ return names[tag];
+ }
+ }
+}
1  Src/IronJS/Compiler.Function.fs
View
@@ -3,6 +3,7 @@
open System
open IronJS
+open IronJS.Runtime
open IronJS.Compiler
open IronJS.Dlr.Operators
open IronJS.Support.CustomOperators
1  Src/IronJS/Compiler.Object.fs
View
@@ -5,6 +5,7 @@ open IronJS
open IronJS.Dlr
open IronJS.Dlr.Operators
open IronJS.Dlr.ExtensionMethods
+open IronJS.Runtime
open IronJS.Support.CustomOperators
open IronJS.Compiler
open IronJS.Compiler.Utils
1  Src/IronJS/Compiler.Operators.fs
View
@@ -3,6 +3,7 @@
open IronJS
open IronJS.Compiler
open IronJS.Dlr.Operators
+open IronJS.Runtime
open IronJS.Support.CustomOperators
open IronJS.Support.Aliases
1  Src/IronJS/Compiler.Utils.fs
View
@@ -3,6 +3,7 @@
open System
open IronJS
+open IronJS.Runtime
open IronJS.Dlr.Operators
///
3  Src/IronJS/Operators.fs
View
@@ -2,6 +2,7 @@
open System
open IronJS
+open IronJS.Runtime
open IronJS.Support.Aliases
(*
@@ -51,7 +52,7 @@ type Operators =
static member typeOf (o:BV) =
if o.IsNumber then "number"
elif o.IsNull then "object"
- else TypeTags.Names.[o.Tag]
+ else TypeTags.GetName(o.Tag)
static member typeOf expr = Dlr.callStaticT<Operators> "typeOf" [expr]
63 Src/IronJS/Runtime.fs
View
@@ -17,73 +17,10 @@ open System.Runtime.InteropServices
open System.Globalization
open System.Text.RegularExpressions
-module TypeTags =
- let [<Literal>] Box = 0x00000000u
- let [<Literal>] Bool = 0xFFFFFF01u
- let [<Literal>] Number = 0xFFFFFF02u
- let [<Literal>] Clr = 0xFFFFFF03u
- let [<Literal>] String = 0xFFFFFF04u
- let [<Literal>] SuffixString = 0xFFFFFF05u
- let [<Literal>] Undefined = 0xFFFFFF06u
- let [<Literal>] Object = 0xFFFFFF07u
- let [<Literal>] Function = 0xFFFFFF08u
-
- let Names =
- Map.ofList [
- (Box, "internal")
- (Bool, "boolean")
- (Number, "number")
- (Clr, "clr")
- (String, "string")
- (SuffixString, "string")
- (Undefined, "undefined")
- (Object, "object")
- (Function, "function")]
-
- let getName (tag:uint32) = Names.[tag]
-
-module BoxFields =
- let [<Literal>] Bool = "Bool"
- let [<Literal>] Number = "Number"
- let [<Literal>] Clr = "Clr"
- let [<Literal>] Undefined = "Clr"
- let [<Literal>] String = "String"
- let [<Literal>] SuffixString = "SuffixString"
- let [<Literal>] Object = "Object"
- let [<Literal>] Function = "Func"
-
-module ParamsModes =
- let [<Literal>] NoParams = 0uy
- let [<Literal>] ObjectParams = 1uy
- let [<Literal>] BoxParams = 2uy
-
-type DefaultValueHint
- = None = 0
- | String = 1
- | Number = 2
-
-module MarshalModes =
- let [<Literal>] Default = 2
- let [<Literal>] This = 1
- let [<Literal>] Function = 0
-
module Array =
let [<Literal>] DenseMaxIndex = 2147483646u
let [<Literal>] DenseMaxSize = 2147483647u
-module ArgumentsLinkArray =
- let [<Literal>] Locals = 0uy
- let [<Literal>] ClosedOver = 1uy
-
-type ParameterStorageType
- = Private
- | Shared
-
-type FunctionType
- = UserDefined
- | NativeConstructor
- | NativeFunction
-
module Markers =
let [<Literal>] Number = 0xFFF8us
let [<Literal>] Tagged = 0xFFF9us
Please sign in to comment.
Something went wrong with that request. Please try again.