Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/macros.tmpl

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {# 1 {#
2 FIXME: Do we need to put license blocks in generated files? 2 FIXME: Do we need to put license blocks in generated files?
3 #} 3 #}
4 {% macro license() %} 4 {% macro license() %}
5 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 5 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style license that can be 6 // Use of this source code is governed by a BSD-style license that can be
7 // found in the LICENSE file. 7 // found in the LICENSE file.
8 {%- endmacro %} 8 {%- endmacro %}
9 9
10 10
11 {% macro trie_leaf(index, object, return_macro, lowercase_data) %} 11 {% macro trie_leaf(index, object, return_macro, lowercase_data) %}
12 {% set name, value = object.items()[0] %} 12 {% set name, value = object.items()[0] %}
13 {% if name|length %} 13 {% if name|length %}
14 if ( 14 if (
15 {%- for c in name -%} 15 {%- for c in name -%}
16 {%- if lowercase_data -%} 16 {%- if lowercase_data -%}
17 {{ " && " if not loop.first }}toASCIILower(data[{{index + loop.index0}}]) == '{{c}}' 17 {{ " && " if not loop.first }}ToASCIILower(data[{{index + loop.index0}}]) == '{{c}}'
18 {%- else -%} 18 {%- else -%}
19 {{ " && " if not loop.first }}data[{{index + loop.index0}}] == '{{c}}' 19 {{ " && " if not loop.first }}data[{{index + loop.index0}}] == '{{c}}'
20 {%- endif -%} 20 {%- endif -%}
21 {%- endfor -%} 21 {%- endfor -%}
22 ) 22 )
23 return {{ return_macro(value) }}; 23 return {{ return_macro(value) }};
24 break; 24 break;
25 {% else %} 25 {% else %}
26 return {{ return_macro(value) }}; 26 return {{ return_macro(value) }};
27 {% endif %} 27 {% endif %}
28 {% endmacro %} 28 {% endmacro %}
29 29
30 30
31 {% macro trie_switch(trie, index, return_macro, lowercase_data) %} 31 {% macro trie_switch(trie, index, return_macro, lowercase_data) %}
32 {% if trie|length == 1 and trie.values()[0] is string %} 32 {% if trie|length == 1 and trie.values()[0] is string %}
33 {{ trie_leaf(index, trie, return_macro, lowercase_data) -}} 33 {{ trie_leaf(index, trie, return_macro, lowercase_data) -}}
34 {% else %} 34 {% else %}
35 {% if lowercase_data %} 35 {% if lowercase_data %}
36 switch (toASCIILower(data[{{index}}])) { 36 switch (ToASCIILower(data[{{index}}])) {
37 {% else %} 37 {% else %}
38 switch (data[{{index}}]) { 38 switch (data[{{index}}]) {
39 {% endif %} 39 {% endif %}
40 {% for char, value in trie.items()|sort %} 40 {% for char, value in trie.items()|sort %}
41 case '{{char}}': 41 case '{{char}}':
42 {{ trie_switch(value, index + 1, return_macro, lowercase_data) | indent(4) } } 42 {{ trie_switch(value, index + 1, return_macro, lowercase_data) | indent(4) } }
43 {% endfor %} 43 {% endfor %}
44 } 44 }
45 break; 45 break;
46 {% endif %} 46 {% endif %}
47 {% endmacro %} 47 {% endmacro %}
48 48
49 49
50 {% macro trie_length_switch(length_tries, return_macro, lowercase_data) %} 50 {% macro trie_length_switch(length_tries, return_macro, lowercase_data) %}
51 switch (length) { 51 switch (length) {
52 {% for length, trie in length_tries %} 52 {% for length, trie in length_tries %}
53 case {{ length }}: 53 case {{ length }}:
54 {{ trie_switch(trie, 0, return_macro, lowercase_data) | indent(4) }} 54 {{ trie_switch(trie, 0, return_macro, lowercase_data) | indent(4) }}
55 {% endfor %} 55 {% endfor %}
56 } 56 }
57 {% endmacro %} 57 {% endmacro %}
58 58
59 59
60 {% macro print_if(predicate, str) -%} 60 {% macro print_if(predicate, str) -%}
61 {% if predicate %}{{str}}{% endif %} 61 {% if predicate %}{{str}}{% endif %}
62 {%- endmacro %} 62 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698