summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-25 17:21:06 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-25 17:21:12 -0400
commitcbfb7d872009f302b69a55693b5c1fbdc731be69 (patch)
tree8cc8209d35dad5267a37f503e143082dc1ce3050
parenta1c0862047c47f02fb07bcf01f35e3cf5c2266d3 (diff)
Simplify naming of CodeFetch, CodeCache
-rw-r--r--msg.proto30
-rw-r--r--os.go36
-rw-r--r--os.ts28
-rw-r--r--runtime.ts4
4 files changed, 49 insertions, 49 deletions
diff --git a/msg.proto b/msg.proto
index 28ad77e56..ee9cfceeb 100644
--- a/msg.proto
+++ b/msg.proto
@@ -12,9 +12,9 @@ message Msg {
enum Command {
ERROR = 0;
START = 1;
- SOURCE_CODE_FETCH = 2;
- SOURCE_CODE_FETCH_RES = 3;
- SOURCE_CODE_CACHE = 4;
+ CODE_FETCH = 2;
+ CODE_FETCH_RES = 3;
+ CODE_CACHE = 4;
EXIT = 5;
TIMER_START = 6;
TIMER_READY = 7;
@@ -35,23 +35,23 @@ message Msg {
string start_main_js = 13; // The contents of dist/main.js
string start_main_map = 14; // The contents of dist/main.map
- // SOURCE_CODE_FETCH
- string source_code_fetch_module_specifier = 20;
- string source_code_fetch_containing_file = 21;
+ // CODE_FETCH
+ string code_fetch_module_specifier = 20;
+ string code_fetch_containing_file = 21;
- // SOURCE_CODE_FETCH_RES
+ // CODE_FETCH_RES
// If it's a non-http module, moduleName and filename will be the same.
// For http modules, moduleName is its resolved http URL, and filename
// is the location of the locally downloaded source code.
- string source_code_fetch_res_module_name = 30;
- string source_code_fetch_res_filename = 31;
- string source_code_fetch_res_source_code = 32;
- string source_code_fetch_res_output_code = 33; // Non-empty only if cached.
+ string code_fetch_res_module_name = 30;
+ string code_fetch_res_filename = 31;
+ string code_fetch_res_source_code = 32;
+ string code_fetch_res_output_code = 33; // Non-empty only if cached.
- // SOURCE_CODE_CACHE
- string source_code_cache_filename = 41;
- string source_code_cache_source_code = 42;
- string source_code_cache_output_code = 43;
+ // CODE_CACHE
+ string code_cache_filename = 41;
+ string code_cache_source_code = 42;
+ string code_cache_output_code = 43;
// EXIT
int32 exit_code = 50;
diff --git a/os.go b/os.go
index 5af05e32c..5a96516ea 100644
--- a/os.go
+++ b/os.go
@@ -16,15 +16,15 @@ func InitOS() {
msg := &Msg{}
check(proto.Unmarshal(buf, msg))
switch msg.Command {
- case Msg_SOURCE_CODE_FETCH:
- return HandleSourceCodeFetch(
- msg.SourceCodeFetchModuleSpecifier,
- msg.SourceCodeFetchContainingFile)
- case Msg_SOURCE_CODE_CACHE:
- return HandleSourceCodeCache(
- msg.SourceCodeCacheFilename,
- msg.SourceCodeCacheSourceCode,
- msg.SourceCodeCacheOutputCode)
+ case Msg_CODE_FETCH:
+ return HandleCodeFetch(
+ msg.CodeFetchModuleSpecifier,
+ msg.CodeFetchContainingFile)
+ case Msg_CODE_CACHE:
+ return HandleCodeCache(
+ msg.CodeCacheFilename,
+ msg.CodeCacheSourceCode,
+ msg.CodeCacheOutputCode)
case Msg_EXIT:
os.Exit(int(msg.ExitCode))
default:
@@ -57,7 +57,7 @@ func ResolveModule(moduleSpecifier string, containingFile string) (
return
}
-func HandleSourceCodeFetch(moduleSpecifier string, containingFile string) (out []byte) {
+func HandleCodeFetch(moduleSpecifier string, containingFile string) (out []byte) {
assert(moduleSpecifier != "", "moduleSpecifier shouldn't be empty")
res := &Msg{}
var sourceCodeBuf []byte
@@ -76,7 +76,7 @@ func HandleSourceCodeFetch(moduleSpecifier string, containingFile string) (out [
return
}
- //println("HandleSourceCodeFetch", "moduleSpecifier", moduleSpecifier,
+ //println("HandleCodeFetch", "moduleSpecifier", moduleSpecifier,
// "containingFile", containingFile, "filename", filename)
if isRemote(moduleName) {
@@ -99,18 +99,18 @@ func HandleSourceCodeFetch(moduleSpecifier string, containingFile string) (out [
}
var sourceCode = string(sourceCodeBuf)
- var command = Msg_SOURCE_CODE_FETCH_RES
+ var command = Msg_CODE_FETCH_RES
res = &Msg{
- Command: command,
- SourceCodeFetchResModuleName: moduleName,
- SourceCodeFetchResFilename: filename,
- SourceCodeFetchResSourceCode: sourceCode,
- SourceCodeFetchResOutputCode: outputCode,
+ Command: command,
+ CodeFetchResModuleName: moduleName,
+ CodeFetchResFilename: filename,
+ CodeFetchResSourceCode: sourceCode,
+ CodeFetchResOutputCode: outputCode,
}
return
}
-func HandleSourceCodeCache(filename string, sourceCode string,
+func HandleCodeCache(filename string, sourceCode string,
outputCode string) []byte {
fn := CacheFileName(filename, []byte(sourceCode))
diff --git a/os.ts b/os.ts
index 258524afc..32988e224 100644
--- a/os.ts
+++ b/os.ts
@@ -10,33 +10,33 @@ export function exit(exitCode = 0): void {
});
}
-export function sourceCodeFetch(
+export function codeFetch(
moduleSpecifier: string,
containingFile: string
): ModuleInfo {
const res = sendMsg("os", {
- command: pb.Msg.Command.SOURCE_CODE_FETCH,
- sourceCodeFetchModuleSpecifier: moduleSpecifier,
- sourceCodeFetchContainingFile: containingFile
+ command: pb.Msg.Command.CODE_FETCH,
+ codeFetchModuleSpecifier: moduleSpecifier,
+ codeFetchContainingFile: containingFile
});
- assert(res.command === pb.Msg.Command.SOURCE_CODE_FETCH_RES);
+ assert(res.command === pb.Msg.Command.CODE_FETCH_RES);
return {
- moduleName: res.sourceCodeFetchResModuleName,
- filename: res.sourceCodeFetchResFilename,
- sourceCode: res.sourceCodeFetchResSourceCode,
- outputCode: res.sourceCodeFetchResOutputCode
+ moduleName: res.codeFetchResModuleName,
+ filename: res.codeFetchResFilename,
+ sourceCode: res.codeFetchResSourceCode,
+ outputCode: res.codeFetchResOutputCode
};
}
-export function sourceCodeCache(
+export function codeCache(
filename: string,
sourceCode: string,
outputCode: string
): void {
sendMsg("os", {
- command: pb.Msg.Command.SOURCE_CODE_CACHE,
- sourceCodeCacheFilename: filename,
- sourceCodeCacheSourceCode: sourceCode,
- sourceCodeCacheOutputCode: outputCode
+ command: pb.Msg.Command.CODE_CACHE,
+ codeCacheFilename: filename,
+ codeCacheSourceCode: sourceCode,
+ codeCacheOutputCode: outputCode
});
}
diff --git a/runtime.ts b/runtime.ts
index e95ac4b58..9fb51b69a 100644
--- a/runtime.ts
+++ b/runtime.ts
@@ -72,7 +72,7 @@ export class FileModule {
);
const compiler = Compiler.instance();
this.outputCode = compiler.compile(this.fileName);
- os.sourceCodeCache(this.fileName, this.sourceCode, this.outputCode);
+ os.codeCache(this.fileName, this.sourceCode, this.outputCode);
}
util.log("compileAndRun", this.sourceCode);
execute(this.fileName, this.outputCode);
@@ -129,7 +129,7 @@ export function resolveModule(
util.assert(moduleSpecifier != null && moduleSpecifier.length > 0);
// We ask golang to sourceCodeFetch. It will load the sourceCode and if
// there is any outputCode cached, it will return that as well.
- const { filename, sourceCode, outputCode } = os.sourceCodeFetch(
+ const { filename, sourceCode, outputCode } = os.codeFetch(
moduleSpecifier,
containingFile
);