示例#1
0
        public SemanticType LookupIdentifierType(string identifier, LexLocation location)
        {
            // First check this block.
            if (this.Locals.ContainsKey(identifier) && this.Locals[identifier].DeclarationLocation.StartLine <= location.StartLine)
            {
                return(this.Locals[identifier].RealizedType);
            }

            // Next, check the outer block.
            if (OuterBlock != null)
            {
                return(OuterBlock.LookupIdentifierType(identifier, location));
            }

            // This is the main method block of the method (no outer block), check the args and class properties.
            if (this.OwnerMethod.Arguments.ContainsKey(identifier))
            {
                return(this.OwnerMethod.Arguments[identifier].RealizedType);
            }
            return(this.OwnerMethod.OwnerClass.LookupProperty(identifier));
        }
示例#2
0
 public bool HasLocal(string name)
 {
     return(this.Locals.ContainsKey(name) || (OuterBlock != null && OuterBlock.HasLocal(name)));
 }
示例#3
0
 public Local GetLocal(string name)
 {
     return(this.Locals.ContainsKey(name) ? this.Locals[name] : OuterBlock?.GetLocal(name));
 }
示例#4
0
 protected override void LLWrite(ICodeWriter writer, object o)
 {
     OuterBlock.WriteAll(writer);
 }