Hence, they do not write or rewrite legislation.
They sometimes interpret statutes in which there is no constitutional question in play. In other words, they are settling a legal dispute interpreting a federal statute raised in a civil or criminal case.
However, they are often interpreting a constitutional question that a state or federal statute implicates.
But, as to Second Amendment, the Court has already made clear that it is not an absolute right, and is subject to limitations. What those boundaries will be, has yet to be tested.