This decision holds that Civil Code 1717 does not authorize a trial court to award attorney fees before entry of final judgment. Here, the trial court granted summary adjudication for plaintiff on contract claims, but tort and statutory claims remained unresolved. The summary adjudication order was not a final judgment. It was subject to modification under the court’s inherent power. Civil Code section 1717 allows fee awards only after entry of a final judgment.