File tree Expand file tree Collapse file tree
packages/angular_devkit/core/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export function getTypesOfSchema(schema: JsonSchema): Set<string> {
5353
5454 if ( isJsonObject ( schema . not ) ) {
5555 const notTypes = getTypesOfSchema ( schema . not ) ;
56- potentials = new Set ( [ ... potentials ] . filter ( ( p ) => ! notTypes . has ( p ) ) ) ;
56+ potentials = potentials . difference ( notTypes ) ;
5757 }
5858
5959 if ( Array . isArray ( schema . allOf ) ) {
@@ -67,7 +67,7 @@ export function getTypesOfSchema(schema: JsonSchema): Set<string> {
6767 let options = new Set < string > ( ) ;
6868 for ( const sub of schema . oneOf ) {
6969 const types = getTypesOfSchema ( sub as JsonObject ) ;
70- options = new Set ( [ ... options , ... types ] ) ;
70+ options = options . union ( types ) ;
7171 }
7272 potentials = new Set ( [ ...options ] . filter ( ( o ) => potentials . has ( o ) ) ) ;
7373 }
@@ -76,7 +76,7 @@ export function getTypesOfSchema(schema: JsonSchema): Set<string> {
7676 let options = new Set < string > ( ) ;
7777 for ( const sub of schema . anyOf ) {
7878 const types = getTypesOfSchema ( sub as JsonObject ) ;
79- options = new Set ( [ ... options , ... types ] ) ;
79+ options = options . union ( types ) ;
8080 }
8181 potentials = new Set ( [ ...options ] . filter ( ( o ) => potentials . has ( o ) ) ) ;
8282 }
Original file line number Diff line number Diff line change @@ -84,34 +84,16 @@ export class PartiallyOrderedSet<T> {
8484 const itemDeps = this . _items . get ( item ) || new Set < T > ( ) ;
8585
8686 // If the dependency list is equal, just return, otherwise remove and keep going.
87- let equal = true ;
88- for ( const dep of deps ) {
89- if ( ! itemDeps . has ( dep ) ) {
90- equal = false ;
91- break ;
92- }
93- }
94- if ( equal ) {
95- for ( const dep of itemDeps ) {
96- if ( ! deps . has ( dep ) ) {
97- equal = false ;
98- break ;
99- }
100- }
101- }
102-
103- if ( equal ) {
87+ if ( deps . size === itemDeps . size && deps . isSubsetOf ( itemDeps ) ) {
10488 return this ;
10589 } else {
10690 this . _items . delete ( item ) ;
10791 }
10892 }
10993
11094 // Verify all dependencies are part of the Set.
111- for ( const dep of deps ) {
112- if ( ! this . _items . has ( dep ) ) {
113- throw new DependencyNotFoundException ( ) ;
114- }
95+ if ( ! deps . isSubsetOf ( this . _items ) ) {
96+ throw new DependencyNotFoundException ( ) ;
11597 }
11698
11799 // Verify there's no dependency cycle.
You can’t perform that action at this time.
0 commit comments