예제 #1
0
 public virtual void SetItem(SymbolId name, object value)
 {        //ECMA 8.6.2.2 Put
     if (!CanSetItem(name))
     {
         return;
     }
     if (members.ContainsKey(name))
     {
         members[name] = value;
     }
     else
     {
         members.Add(name, value);
     }
 }
        private IList <string> ParseLabelSymbols(string[] assemblyInstructions)
        {
            var remainingAssemblyInstructions = new List <string>();

            for (int i = 0; i < assemblyInstructions.Length; i++)
            {
                var assemblyInstruction = GetNoncomment(assemblyInstructions[i]);

                if (string.IsNullOrWhiteSpace(assemblyInstruction))
                {
                    continue;
                }

                if (IsLabelSymbol(assemblyInstruction, out string labelSymbol))
                {
                    if (!SymbolDictionary.ContainsKey(labelSymbol))
                    {
                        SymbolDictionary[labelSymbol] = remainingAssemblyInstructions.Count; // The address should be the address of the proceeding instruction.
                    }

                    continue;
                }

                remainingAssemblyInstructions.Add(assemblyInstruction);
            }

            return(remainingAssemblyInstructions);
        }