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)); }
public bool HasLocal(string name) { return(this.Locals.ContainsKey(name) || (OuterBlock != null && OuterBlock.HasLocal(name))); }
public Local GetLocal(string name) { return(this.Locals.ContainsKey(name) ? this.Locals[name] : OuterBlock?.GetLocal(name)); }
protected override void LLWrite(ICodeWriter writer, object o) { OuterBlock.WriteAll(writer); }