OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 part of dart2js.js_emitter; | |
6 | |
7 /// Enables debugging of fast/slow objects using V8-specific primitives. | |
8 const DEBUG_FAST_OBJECTS = false; | |
9 | |
10 /** | |
11 * Call-back for adding stub [function] for [selector]. | |
12 */ | |
13 typedef void AddStubFunction(Selector selector, jsAst.Fun function); | |
14 | |
15 /** | |
16 * Call-back for adding property with [name] and [value]. | |
17 */ | |
18 typedef jsAst.Property AddPropertyFunction(String name, jsAst.Expression value); | |
19 | |
20 /** | |
21 * [member] is a field (instance, static, or top level). | |
22 * | |
23 * [name] is the field name that the [Namer] has picked for this field's | |
24 * storage, that is, the JavaScript property name. | |
25 * | |
26 * [accessorName] is the name of the accessor. For instance fields this is | |
27 * mostly the same as [name] except when [member] is shadowing a field in its | |
28 * superclass. For other fields, they are rarely the same. | |
29 * | |
30 * [needsGetter] and [needsSetter] represent if a getter or a setter | |
31 * respectively is needed. There are many factors in this, for example, if the | |
32 * accessor can be inlined. | |
33 * | |
34 * [needsCheckedSetter] indicates that a checked getter is needed, and in this | |
35 * case, [needsSetter] is always false. [needsCheckedSetter] is only true when | |
36 * type assertions are enabled (checked mode). | |
37 */ | |
38 typedef void AcceptField(VariableElement member, | |
39 String name, | |
40 String accessorName, | |
41 bool needsGetter, | |
42 bool needsSetter, | |
43 bool needsCheckedSetter); | |
44 | |
45 // Function signatures used in the generation of runtime type information. | |
46 typedef void FunctionTypeSignatureEmitter(Element method, | |
47 FunctionType methodType); | |
48 | |
49 typedef void SubstitutionEmitter(Element element, {bool emitNull}); | |
50 | |
51 const String GENERATED_BY = """ | |
52 // Generated by dart2js, the Dart to JavaScript compiler. | |
53 """; | |
54 | |
55 const String HOOKS_API_USAGE = """ | |
56 // The code supports the following hooks: | |
57 // dartPrint(message): | |
58 // if this function is defined it is called instead of the Dart [print] | |
59 // method. | |
60 // | |
61 // dartMainRunner(main, args): | |
62 // if this function is defined, the Dart [main] method will not be invoked | |
63 // directly. Instead, a closure that will invoke [main], and its arguments | |
64 // [args] is passed to [dartMainRunner]. | |
65 """; | |
66 | |
67 // Compact field specifications. The format of the field specification is | |
68 // <accessorName>:<fieldName><suffix> where the suffix and accessor name | |
69 // prefix are optional. The suffix directs the generation of getter and | |
70 // setter methods. Each of the getter and setter has two bits to determine | |
71 // the calling convention. Setter listed below, getter is similar. | |
72 // | |
73 // 00: no setter | |
74 // 01: function(value) { this.field = value; } | |
75 // 10: function(receiver, value) { receiver.field = value; } | |
76 // 11: function(receiver, value) { this.field = value; } | |
77 // | |
78 // The suffix encodes 4 bits using three ASCII ranges of non-identifier | |
79 // characters. | |
80 const FIELD_CODE_CHARACTERS = r"<=>?@{|}~%&'()*"; | |
81 const NO_FIELD_CODE = 0; | |
82 const FIRST_FIELD_CODE = 1; | |
83 const RANGE1_FIRST = 0x3c; // <=>?@ encodes 1..5 | |
84 const RANGE1_LAST = 0x40; | |
85 const RANGE2_FIRST = 0x7b; // {|}~ encodes 6..9 | |
86 const RANGE2_LAST = 0x7e; | |
87 const RANGE3_FIRST = 0x25; // %&'()*+ encodes 10..16 | |
88 const RANGE3_LAST = 0x2b; | |
OLD | NEW |