Skip to content

Commit

Permalink
update 4.js
Browse files Browse the repository at this point in the history
  • Loading branch information
answershuto committed Jan 9, 2018
1 parent 27bd174 commit a758ae6
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions 4.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/
const stack = [];
let currentParent, root;

let index = 0;

function advance (n) {
index += n
html = html.substring(n)
Expand Down Expand Up @@ -195,11 +197,30 @@ function parseHTML () {
continue;
}
}
console.log('----------');
console.log('root', root);
console.log('----------');
return root;
}

function parse () {
return parseHTML();
}

function optimize (rootAst) {
function isStatic () {
if (node.type === 2) {
return false
}
if (node.type === 3) {
return true
}
}
function markStatic () {

}
}
//
var html = '<div :class="c" class="demo" v-if="isShow"><span v-for="item in sz">{{item}}</span></div>';
var index = 0;

parseHTML();
const ast = parse();
optimize(ast);

0 comments on commit a758ae6

Please sign in to comment.