diff --git a/BUILD.gn b/BUILD.gn index 4547c9a331..4f2bf2a5b3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -76,9 +76,9 @@ ts_sources = [ "js/dom_types.ts", "js/errors.ts", "js/fetch.ts", - "js/fileinfo.ts", + "js/file_info.ts", "js/files.ts", - "js/global-eval.ts", + "js/global_eval.ts", "js/globals.ts", "js/io.ts", "js/libdeno.ts", diff --git a/js/compiler.ts b/js/compiler.ts index 9496610dac..7eba87549c 100644 --- a/js/compiler.ts +++ b/js/compiler.ts @@ -3,7 +3,7 @@ import * as ts from "typescript"; import { assetSourceCode } from "./assets"; import * as deno from "./deno"; -import { globalEval } from "./global-eval"; +import { globalEval } from "./global_eval"; import { libdeno } from "./libdeno"; import { window } from "./globals"; import * as os from "./os"; diff --git a/js/deno.ts b/js/deno.ts index c12df1236e..53ca4c0091 100644 --- a/js/deno.ts +++ b/js/deno.ts @@ -20,6 +20,6 @@ export { libdeno } from "./libdeno"; export { platform } from "./platform"; export { trace } from "./trace"; export { truncateSync, truncate } from "./truncate"; -export { FileInfo } from "./fileinfo"; +export { FileInfo } from "./file_info"; export { connect, dial, listen, Listener, Conn } from "./net"; export const args: string[] = []; diff --git a/js/fileinfo.ts b/js/file_info.ts similarity index 100% rename from js/fileinfo.ts rename to js/file_info.ts diff --git a/js/global-eval.ts b/js/global_eval.ts similarity index 100% rename from js/global-eval.ts rename to js/global_eval.ts diff --git a/js/globals.ts b/js/globals.ts index d88e1b28de..2e6b24305e 100644 --- a/js/globals.ts +++ b/js/globals.ts @@ -5,7 +5,7 @@ import * as timers from "./timers"; import * as textEncoding from "./text_encoding"; import * as fetch_ from "./fetch"; import { libdeno } from "./libdeno"; -import { globalEval } from "./global-eval"; +import { globalEval } from "./global_eval"; import { DenoHeaders } from "./fetch"; import { DenoBlob } from "./blob"; diff --git a/js/libdeno.ts b/js/libdeno.ts index afd6f1aec5..97269c36c9 100644 --- a/js/libdeno.ts +++ b/js/libdeno.ts @@ -1,5 +1,5 @@ import { RawSourceMap } from "./types"; -import { globalEval } from "./global-eval"; +import { globalEval } from "./global_eval"; // The libdeno functions are moved so that users can't access them. type MessageCallback = (msg: Uint8Array) => void; diff --git a/js/net.ts b/js/net.ts index a0307bfe95..ccbd331ddc 100644 --- a/js/net.ts +++ b/js/net.ts @@ -1,7 +1,7 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. import { ReadResult, Reader, Writer, Closer } from "./io"; -import * as fbs from "gen/msg_generated"; +import * as msg from "gen/msg_generated"; import { assert, notImplemented } from "./util"; import * as dispatch from "./dispatch"; import { flatbuffers } from "flatbuffers"; @@ -32,14 +32,14 @@ class ListenerImpl implements Listener { async accept(): Promise { const builder = new flatbuffers.Builder(); - fbs.Accept.startAccept(builder); - fbs.Accept.addRid(builder, this.fd); - const msg = fbs.Accept.endAccept(builder); - const baseRes = await dispatch.sendAsync(builder, fbs.Any.Accept, msg); + msg.Accept.startAccept(builder); + msg.Accept.addRid(builder, this.fd); + const inner = msg.Accept.endAccept(builder); + const baseRes = await dispatch.sendAsync(builder, msg.Any.Accept, inner); assert(baseRes != null); - assert(fbs.Any.NewConn === baseRes!.msgType()); - const res = new fbs.NewConn(); - assert(baseRes!.msg(res) != null); + assert(msg.Any.NewConn === baseRes!.innerType()); + const res = new msg.NewConn(); + assert(baseRes!.inner(res) != null); return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!); } @@ -112,15 +112,15 @@ export function listen(network: Network, address: string): Listener { const builder = new flatbuffers.Builder(); const network_ = builder.createString(network); const address_ = builder.createString(address); - fbs.Listen.startListen(builder); - fbs.Listen.addNetwork(builder, network_); - fbs.Listen.addAddress(builder, address_); - const msg = fbs.Listen.endListen(builder); - const baseRes = dispatch.sendSync(builder, fbs.Any.Listen, msg); + msg.Listen.startListen(builder); + msg.Listen.addNetwork(builder, network_); + msg.Listen.addAddress(builder, address_); + const inner = msg.Listen.endListen(builder); + const baseRes = dispatch.sendSync(builder, msg.Any.Listen, inner); assert(baseRes != null); - assert(fbs.Any.ListenRes === baseRes!.msgType()); - const res = new fbs.ListenRes(); - assert(baseRes!.msg(res) != null); + assert(msg.Any.ListenRes === baseRes!.innerType()); + const res = new msg.ListenRes(); + assert(baseRes!.inner(res) != null); return new ListenerImpl(res.rid()); } @@ -154,15 +154,15 @@ export async function dial(network: Network, address: string): Promise { const builder = new flatbuffers.Builder(); const network_ = builder.createString(network); const address_ = builder.createString(address); - fbs.Dial.startDial(builder); - fbs.Dial.addNetwork(builder, network_); - fbs.Dial.addAddress(builder, address_); - const msg = fbs.Dial.endDial(builder); - const baseRes = await dispatch.sendAsync(builder, fbs.Any.Dial, msg); + msg.Dial.startDial(builder); + msg.Dial.addNetwork(builder, network_); + msg.Dial.addAddress(builder, address_); + const inner = msg.Dial.endDial(builder); + const baseRes = await dispatch.sendAsync(builder, msg.Any.Dial, inner); assert(baseRes != null); - assert(fbs.Any.NewConn === baseRes!.msgType()); - const res = new fbs.NewConn(); - assert(baseRes!.msg(res) != null); + assert(msg.Any.NewConn === baseRes!.innerType()); + const res = new msg.NewConn(); + assert(baseRes!.inner(res) != null); return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!); } diff --git a/js/read_dir.ts b/js/read_dir.ts index b1977549dc..d99b085ec2 100644 --- a/js/read_dir.ts +++ b/js/read_dir.ts @@ -2,7 +2,7 @@ import * as msg from "gen/msg_generated"; import { flatbuffers } from "flatbuffers"; import * as dispatch from "./dispatch"; -import { FileInfo, FileInfoImpl } from "./fileinfo"; +import { FileInfo, FileInfoImpl } from "./file_info"; import { assert } from "./util"; /** diff --git a/js/stat.ts b/js/stat.ts index 21d80dab38..4cfc4290fc 100644 --- a/js/stat.ts +++ b/js/stat.ts @@ -3,7 +3,7 @@ import * as msg from "gen/msg_generated"; import { flatbuffers } from "flatbuffers"; import * as dispatch from "./dispatch"; import { assert } from "./util"; -import { FileInfo, FileInfoImpl } from "./fileinfo"; +import { FileInfo, FileInfoImpl } from "./file_info"; /** * Queries the file system for information on the path provided. diff --git a/src/ops.rs b/src/ops.rs index d37f68d2c1..53163dfd49 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -600,8 +600,8 @@ fn op_close( data: &'static mut [u8], ) -> Box { assert_eq!(data.len(), 0); - let msg = base.msg_as_close().unwrap(); - let rid = msg.rid(); + let inner = base.inner_as_close().unwrap(); + let rid = inner.rid(); match resources::lookup(rid) { None => odd_future(errors::new( errors::ErrorKind::BadFileDescriptor, @@ -1039,10 +1039,10 @@ fn op_listen( } let cmd_id = base.cmd_id(); - let msg = base.msg_as_listen().unwrap(); - let network = msg.network().unwrap(); + let inner = base.inner_as_listen().unwrap(); + let network = inner.network().unwrap(); assert_eq!(network, "tcp"); - let address = msg.address().unwrap(); + let address = inner.address().unwrap(); Box::new(futures::future::result((move || { // TODO properly parse addr @@ -1052,7 +1052,7 @@ fn op_listen( let resource = resources::add_tcp_listener(listener); let builder = &mut FlatBufferBuilder::new(); - let msg = msg::ListenRes::create( + let inner = msg::ListenRes::create( builder, &msg::ListenResArgs { rid: resource.rid, @@ -1063,8 +1063,8 @@ fn op_listen( cmd_id, builder, msg::BaseArgs { - msg: Some(msg.as_union_value()), - msg_type: msg::Any::ListenRes, + inner: Some(inner.as_union_value()), + inner_type: msg::Any::ListenRes, ..Default::default() }, )) @@ -1076,7 +1076,7 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult { // TODO forward socket_addr to client. let builder = &mut FlatBufferBuilder::new(); - let msg = msg::NewConn::create( + let inner = msg::NewConn::create( builder, &msg::NewConnArgs { rid: tcp_stream_resource.rid, @@ -1087,8 +1087,8 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult { cmd_id, builder, msg::BaseArgs { - msg: Some(msg.as_union_value()), - msg_type: msg::Any::NewConn, + inner: Some(inner.as_union_value()), + inner_type: msg::Any::NewConn, ..Default::default() }, )) @@ -1105,8 +1105,8 @@ fn op_accept( } let cmd_id = base.cmd_id(); - let msg = base.msg_as_accept().unwrap(); - let server_rid = msg.rid(); + let inner = base.inner_as_accept().unwrap(); + let server_rid = inner.rid(); match resources::lookup(server_rid) { None => odd_future(errors::new( @@ -1135,10 +1135,10 @@ fn op_dial( } let cmd_id = base.cmd_id(); - let msg = base.msg_as_dial().unwrap(); - let network = msg.network().unwrap(); + let inner = base.inner_as_dial().unwrap(); + let network = inner.network().unwrap(); assert_eq!(network, "tcp"); - let address = msg.address().unwrap(); + let address = inner.address().unwrap(); // TODO properly parse addr let addr = SocketAddr::from_str(address).unwrap();