예제 #1
0
        /// <summary>
        /// Populates current scope with a given <paramref name="symbolTable"/>.
        /// </summary>
        internal void PopulateFromSymbolTable([CanBeNull] ISymbolTable symbolTable)
        {
            // The binder in some cases optimizes the local table block and does not create a symbol table at all
            if (symbolTable == null)
            {
                return;
            }

            foreach (var kvp in symbolTable)
            {
                var symbol      = kvp.Value;
                var declaration = symbol.DeclarationList.First();
                if (declaration.Kind != TypeScript.Net.Types.SyntaxKind.VariableDeclaration && declaration.Kind != TypeScript.Net.Types.SyntaxKind.Parameter)
                {
                    // Need to register only variable declarations!
                    continue;
                }

                // TODO: next statment will fail even for valid names.
                // For instance, $ is not a valid character for SymbolAtom but it is a valid identifier.
                // This logic needs to be revisit.
                var atom = SymbolAtom.Create(m_stringTable, declaration.Name.Text);

                var location = declaration.Location(m_sourceFile, m_sourceFilePath, m_pathTable);

                bool isConstant = NodeUtilities.IsConst(declaration);

                var index = AddVariable(atom, location, isConstant);
                Contract.Assume(
                    index != null,
                    I($"Found duplicate variable '{declaration.Name.Text}' in a source file. This should never happen because binder should fail on it!"));
            }
        }
예제 #2
0
        private SymbolAtom GetConfigKeyword(ISourceFile sourceFile)
        {
            string configKeywordString = sourceFile.Statements[0].TryGetFunctionNameInCallExpression();

            if (configKeywordString == null)
            {
                Contract.Assert(false, I($"Configuration validation for '{Kind}' should have caught that the first statement is not a call expression"));
            }

            switch (Kind)
            {
            case ConfigurationKind.PrimaryConfig:
                Contract.Assert(
                    configKeywordString == Script.Constants.Names.ConfigurationFunctionCall,
                    I($"Configuration validation for '{Kind}' should have caught that a wrong configuration keyword was used ('{configKeywordString}' instead of '{Script.Constants.Names.ConfigurationFunctionCall}')"));
                return(SymbolAtom.Create(Context.StringTable, configKeywordString));

            case ConfigurationKind.ModuleConfig:
                Contract.Assert(
                    configKeywordString == Script.Constants.Names.ModuleConfigurationFunctionCall || configKeywordString == Script.Constants.Names.LegacyModuleConfigurationFunctionCall,
                    I($"Configuration validation for '{Kind}' should have caught that a wrong configuration keyword was used ('{configKeywordString}' instead of either '{Script.Constants.Names.ModuleConfigurationFunctionCall}' or '{Script.Constants.Names.LegacyModuleConfigurationFunctionCall}')"));
                return(SymbolAtom.Create(Context.StringTable, configKeywordString));

            default:
                throw Contract.AssertFailure(UnimplementedOperationForConfigKindErrorMessage);
            }
        }
예제 #3
0
        public void Combine()
        {
            var           st = new StringTable(0);
            PartialSymbol p1 = PartialSymbol.Create(st, "AAA");
            SymbolAtom    a1 = SymbolAtom.Create(st, "BBB");
            PartialSymbol p2 = p1.Combine(a1);

            XAssert.AreEqual(@"AAA.BBB", p2.ToString(st));

            p1 = PartialSymbol.Create(st, string.Empty);
            p2 = p1.Combine(a1);
            XAssert.AreEqual(@"BBB", p2.ToString(st));

            p1 = PartialSymbol.Create(st, "AAA");
            SymbolAtom a2 = SymbolAtom.Create(st, "CCC");

            p2 = p1.Combine(a1, a2);
            XAssert.AreEqual(@"AAA.BBB.CCC", p2.ToString(st));

            p1 = PartialSymbol.Create(st, "AAA");
            a2 = SymbolAtom.Create(st, "CCC");
            SymbolAtom a3 = SymbolAtom.Create(st, "DDD");

            p2 = p1.Combine(a1, a2, a3);
            XAssert.AreEqual(@"AAA.BBB.CCC.DDD", p2.ToString(st));

            PartialSymbol p3 = p1.Combine(p2);

            XAssert.AreEqual(@"AAA.AAA.BBB.CCC.DDD", p3.ToString(st));
        }
