File tree Expand file tree Collapse file tree 7 files changed +36
-11
lines changed
development-svelte-builds Expand file tree Collapse file tree 7 files changed +36
-11
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ if (DEPRECATED_PARTIALS) {
11
11
} ;
12
12
}
13
13
14
+ if ( DEPRECATED_PARTIALS && someOtherThing ( ) ) {
15
+ throw new Error ( 'You indicated you don\'t have any deprecations, however you are relying on DEPRECATED_PARTIALS.' ) ;
16
+
17
+ doStuff ( ) ;
18
+ }
19
+
14
20
export let ObjectController ;
15
21
if ( DEPRECATED_CONTROLLERS ) {
16
22
ObjectController = class {
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ if (DEPRECATED_PARTIALS) {
11
11
} ;
12
12
}
13
13
14
+ if ( DEPRECATED_PARTIALS && someOtherThing ( ) ) {
15
+ throw new Error ( "You indicated you don't have any deprecations, however you are relying on DEPRECATED_PARTIALS." ) ;
16
+ doStuff ( ) ;
17
+ }
18
+
14
19
export let ObjectController ;
15
20
16
21
if ( DEPRECATED_CONTROLLERS ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ if (DEPRECATED_PARTIALS) {
9
9
} ;
10
10
}
11
11
12
+ if ( DEPRECATED_PARTIALS && someOtherThing ( ) ) {
13
+ doStuff ( ) ;
14
+ }
15
+
12
16
export let ObjectController ;
13
17
if ( DEPRECATED_CONTROLLERS ) {
14
18
ObjectController = class {
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ if (false) {
9
9
} ;
10
10
}
11
11
12
+ if ( false && someOtherThing ( ) ) {
13
+ doStuff ( ) ;
14
+ }
15
+
12
16
export let ObjectController ;
13
17
if ( true ) {
14
18
ObjectController = class {
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ if (false) {
9
9
} ;
10
10
}
11
11
12
+ if ( false && someOtherThing ( ) ) {
13
+ doStuff ( ) ;
14
+ }
15
+
12
16
export let ObjectController ;
13
17
14
18
if ( true ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ if (DEPRECATED_PARTIALS) {
9
9
} ;
10
10
}
11
11
12
+ if ( DEPRECATED_PARTIALS && someOtherThing ( ) ) {
13
+ doStuff ( ) ;
14
+ }
15
+
12
16
export let ObjectController ;
13
17
if ( DEPRECATED_CONTROLLERS ) {
14
18
ObjectController = class {
@@ -22,4 +26,4 @@ export default class TheThingToReplaceControllers {
22
26
constructor ( ) {
23
27
this . isNew = true ;
24
28
}
25
- }
29
+ }
Original file line number Diff line number Diff line change @@ -98,12 +98,12 @@ module.exports = class Macros {
98
98
if ( binding !== undefined ) {
99
99
binding . referencePaths . forEach ( p => {
100
100
let t = builder . t ;
101
- if ( envFlags . DEBUG ) {
102
- if ( svelteMap [ source ] [ flag ] === false ) {
103
- if ( ! p . parentPath . isIfStatement ( ) ) {
104
- return ;
105
- }
106
- let consequent = p . parentPath . get ( 'consequent' ) ;
101
+ // in debug builds add an error after a conditional (to ensure if the
102
+ // specific branch is taken, an error is thrown)
103
+ if ( envFlags . DEBUG && svelteMap [ source ] [ flag ] === false ) {
104
+ let parentIfStatement = p . find ( p => p . isIfStatement ( ) ) ;
105
+ if ( parentIfStatement ) {
106
+ let consequent = parentIfStatement . get ( 'consequent' ) ;
107
107
consequent . unshiftContainer (
108
108
'body' ,
109
109
t . throwStatement (
@@ -115,10 +115,8 @@ module.exports = class Macros {
115
115
)
116
116
) ;
117
117
}
118
- } else {
119
- if ( p . parentPath . isIfStatement ( ) ) {
120
- p . replaceWith ( t . booleanLiteral ( svelteMap [ source ] [ flag ] ) ) ;
121
- }
118
+ } else if ( envFlags . DEBUG === false ) {
119
+ p . replaceWith ( t . booleanLiteral ( svelteMap [ source ] [ flag ] ) ) ;
122
120
}
123
121
} ) ;
124
122
You can’t perform that action at this time.
0 commit comments