public override IAstElement ProcessBeforeChildren(IdentifierExpression identifier, ProcessingContext context) { var resolved = context.ResolveIdentifier(identifier.Name); RequireExactlyOne(resolved, identifier.Name); var result = (IAstElement)resolved[0]; var property = result as IAstPropertyReference; if (property != null) { result = new AstPropertyExpression(new AstThisExpression(), property); } var function = result as IAstMethodReference; if (function != null) { result = new AstFunctionReferenceExpression(new AstThisExpression(), function); } result.SourceSpan = identifier.SourceSpan; return(result); }
private static IAstReference ResolveSingleType(ProcessingContext context, string name) { var resolved = context.ResolveIdentifier(name); if (resolved.Count == 0) { throw new NotImplementedException("ResolveTypeReferences: cannot resolve '" + name + "'."); } if (resolved.Count > 1) { throw new NotImplementedException("ResolveTypeReferences: ambiguous match for '" + name + "'."); } return(resolved.Single()); }