예제 #4
0
        /// <nodoc />
        private Binder(RuntimeModelContext runtimeModelContext)
        {
            Contract.Requires(runtimeModelContext != null);

            m_runtimeModelContext        = runtimeModelContext;
            m_runtimeRootNamespaceSymbol = SymbolAtom.Create(runtimeModelContext.StringTable, Constants.Names.RuntimeRootNamespaceAlias);
        }
예제 #5
0
        private EvaluationResult DoGetOrAdd(Context context, ModuleLiteral env, EvaluationResult key, EvaluationResult?state, Closure factoryClosure)
        {
            var helper = new HashingHelper(context.PathTable, recordFingerprintString: false);

            // Add the qualifier to the key
            var qualifierId            = context.LastActiveModuleQualifier.QualifierId;
            var qualifierDisplayString = context.ContextTree.FrontEndContext.QualifierTable.GetQualifier(qualifierId).ToDisplayString(StringTable);

            helper.Add(qualifierDisplayString);
            if (!TryHashValue(key, helper))
            {
                return(EvaluationResult.Error);
            }

            var keyFingerprint           = helper.GenerateHash().ToHex();
            var thunkCreatedByThisThread = false;

            // ensure that all concurrent evaluations of the same value cache key will get the same thunk and module
            var thunkAndModule = context.EvaluationScheduler.ValueCacheGetOrAdd(
                keyFingerprint,
                () =>
            {
                var factoryArgs = state.HasValue
                        ? new Expression[] { new LocalReferenceExpression(SymbolAtom.Create(context.StringTable, "state"), index: factoryClosure.Frame.Length, default) }
                        : CollectionUtilities.EmptyArray <Expression>();

                var thunk  = new Thunk(ApplyExpression.Create(factoryClosure, factoryArgs, factoryClosure.Location), null);
                var module = context.LastActiveUsedModule;
                thunkCreatedByThisThread = true;
                return(thunk, module);
            });
예제 #6
0
        public void TryCreate()
        {
            var st = new StringTable(0);

            PartialSymbol p;

            XAssert.IsTrue(PartialSymbol.TryCreate(st, @"AAA.CCC", out p));
            XAssert.AreEqual(@"AAA.CCC", p.ToString(st));

            XAssert.IsFalse(PartialSymbol.TryCreate(st, @"C.:AAA", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @"AAA:", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @":AAA", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @"..", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @".", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @"B.", out p));
            XAssert.IsFalse(PartialSymbol.TryCreate(st, @"B..", out p));

            p = PartialSymbol.Create(st, string.Empty);
            XAssert.AreEqual(string.Empty, p.ToString(st));

            p = PartialSymbol.Create(st, "BBB");
            XAssert.AreEqual("BBB", p.ToString(st));

            SymbolAtom a1 = SymbolAtom.Create(st, "AAA");
            SymbolAtom a2 = SymbolAtom.Create(st, "BBB");
            SymbolAtom a3 = SymbolAtom.Create(st, "CCC");

            p = PartialSymbol.Create(a1, a2, a3);
            XAssert.AreEqual(@"AAA.BBB.CCC", p.ToString(st));
        }
예제 #7
0
 private SelectorExpression CreateStringInterpolateSelectorExpression()
 {
     return(new SelectorExpression(
                new ModuleIdExpression(FullSymbol.Create(RuntimeModelContext.SymbolTable, Names.StringNamespace), location: default(LineInfo)),
                SymbolAtom.Create(RuntimeModelContext.StringTable, Names.InterpolateString),
                location: default(LineInfo)));
 }
예제 #8
0
        /// <nodoc />
        protected internal AmbientDefinitionBase(string ambientName, PrimitiveTypes knownTypes)
        {
            Contract.Requires(knownTypes != null);

            AmbientTypes = knownTypes;
            AmbientName  = ambientName == null ? SymbolAtom.Invalid : SymbolAtom.Create(knownTypes.StringTable, ambientName);
        }
예제 #9
0
        public void Conversion()
        {
            var           st = new StringTable(0);
            SymbolAtom    a1 = SymbolAtom.Create(st, "AAA");
            PartialSymbol p1 = PartialSymbol.Create(a1);

            XAssert.AreEqual("AAA", p1.ToString(st));
        }
예제 #10
0
        public void Concat()
        {
            var        idt = new SymbolTable();
            FullSymbol a1  = FullSymbol.Create(idt, @"C.A");
            SymbolAtom p1  = SymbolAtom.Create(idt.StringTable, "B");
            FullSymbol a2  = a1.Concat(idt, p1);

            XAssert.AreEqual(@"C.AB", a2.ToString(idt));
        }
예제 #11
0
        public void Concat()
        {
            var st = new StringTable(0);

            PartialSymbol rp  = PartialSymbol.Create(st, @"AAA.BBB");
            SymbolAtom    p1  = SymbolAtom.Create(st, "XXX");
            PartialSymbol rp2 = rp.Concat(st, p1);

            XAssert.AreEqual(@"AAA.BBBXXX", rp2.ToString(st));
        }
예제 #12
0
        /// <nodoc />
        public AmbientContext(PrimitiveTypes knownTypes)
            : base(ContextName, knownTypes)
        {
            var    currentHost = Host.Current;
            var    osName      = SymbolAtom.Create(StringTable, "os");
            string osValue;

            switch (currentHost.CurrentOS)
            {
            case BuildXL.Interop.OperatingSystem.Win:
                osValue = "win";
                break;

            case BuildXL.Interop.OperatingSystem.MacOS:
                osValue = "macOS";
                break;

            case BuildXL.Interop.OperatingSystem.Unix:
                osValue = "unix";
                break;

            default:
                throw Contract.AssertFailure("Unhandled HostOS Type");
            }

            var    cpuName = SymbolAtom.Create(StringTable, "cpuArchitecture");
            string cpuValue;

            switch (currentHost.CpuArchitecture)
            {
            case HostCpuArchitecture.X86:
                cpuValue = "x86";
                break;

            case HostCpuArchitecture.X64:
                cpuValue = "x64";
                break;

            default:
                throw Contract.AssertFailure("Unhandled CpuArchitecture Type");
            }

            var isElevatedName  = SymbolAtom.Create(StringTable, "isElevated");
            var isElevatedValue = CurrentProcess.IsElevated;

            m_currentHost = ObjectLiteral.Create(
                new Binding(osName, osValue, default(LineInfo)),
                new Binding(cpuName, cpuValue, default(LineInfo)),
                new Binding(isElevatedName, isElevatedValue, default(LineInfo))
                );

            MountNameObject = Symbol("name");
            MountPathObject = Symbol("path");
        }
예제 #13
0
 public XmlContext(StringTable stringTable)
 {
     StringTable     = stringTable;
     KindField       = SymbolAtom.Create(stringTable, "kind");
     NameField       = SymbolAtom.Create(stringTable, "name");
     PrefixField     = SymbolAtom.Create(stringTable, "prefix");
     LocalField      = SymbolAtom.Create(stringTable, "local");
     NamespaceField  = SymbolAtom.Create(stringTable, "namespace");
     NodesField      = SymbolAtom.Create(stringTable, "nodes");
     AttributesField = SymbolAtom.Create(stringTable, "attributes");
     ValueField      = SymbolAtom.Create(stringTable, "value");
     TextField       = SymbolAtom.Create(stringTable, "text");
 }
예제 #14
0
        /// <inheritdoc />
        protected override bool IsQualifierDeclaration(IStatement statement)
        {
            return(statement.IsQualifierDeclaration(GetQualifierNameAsAtom(), Names.CurrentQualifier));

            SymbolAtom GetQualifierNameAsAtom()
            {
                if (!m_qualifierNameAsAtom.IsValid)
                {
                    m_qualifierNameAsAtom = SymbolAtom.Create(m_pathTable.StringTable, Names.CurrentQualifier);
                }

                return(m_qualifierNameAsAtom);
            }
        }
예제 #15
0
        /// <summary>
        /// Tries to find the object literal associated to the configuration.
        /// Since we actually support two config keywords (the legacy one is there for compat reasons), we need to check both cases
        /// Returns null if the result cannot be casted to an object literal.
        /// </summary>
        private ObjectLiteral ResolveConfigObjectLiteral(ModuleLiteral instantiatedModule, Context context)
        {
            var bindings = instantiatedModule.GetAllBindings(context).ToList();

            Contract.Assert(bindings.Count == 1, "Expected AstConverter to produce exactly one binding in the resulting ModuleLiteral when converting a config file");

            var binding = bindings.Single();

            return(instantiatedModule
                   .GetOrEvalFieldBinding(
                       context,
                       SymbolAtom.Create(context.StringTable, Script.Constants.Names.ConfigurationFunctionCall),
                       binding.Value,
                       instantiatedModule.Location)
                   .Value as ObjectLiteral);
        }
예제 #16
0
        private static EvaluationResult MapWithState(Context context, ArrayLiteral receiver, EvaluationResult arg0, EvaluationResult arg1, EvaluationStackFrame captures)
        {
            var closure     = Converter.ExpectClosure(arg0);
            int paramsCount = closure.Function.Params;
            var state       = arg1;
            var arrays      = new EvaluationResult[receiver.Length];

            using (var frame = EvaluationStackFrame.Create(closure.Function, captures.Frame))
            {
                var entry = context.TopStack;

                var stateName = SymbolAtom.Create(context.FrontEndContext.StringTable, "state");
                var elemsName = SymbolAtom.Create(context.FrontEndContext.StringTable, "elems");
                var elemName  = SymbolAtom.Create(context.FrontEndContext.StringTable, "elem");

                for (int i = 0; i < receiver.Length; ++i)
                {
                    frame.TrySetArguments(paramsCount, state, receiver[i], i, EvaluationResult.Create(receiver));
                    EvaluationResult mapResult = context.InvokeClosure(closure, frame);

                    if (mapResult.IsErrorValue)
                    {
                        return(EvaluationResult.Error);
                    }

                    if (!(mapResult.Value is ObjectLiteral objectResult))
                    {
                        throw Converter.CreateException <ObjectLiteral>(mapResult, default(ConversionContext));
                    }

                    arrays[i] = objectResult[elemName];
                    state     = objectResult[stateName];
                }

                var bindings = new List <Binding>
                {
                    new Binding(elemsName, ArrayLiteral.CreateWithoutCopy(arrays, entry.InvocationLocation, entry.Path), location: default(LineInfo)),
                    new Binding(stateName, state, location: default(LineInfo)),
                };
                return(EvaluationResult.Create(ObjectLiteral.Create(bindings, entry.InvocationLocation, entry.Path)));
            }
        }
예제 #17
0
        /// <nodoc />
        public AmbientContext(PrimitiveTypes knownTypes)
            : base(ContextName, knownTypes)
        {
            var    currentHost = Host.Current;
            var    osName      = SymbolAtom.Create(StringTable, "os");
            string osValue     = currentHost.CurrentOS.GetDScriptValue();

            if (string.IsNullOrEmpty(osValue))
            {
                throw Contract.AssertFailure("Unhandled HostOS Type");
            }

            var    cpuName = SymbolAtom.Create(StringTable, "cpuArchitecture");
            string cpuValue;

            switch (currentHost.CpuArchitecture)
            {
            case HostCpuArchitecture.X86:
                cpuValue = "x86";
                break;

            case HostCpuArchitecture.X64:
                cpuValue = "x64";
                break;

            default:
                throw Contract.AssertFailure("Unhandled CpuArchitecture Type");
            }

            var isElevatedName  = SymbolAtom.Create(StringTable, "isElevated");
            var isElevatedValue = CurrentProcess.IsElevated;

            m_currentHost = ObjectLiteral.Create(
                new Binding(osName, osValue, default(LineInfo)),
                new Binding(cpuName, cpuValue, default(LineInfo)),
                new Binding(isElevatedName, isElevatedValue, default(LineInfo))
                );

            MountNameObject = Symbol("name");
            MountPathObject = Symbol("path");
        }
예제 #18
0
        /// <summary>
        /// Creates a simulation of a local scope such that passed local variable indexes match
        /// </summary>
        private static FunctionScope BuildLocalScopeForLocalVars(Context context, StackEntry stackEntry)
        {
            var stringTable = context.StringTable;
            var localScope  = new FunctionScope();

            var localVariables = DebugInfo.ComputeCurrentLocals(stackEntry);

            if (localVariables.Count == 0)
            {
                return(localScope);
            }

            // Sort variables by index
            var localsByIndex = new SortedDictionary <int, ILocalVar>();

            foreach (var localVar in localVariables)
            {
                localsByIndex[localVar.Index] = localVar;
            }

            // Construct a local scope where variable indexes are respected, filling with dummy variables if there are holes in the index range
            int currentIndex = 0;

            foreach (int index in localsByIndex.Keys)
            {
                Contract.Assert(currentIndex <= index);

                while (index != currentIndex)
                {
                    var dummyIndex = localScope.AddVariable(SymbolAtom.Create(stringTable, "__dummy_var__" + currentIndex), default(UniversalLocation), isConstant: false);
                    Contract.Assert(dummyIndex != null);
                    currentIndex++;
                }

                var indexResult = localScope.AddVariable(localsByIndex[index].Name, default(UniversalLocation), isConstant: false);
                Contract.Assert(indexResult == index);
                currentIndex++;
            }

            return(localScope);
        }
        public void TestFunctionDeclaration()
        {
            var symbolAtom           = SymbolAtom.Create(m_stringTable, "y");
            FunctionDeclaration node = new FunctionDeclaration(
                new List <SymbolAtom>
            {
                GetSymbolAtom(),
                symbolAtom
            },
                GetSymbolAtom(),
                GetCallSignature(),
                GetStatement1(),
                captures: 0,
                locals: 0,
                modifier: Declaration.DeclarationFlags.Export,
                location: DefaultLineInfo,
                stringTable: StringTable);
            var deserialized = CheckSerializationRoundTrip(node);

            Assert.NotNull(deserialized.Statistic);
        }
예제 #20
0
        public void Combine()
        {
            var        idt = new SymbolTable();
            FullSymbol a1  = FullSymbol.Create(idt, @"C");
            SymbolAtom p1  = SymbolAtom.Create(idt.StringTable, "A");
            FullSymbol a2  = a1.Combine(idt, p1);

            XAssert.AreEqual(@"C.A", a2.ToString(idt));

            a1 = FullSymbol.Create(idt, @"C.X");
            p1 = SymbolAtom.Create(idt.StringTable, "A");
            a2 = a1.Combine(idt, p1);
            XAssert.AreEqual(@"C.X.A", a2.ToString(idt));

            a1 = FullSymbol.Create(idt, @"C.X");
            p1 = SymbolAtom.Create(idt.StringTable, "A");
            SymbolAtom p2 = SymbolAtom.Create(idt.StringTable, "B");

            a2 = a1.Combine(idt, p1, p2);
            XAssert.AreEqual(@"C.X.A.B", a2.ToString(idt));

            a1 = FullSymbol.Create(idt, @"C.X");
            p1 = SymbolAtom.Create(idt.StringTable, "A");
            p2 = SymbolAtom.Create(idt.StringTable, "B");
            SymbolAtom p3 = SymbolAtom.Create(idt.StringTable, "C");

            a2 = a1.Combine(idt, p1, p2, p3);
            XAssert.AreEqual(@"C.X.A.B.C", a2.ToString(idt));

            a1 = FullSymbol.Create(idt, @"C");
            PartialSymbol rp = PartialSymbol.Create(idt.StringTable, @"A.B");

            a2 = a1.Combine(idt, rp);
            XAssert.AreEqual(@"C.A.B", a2.ToString(idt));

            a1 = FullSymbol.Create(idt, @"C.X");
            rp = PartialSymbol.Create(idt.StringTable, @"A.B");
            a2 = a1.Combine(idt, rp);
            XAssert.AreEqual(@"C.X.A.B", a2.ToString(idt));
        }
예제 #21
0
        /// <inheritdoc/>
        protected override EvaluationResult DoEval(Context context, ModuleLiteral env, EvaluationStackFrame frame)
        {
            var result = m_expression.Eval(context, env, frame);

            if (result.IsErrorValue)
            {
                return(result);
            }

            if (!(result.Value is ModuleLiteral module))
            {
                var thisNodeType = nameof(ModuleToObjectLiteral);
                throw Contract.AssertFailure(
                          $"AstConverter should never create a '{thisNodeType}' node that wraps an expression that evaluates to something other than {nameof(ModuleLiteral)}. " +
                          $"Instead, this '{thisNodeType}' wraps an expression of type '{m_expression.GetType().Name}' which evaluated to an instance of type '{result.Value?.GetType().Name}'.");
            }

            var bindings = module
                           .GetAllBindings(context)
                           .Where(kvp => kvp.Key != Constants.Names.RuntimeRootNamespaceAlias)
                           .Select(kvp =>
            {
                var name       = SymbolAtom.Create(context.StringTable, kvp.Key);
                var location   = kvp.Value.Location;
                var evalResult = module.GetOrEvalFieldBinding(context, name, kvp.Value, location);
                return(new Binding(name, evalResult.Value, location));
            })
                           .ToArray();

            if (bindings.Any(b => b.Body.IsErrorValue()))
            {
                return(EvaluationResult.Error);
            }

            var objectLiteral = ObjectLiteral.Create(bindings);

            return(EvaluationResult.Create(objectLiteral));
        }
예제 #22
0
        /// <nodoc />
        public Literals(StringTable stringTable)
        {
            Contract.Requires(stringTable != null);

            m_stringTable = stringTable;

            Obsolete        = SymbolAtom.Create(stringTable, ObsoleteString);
            ForeignFunction = SymbolAtom.Create(stringTable, ForeignFunctionString);

            PathNamespace         = SymbolAtom.Create(stringTable, "Path");
            RelativePathNamespace = SymbolAtom.Create(stringTable, "RelativePath");
            PathAtomNamespace     = SymbolAtom.Create(stringTable, "PathAtom");
            PathCombine           = SymbolAtom.Create(stringTable, "combine");
            PathCombinePaths      = SymbolAtom.Create(stringTable, "combinePaths");
            PathInterpolate       = SymbolAtom.Create(stringTable, Literals.InterpolateString);
            ArrayConcat           = SymbolAtom.Create(stringTable, "concat");
            FileNamespace         = SymbolAtom.Create(stringTable, "File");
            DirectoryNamespace    = SymbolAtom.Create(stringTable, "Directory");
            FileDirCreate         = SymbolAtom.Create(stringTable, "fromPath");
            InlineImportFrom      = SymbolAtom.Create(stringTable, Names.InlineImportFunction);
            DotDscExtension       = PathAtom.Create(stringTable, Names.DotDscExtension);
            ConfigDsc             = PathAtom.Create(stringTable, Names.ConfigDsc);
            ConfigBc   = PathAtom.Create(stringTable, Names.ConfigBc);
            PackageDsc = PathAtom.Create(stringTable, Names.PackageDsc);
            this.DotConfigDotDscExtension = PathAtom.Create(stringTable, Names.DotConfigDotDscExtension);
            PackageConfigDsc            = PathAtom.Create(stringTable, Names.PackageConfigDsc);
            ModuleConfigBm              = PathAtom.Create(stringTable, Names.ModuleConfigBm);
            ModuleConfigDsc             = PathAtom.Create(stringTable, Names.ModuleConfigDsc);
            ConfigurationKeyword        = SymbolAtom.Create(stringTable, Names.ConfigurationFunctionCall);
            LegacyPackageKeyword        = SymbolAtom.Create(stringTable, Names.LegacyModuleConfigurationFunctionCall);
            ModuleKeyword               = SymbolAtom.Create(stringTable, Names.ModuleConfigurationFunctionCall);
            QualifierDeclarationKeyword = SymbolAtom.Create(stringTable, Names.CurrentQualifier);
            WithQualifierKeyword        = SymbolAtom.Create(stringTable, Names.WithQualifierFunction);
            RuntimeRootNamespaceSymbol  = SymbolAtom.Create(stringTable, Names.RuntimeRootNamespaceAlias);
            TemplateReference           = SymbolAtom.Create(stringTable, Names.TemplateReference);
            UndefinedLiteral            = SymbolAtom.Create(stringTable, "undefined");
            CustomMergeFunction         = SymbolAtom.Create(stringTable, Names.CustomMergeFunctionName);
        }
예제 #23
0
 /// <nodoc />
 public AmbientObject(PrimitiveTypes knownTypes)
     : base("Object", knownTypes)
 {
     m_customMergeFunction = SymbolAtom.Create(knownTypes.StringTable, Constants.Names.CustomMergeFunctionName);
 }
예제 #24
0
 private SymbolAtom CreateSymbol(string name) => SymbolAtom.Create(RuntimeModelContext.StringTable, name);
예제 #25
0
 /// <summary>
 /// Creates name.
 /// </summary>
 public SymbolAtom Create(string name)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(name));
     return(SymbolAtom.Create(m_stringTable, name));
 }
예제 #26
0
 /// <summary>
 /// Gets named type reference from a string.
 /// </summary>
 /// <remarks>This method should only be used temporarily to handle unexpected types.</remarks>
 public Type CreateNamedTypeReference(string name)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(name));
     return(new NamedTypeReference(SymbolAtom.Create(StringTable, name)));
 }
예제 #27
0
 private SymbolAtom CreateSymbol(string name)
 {
     return(SymbolAtom.Create(RuntimeModelContext.StringTable, name));
 }
 public SymbolAtom GetSymbolAtom() => SymbolAtom.Create(m_stringTable, "x");
예제 #29
0
 /// <nodoc />
 protected SymbolAtom Symbol(string name)
 {
     return(SymbolAtom.Create(StringTable, name));
 }