Skip to content

Commit 47ac0da

Browse files
Bring back directives to fix build
1 parent 639ee25 commit 47ac0da

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Fable.Transforms/AST/AST.Babel.fs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,17 @@ type NumericLiteral(value, ?loc) =
302302
// inherit Node("Decorator", ?loc = loc)
303303
// member __.Value = value
304304
//
305-
//type DirectiveLiteral(value, ?loc) =
306-
// inherit Literal("DirectiveLiteral", ?loc = loc)
307-
// member __.Value: string = value
305+
type DirectiveLiteral(value, ?loc) =
306+
inherit Literal("DirectiveLiteral", ?loc = loc)
307+
member __.Value: string = value
308+
override _.Print(_) = failwith "not implemented"
308309

309310
/// e.g. "use strict";
310-
//type Directive(value, ?loc) =
311-
// inherit Node("Directive", ?loc = loc)
312-
// new (str, ?loc) = Directive(DirectiveLiteral str, ?loc = loc)
313-
// member __.Value: DirectiveLiteral = value
311+
type Directive(value, ?loc) =
312+
inherit Node("Directive", ?loc = loc)
313+
new (str, ?loc) = Directive(DirectiveLiteral str, ?loc = loc)
314+
member __.Value: DirectiveLiteral = value
315+
override _.Print(_) = failwith "not implemented"
314316

315317
// Program
316318

@@ -323,8 +325,8 @@ type Program(fileName, body, ?logs_, ?dependencies_, ?sourceFiles_) = // ?direct
323325
let logs = defaultArg logs_ Map.empty
324326
let sourceFiles = defaultArg sourceFiles_ [||]
325327
let dependencies = defaultArg dependencies_ [||]
326-
// let directives = defaultArg directives_ [||]
327-
// member __.Directives: Directive array = directives
328+
let directives = [||] // defaultArg directives_ [||]
329+
member __.Directives: Directive array = directives
328330
member __.SourceType: string = sourceType
329331
member __.Body: U2<Statement, ModuleDeclaration> array = body
330332
// Properties below don't belong to babel specs
@@ -346,9 +348,9 @@ type ExpressionStatement(expression, ?loc) =
346348
/// A block statement, i.e., a sequence of statements surrounded by braces.
347349
type BlockStatement(body, ?loc) = // ?directives_,
348350
inherit Statement("BlockStatement", ?loc = loc)
349-
// let directives = defaultArg directives_ [||]
351+
let directives = [||] // defaultArg directives_ [||]
352+
member __.Directives: Directive array = directives
350353
member __.Body: Statement array = body
351-
// member __.Directives: Directive array = directives
352354
override _.Print(printer) =
353355
printer.PrintBlock(body)
354356

0 commit comments

Comments
 (0)