コード例 #1
0
        public static bool ResolveToStructTypeIndex(this CompilerIO self, Slice slice, out int index)
        {
            var source = self.parser.tokenizer.source;

            for (var i = 0; i < self.chunk.structTypes.count; i++)
            {
                var s = self.chunk.structTypes.buffer[i];
                if (
                    CompilerHelper.IsStructTypeVisible(self.chunk, i, self.structTypesStartIndex) &&
                    CompilerHelper.AreEqual(source, slice, s.name)
                    )
                {
                    index = i;
                    return(true);
                }
            }

            index = 0;
            return(false);
        }