@@ -659,17 +659,6 @@ export class DependencyGraph {
659659 }
660660 }
661661
662- /**
663- * Iterator over all formula nodes in the graph.
664- */
665- public * formulaNodes ( ) : IterableIterator < FormulaVertex > {
666- for ( const vertex of this . graph . getNodes ( ) ) {
667- if ( vertex instanceof FormulaVertex ) {
668- yield vertex
669- }
670- }
671- }
672-
673662 public * entriesFromRowsSpan ( rowsSpan : RowsSpan ) : IterableIterator < [ SimpleCellAddress , CellVertex ] > {
674663 yield * this . addressMapping . entriesFromRowsSpan ( rowsSpan )
675664 }
@@ -686,24 +675,32 @@ export class DependencyGraph {
686675 return this . addressMapping . getCell ( address )
687676 }
688677
678+ /**
679+ * Checks if the given sheet ID refers to a placeholder sheet (doesn't exist but is referenced by other sheets)
680+ */
681+ private isPlaceholder ( sheetId : number ) : boolean {
682+ return sheetId !== NamedExpressions . SHEET_FOR_WORKBOOK_EXPRESSIONS &&
683+ ! this . sheetMapping . hasSheetWithId ( sheetId , { includePlaceholders : false } )
684+ }
685+
689686 public getCellValue ( address : SimpleCellAddress ) : InterpreterValue {
690- if ( address . sheet !== NamedExpressions . SHEET_FOR_WORKBOOK_EXPRESSIONS && ! this . sheetMapping . hasSheetWithId ( address . sheet , { includePlaceholders : false } ) ) {
687+ if ( this . isPlaceholder ( address . sheet ) ) {
691688 return new CellError ( ErrorType . REF , ErrorMessage . SheetRef )
692689 }
693690
694691 return this . addressMapping . getCellValue ( address )
695692 }
696693
697694 public getRawValue ( address : SimpleCellAddress ) : RawCellContent {
698- if ( address . sheet !== NamedExpressions . SHEET_FOR_WORKBOOK_EXPRESSIONS && ! this . sheetMapping . hasSheetWithId ( address . sheet , { includePlaceholders : false } ) ) {
695+ if ( this . isPlaceholder ( address . sheet ) ) {
699696 return null
700697 }
701698
702699 return this . addressMapping . getRawValue ( address )
703700 }
704701
705702 public getScalarValue ( address : SimpleCellAddress ) : InternalScalarValue {
706- if ( address . sheet !== NamedExpressions . SHEET_FOR_WORKBOOK_EXPRESSIONS && ! this . sheetMapping . hasSheetWithId ( address . sheet , { includePlaceholders : false } ) ) {
703+ if ( this . isPlaceholder ( address . sheet ) ) {
707704 return new CellError ( ErrorType . REF , ErrorMessage . SheetRef )
708705 }
709706
@@ -1258,7 +1255,7 @@ export class DependencyGraph {
12581255
12591256 const hasDependentInExistingSheet = dependents . some ( addr => {
12601257 if ( isSimpleCellAddress ( addr ) ) {
1261- return addr . sheet === NamedExpressions . SHEET_FOR_WORKBOOK_EXPRESSIONS || this . sheetMapping . hasSheetWithId ( addr . sheet , { includePlaceholders : false } )
1258+ return ! this . isPlaceholder ( addr . sheet )
12621259 }
12631260
12641261 if ( isSimpleCellRange ( addr ) ) {
0 commit comments