| // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| part of dart2js.js_emitter.full_emitter; |
| |
| /// Enables debugging of fast/slow objects using V8-specific primitives. |
| const DEBUG_FAST_OBJECTS = false; |
| |
| /** |
| * Call-back for adding property with [name] and [value]. |
| */ |
| typedef jsAst.Property AddPropertyFunction(jsAst.Name name, |
| jsAst.Expression value); |
| |
| const String GENERATED_BY = """ |
| // Generated by dart2js, the Dart to JavaScript compiler. |
| """; |
| |
| const String HOOKS_API_USAGE = """ |
| // The code supports the following hooks: |
| // dartPrint(message): |
| // if this function is defined it is called instead of the Dart [print] |
| // method. |
| // |
| // dartMainRunner(main, args): |
| // if this function is defined, the Dart [main] method will not be invoked |
| // directly. Instead, a closure that will invoke [main], and its arguments |
| // [args] is passed to [dartMainRunner]. |
| // |
| // dartDeferredLibraryLoader(uri, successCallback, errorCallback): |
| // if this function is defined, it will be called when a deferered library |
| // is loaded. It should load and eval the javascript of `uri`, and call |
| // successCallback. If it fails to do so, it should call errorCallback with |
| // an error. |
| """; |
| |
| // Compact field specifications. The format of the field specification is |
| // <accessorName>:<fieldName><suffix> where the suffix and accessor name |
| // prefix are optional. The suffix directs the generation of getter and |
| // setter methods. Each of the getter and setter has two bits to determine |
| // the calling convention. Setter listed below, getter is similar. |
| // |
| // 00: no setter |
| // 01: function(value) { this.field = value; } |
| // 10: function(receiver, value) { receiver.field = value; } |
| // 11: function(receiver, value) { this.field = value; } |
| // |
| // The suffix encodes 4 bits using three ASCII ranges of non-identifier |
| // characters. |
| const FIELD_CODE_CHARACTERS = r"<=>?@{|}~%&'()*"; |
| const NO_FIELD_CODE = 0; |
| const FIRST_FIELD_CODE = 1; |
| const RANGE1_FIRST = 0x3c; // <=>?@ encodes 1..5 |
| const RANGE1_LAST = 0x40; |
| const RANGE2_FIRST = 0x7b; // {|}~ encodes 6..9 |
| const RANGE2_LAST = 0x7e; |
| const RANGE3_FIRST = 0x25; // %&'()*+ encodes 10..16 |
| const RANGE3_LAST = 0x2b; |