Exemplo n.º 1
0
        /// <nodoc />
        public PredefinedTypes(PrimitiveTypes knownTypes)
        {
            Contract.Requires(knownTypes != null);

            AllAmbientDefinitions = new Dictionary <Type, AmbientDefinitionBase>
            {
                [typeof(ArrayLiteral)]      = AmbientArray = new AmbientArray(knownTypes),
                [typeof(DirectoryArtifact)] = m_ambientDirectory = new AmbientDirectory(knownTypes),
                [typeof(EnumValue)]         = m_ambientEnum = new AmbientEnum(knownTypes),
                [typeof(FileArtifact)]      = m_ambientFile = new AmbientFile(knownTypes),
                [typeof(ObjectLiteral)]     = AmbientObject = new AmbientObject(knownTypes),
                [typeof(ObjectLiteral0)]    = AmbientObject,
                [typeof(ObjectLiteralSlim)] = AmbientObject,
                [typeof(ObjectLiteralN)]    = AmbientObject,
                [typeof(AbsolutePath)]      = m_ambientPath = new AmbientPath(knownTypes),
                [typeof(StaticDirectory)]   = m_ambientStaticDirectory = new AmbientStaticDirectory(knownTypes),
                [typeof(string)]            = m_ambientString = new AmbientString(knownTypes),
                [typeof(AmbientStringBuilder.StringBuilderWrapper)] = m_ambientStringBuilder = new AmbientStringBuilder(knownTypes),
                [typeof(int)]          = m_ambientNumber = new AmbientNumber(knownTypes),
                [typeof(UnitValue)]    = m_ambientUnit = new AmbientUnit(knownTypes),
                [typeof(bool)]         = m_ambientBoolean = new AmbientBoolean(knownTypes),
                [typeof(OrderedMap)]   = m_ambientMap = new AmbientMap(knownTypes),
                [typeof(OrderedSet)]   = m_ambientSet = new AmbientSet(knownTypes),
                [typeof(MutableSet)]   = m_ambientMutableSet = new AmbientMutableSet(knownTypes),
                [typeof(PathAtom)]     = m_ambientPathAtom = new AmbientPathAtom(knownTypes),
                [typeof(RelativePath)] = m_ambientRelativePath = new AmbientRelativePath(knownTypes),

                // the ones below don't define any 'instance' methods, thus are not associated with a "real" object type,
                // i.e., a type that is going to be encountered during a DScript evaluation.
                [typeof(Dummy)] = m_ambientContext = new AmbientContext(knownTypes),
                [typeof(Dummy)] = m_ambientDebug = new AmbientDebug(knownTypes),
                [typeof(Dummy)] = m_ambientContract = new AmbientContract(knownTypes),
                [typeof(Dummy)] = m_ambientGlobal = new AmbientGlobal(knownTypes),
                [typeof(Dummy)] = m_ambientMath = new AmbientMath(knownTypes),
                [typeof(Dummy)] = m_ambientTransformerOriginal = new AmbientTransformerOriginal(knownTypes),
                [typeof(Dummy)] = m_ambientTransformerHack = new AmbientTransformerHack(knownTypes),
                [typeof(Dummy)] = m_ambientEnvironment = new AmbientEnvironment(knownTypes),
                [typeof(Dummy)] = m_ambientArgumentKind = new AmbientArgumentKind(knownTypes),
                [typeof(Dummy)] = m_ambientArtifactKind = new AmbientArtifactKind(knownTypes),
                [typeof(Dummy)] = m_ambientTextEncoding = new AmbientTextEncoding(knownTypes),
                [typeof(Dummy)] = m_ambientNameResolutionSemantics = new AmbientNameResolutionSemantics(knownTypes),
                [typeof(Dummy)] = m_ambientKeyForm = new AmbientKeyForm(knownTypes),
                [typeof(Dummy)] = m_ambientSealSourceDirectoryOption = new AmbientSealSourceDirectoryOption(knownTypes),
                [typeof(Dummy)] = m_ambientHashHelper = new AmbientHashing(knownTypes),
                [typeof(Dummy)] = m_ambientValueCacheHelper = new AmbientValueCache(knownTypes),
                [typeof(Dummy)] = m_ambientJsonHelper = new AmbientJson(knownTypes),
                [typeof(Dummy)] = m_ambientXmlHelper = new AmbientXml(knownTypes),
                [typeof(Dummy)] = m_ambientContainerIsolationLevel = new AmbientContainerIsolationLevel(knownTypes),
                [typeof(Dummy)] = m_ambientUnsafe = new AmbientUnsafe(knownTypes),
            };
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Registers all ambients to the global module literal.
        /// </summary>
        /// <param name="global">The global module literal.</param>
        public void Register(GlobalModuleLiteral global)
        {
            Contract.Requires(global != null);

            AmbientArray.Initialize(global);
            m_ambientContext.Initialize(global);
            m_ambientDebug.Initialize(global);
            m_ambientContract.Initialize(global);
            m_ambientDirectory.Initialize(global);
            m_ambientEnum.Initialize(global);
            m_ambientFile.Initialize(global);
            m_ambientGlobal.Initialize(global);
            m_ambientMath.Initialize(global);
            AmbientObject.Initialize(global);
            m_ambientPath.Initialize(global);
            m_ambientStaticDirectory.Initialize(global);
            m_ambientString.Initialize(global);
            m_ambientStringBuilder.Initialize(global);
            m_ambientTransformerOriginal.Initialize(global);
            m_ambientTransformerHack.Initialize(global);
            m_ambientNumber.Initialize(global);
            m_ambientBoolean.Initialize(global);
            m_ambientUnit.Initialize(global);
            m_ambientEnvironment.Initialize(global);
            m_ambientArgumentKind.Initialize(global);
            m_ambientArtifactKind.Initialize(global);
            m_ambientMap.Initialize(global);
            m_ambientSet.Initialize(global);
            m_ambientMutableSet.Initialize(global);
            m_ambientKeyForm.Initialize(global);
            m_ambientPathAtom.Initialize(global);
            m_ambientRelativePath.Initialize(global);
            m_ambientTextEncoding.Initialize(global);
            m_ambientNameResolutionSemantics.Initialize(global);
            m_ambientSealSourceDirectoryOption.Initialize(global);
            m_ambientHashHelper.Initialize(global);
            m_ambientValueCacheHelper.Initialize(global);
            m_ambientJsonHelper.Initialize(global);
            m_ambientXmlHelper.Initialize(global);
            m_ambientContainerIsolationLevel.Initialize(global);
            m_ambientUnsafe.Initialize(global);
        }