Skip to content

Commit a48b7da

Browse files
committed
1.0.81 src
1 parent b2ee852 commit a48b7da

127 files changed

Lines changed: 5806 additions & 2054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extras/src/build/fan/BuildPod.fan

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,23 @@ abstract class BuildPod : BuildScript
446446
{
447447
c := Compiler(ci)
448448
c.frontend
449+
449450
esmDir := Env.cur.homeDir.plus(`lib/es/esm/`)
451+
if (Env.cur.vars.containsKey("FAN_ESM_DIR"))
452+
esmDir = Env.cur.vars["FAN_ESM_DIR"].toUri.toFile
453+
450454
Env.cur.homeDir.plus(`lib/js/node_modules/${podName}.js`).out.writeChars(c.js).flush.close
451455
if (c.esm != null)
456+
{
452457
esmDir.plus(`${podName}.js`).out.writeChars(c.esm).flush.close
453-
if (c.tsDecl != null)
454-
esmDir.plus(`${podName}.d.ts`).out.writeChars(c.tsDecl).flush.close
458+
459+
// write ts declarations
460+
t := Type.find("nodeJs::GenTsDecl", false)
461+
if (t == null) return
462+
decl := esmDir.plus(`${podName}.d.ts`).out
463+
t.make([decl, c.pod, ["allTypes":true]])->run
464+
decl.flush.close
465+
}
455466
}
456467
catch (CompilerErr err)
457468
{

extras/src/buildpods.fan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Build : BuildGroup
2727
`compilerJs/build.fan`,
2828
`compilerEs/build.fan`,
2929
`fandoc/build.fan`,
30+
`markdown/build.fan`,
3031
`concurrent/build.fan`,
3132
`util/build.fan`,
3233
`nodeJs/build.fan`,

extras/src/compiler/fan/ast/Expr.fan

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,13 +1114,14 @@ class FieldExpr : NameExpr
11141114
{
11151115
s := StrBuf.make
11161116
if (target != null) s.add(target).add(".");
1117+
if (isSafe) s.add("?")
11171118
if (!useAccessor) s.add("@")
11181119
s.add(name)
11191120
return s.toStr
11201121
}
11211122

11221123
CField? field // resolved field
1123-
Bool useAccessor // false if access using '*' storage operator
1124+
Bool useAccessor // false if access using '&' storage operator
11241125
}
11251126

11261127
**************************************************************************
@@ -1755,4 +1756,5 @@ enum class ShortcutOp
17551756
const Str methodName
17561757
const Bool isOperator
17571758
const Str symbol
1758-
}
1759+
}
1760+

extras/src/compiler/fan/ast/Stmt.fan

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ abstract class Stmt : Node
3838
**
3939
abstract Bool isDefiniteAssign(|Expr lhs->Bool| f)
4040

41+
**
42+
** Is this statement a field initialization for a once storage field.
43+
** This is used in compilerEs to skip initializing fields to "_once_"
44+
**
45+
virtual Bool isOnceFieldInit() { false }
46+
4147
//////////////////////////////////////////////////////////////////////////
4248
// Tree
4349
//////////////////////////////////////////////////////////////////////////
@@ -112,6 +118,14 @@ class ExprStmt : Stmt
112118

113119
override Bool isDefiniteAssign(|Expr lhs->Bool| f) { expr.isDefiniteAssign(f) }
114120

121+
override Bool isOnceFieldInit()
122+
{
123+
if (expr.id !== ExprId.assign) return false
124+
x := ((BinaryExpr)expr).lhs as FieldExpr
125+
if (x === null) return false
126+
return x.field.isOnce
127+
}
128+
115129
override Void walkChildren(Visitor v, VisitDepth depth)
116130
{
117131
expr = walkExpr(v, depth, expr)
@@ -657,4 +671,5 @@ enum class StmtId
657671
continueStmt,
658672
tryStmt,
659673
switchStmt
660-
}
674+
}
675+

0 commit comments

Comments
 (0)