client-server command are done
This commit is contained in:
parent
6b7f7acd46
commit
ff5f1ec141
|
|
@ -547,7 +547,7 @@ Future plans
|
|||
console.log(name);
|
||||
}, this);
|
||||
|
||||
|
||||
- `@use client` and `@use server` commands
|
||||
- static typing
|
||||
- `@use` expressions
|
||||
|
||||
|
|
|
|||
|
|
@ -1253,7 +1253,7 @@ Cola.Parser.prototype.statement = Cola.Parser.embed_tokens(function() {
|
|||
if (!this.is("name")) this.unexpected();
|
||||
args.push(this.S.token.value);
|
||||
|
||||
if (this.S.token.value == 'closure') {
|
||||
if (this.S.token.value == 'closure' || this.S.token.value == 'server' || this.S.token.value == 'client') {
|
||||
this.next();
|
||||
args.push(this.is("punc","{"), new Cola.AST_BlockStatement({
|
||||
start : this.S.token,
|
||||
|
|
|
|||
|
|
@ -3261,22 +3261,32 @@ Cola.AST_Toplevel.prototype.toJavaScript = function(options){
|
|||
argnames : []
|
||||
});
|
||||
|
||||
if (node.args[1]){
|
||||
|
||||
_ColaRuntime$$hash[Cola._ColaRuntime$$arguments_def.i] = true;
|
||||
|
||||
props = new Cola.AST_Dot({
|
||||
expression : props,
|
||||
property : "apply"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
node = new Cola.AST_Call({
|
||||
args : node.args[1] ? [new Cola.AST_SymbolRef({ name : "this" }), new Cola.AST_SymbolRef({ name : "arguments" })] : [],
|
||||
args : [new Cola.AST_SymbolRef({ name : "this" }), new Cola.AST_SymbolRef({ name : "arguments" })],
|
||||
expression : props
|
||||
});
|
||||
node = new Cola.AST_SimpleStatement({ body : node });
|
||||
} else
|
||||
|
||||
if (node.args[0] == "client") {
|
||||
if (options.is_node) return false;
|
||||
node = new Cola.AST_BlockStatement({ body: node.args[2].body });
|
||||
} else
|
||||
|
||||
if (node.args[0] == "server") {
|
||||
if (!options.is_node) return false;
|
||||
node = new Cola.AST_BlockStatement({ body: node.args[2].body });
|
||||
} else
|
||||
|
||||
node = new Cola.AST_Directive({ value : "use " + node.args[0] });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user