Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 987be9f

Browse files
changes for playground update
1 parent 2cf5f59 commit 987be9f

File tree

8 files changed

+19
-6
lines changed

8 files changed

+19
-6
lines changed

build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import (
3131
"github.com/gopherjs/gopherjs/build/cache"
3232
"github.com/gopherjs/gopherjs/compiler"
3333
"github.com/gopherjs/gopherjs/compiler/astutil"
34+
"github.com/gopherjs/gopherjs/compiler/errlist"
3435
"github.com/gopherjs/gopherjs/compiler/incjs"
3536
"github.com/gopherjs/gopherjs/compiler/sources"
36-
"github.com/gopherjs/gopherjs/internal/errlist"
3737
"github.com/gopherjs/gopherjs/internal/sourcemapx"
3838
"github.com/gopherjs/gopherjs/internal/testmain"
3939
)

compiler/compiler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func WritePkgCode(pkg *Archive, dceSelection map[*Decl]struct{}, gls linkname.Go
325325
lines = append(lines, fmt.Sprintf("\t\t\t%s = $linknames[%q];\n", d.RefExpr, impl.String()))
326326
}
327327
if len(lines) > 0 {
328-
if _, err := writeF(w, minify, "\t\t$pkg.$initLinknames = function() {\n%s};\n", strings.Join(lines, "")); err != nil {
328+
if _, err := writeF(w, minify, "\t\t$pkg.$initLinknames = function() {\n%s\t\t};\n", strings.Join(lines, "")); err != nil {
329329
return err
330330
}
331331
}

compiler/linkname/linkname.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"strings"
88

99
"github.com/gopherjs/gopherjs/compiler/astutil"
10+
"github.com/gopherjs/gopherjs/compiler/errlist"
1011
"github.com/gopherjs/gopherjs/compiler/internal/symbol"
11-
"github.com/gopherjs/gopherjs/internal/errlist"
1212
)
1313

1414
// GoLinkname describes a go:linkname compiler directive found in the source code.

compiler/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99

1010
"golang.org/x/tools/go/types/typeutil"
1111

12+
"github.com/gopherjs/gopherjs/compiler/errlist"
1213
"github.com/gopherjs/gopherjs/compiler/internal/analysis"
1314
"github.com/gopherjs/gopherjs/compiler/internal/dce"
1415
"github.com/gopherjs/gopherjs/compiler/internal/typeparams"
1516
"github.com/gopherjs/gopherjs/compiler/sources"
1617
"github.com/gopherjs/gopherjs/compiler/typesutil"
17-
"github.com/gopherjs/gopherjs/internal/errlist"
1818
"github.com/gopherjs/gopherjs/internal/sourcemapx"
1919
)
2020

compiler/prelude/prelude.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ if (!$global.fs) {
3535
$global.fs = {
3636
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
3737
writeSync: function writeSync(fd, buf) {
38+
// check for a hook to redirect `os.Stdout` and `os.Stderr` to a different output
39+
// instead of the default `console.log`. This is useful for redirecting methods like
40+
// fmt.Println to write to a text box, like we do for the GopherJS playground.
41+
// `fd` is 1 for os.Stdout ("/dev/stdout") and 2 for os.Stderr ("/dev/stderr").
42+
// This will not work when running in node.js or another `fs` is present.
43+
// This will not effect the built-in `print` methods.
44+
if ($global.gopherjsWriteSyncHook) {
45+
outputBuf += decoder.decode(buf);
46+
$global.gopherjsWriteSyncHook(fd, outputBuf);
47+
outputBuf = "";
48+
return buf.length;
49+
}
50+
3851
outputBuf += decoder.decode(buf);
3952
var nl = outputBuf.lastIndexOf("\n");
4053
if (nl != -1) {

compiler/sources/sources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99

1010
"github.com/neelance/astrewrite"
1111

12+
"github.com/gopherjs/gopherjs/compiler/errlist"
1213
"github.com/gopherjs/gopherjs/compiler/incjs"
1314
"github.com/gopherjs/gopherjs/compiler/internal/analysis"
1415
"github.com/gopherjs/gopherjs/compiler/internal/typeparams"
1516
"github.com/gopherjs/gopherjs/compiler/linkname"
16-
"github.com/gopherjs/gopherjs/internal/errlist"
1717
)
1818

1919
// Sources is a slice of parsed Go sources and additional data for a package.

tool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import (
3232
gbuild "github.com/gopherjs/gopherjs/build"
3333
"github.com/gopherjs/gopherjs/build/cache"
3434
"github.com/gopherjs/gopherjs/compiler"
35+
"github.com/gopherjs/gopherjs/compiler/errlist"
3536
"github.com/gopherjs/gopherjs/compiler/incjs"
36-
"github.com/gopherjs/gopherjs/internal/errlist"
3737
"github.com/gopherjs/gopherjs/internal/sourcemapx"
3838
"github.com/gopherjs/gopherjs/internal/sysutil"
3939
)

0 commit comments

Comments
 (0)