| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class NativeEmitter { | 5 class NativeEmitter { |
| 6 | 6 |
| 7 CodeEmitterTask emitter; | 7 CodeEmitterTask emitter; |
| 8 CodeBuffer nativeBuffer; | 8 CodeBuffer nativeBuffer; |
| 9 | 9 |
| 10 // Classes that participate in dynamic dispatch. These are the | 10 // Classes that participate in dynamic dispatch. These are the |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // The sets could be much smaller if we could make assumptions about the | 276 // The sets could be much smaller if we could make assumptions about the |
| 277 // cls tags of other classes (which are constructor names or part of the | 277 // cls tags of other classes (which are constructor names or part of the |
| 278 // result of Object.protocls.toString). For example, if objects that are | 278 // result of Object.protocls.toString). For example, if objects that are |
| 279 // Dart objects could be easily excluded, then we might be able to simplify | 279 // Dart objects could be easily excluded, then we might be able to simplify |
| 280 // the test, replacing dozens of HTMLxxxElement classes with the regexp | 280 // the test, replacing dozens of HTMLxxxElement classes with the regexp |
| 281 // /HTML.*Element/. | 281 // /HTML.*Element/. |
| 282 | 282 |
| 283 // Temporary variables for common substrings. | 283 // Temporary variables for common substrings. |
| 284 List<String> varNames = <String>[]; | 284 List<String> varNames = <String>[]; |
| 285 // var -> expression | 285 // var -> expression |
| 286 Map<String, String> varDefns = <String>{}; | 286 Map<String, String> varDefns = <String, String>{}; |
| 287 // tag -> expression (a string or a variable) | 287 // tag -> expression (a string or a variable) |
| 288 Map<ClassElement, String> tagDefns = new Map<ClassElement, String>(); | 288 Map<ClassElement, String> tagDefns = new Map<ClassElement, String>(); |
| 289 | 289 |
| 290 String makeExpression(ClassElement classElement) { | 290 String makeExpression(ClassElement classElement) { |
| 291 // Expression fragments for this set of cls keys. | 291 // Expression fragments for this set of cls keys. |
| 292 List<String> expressions = <String>[]; | 292 List<String> expressions = <String>[]; |
| 293 // TODO: Remove if cls is abstract. | 293 // TODO: Remove if cls is abstract. |
| 294 List<String> subtags = [toNativeName(classElement)]; | 294 List<String> subtags = [toNativeName(classElement)]; |
| 295 void walk(ClassElement cls) { | 295 void walk(ClassElement cls) { |
| 296 for (final ClassElement subclass in getDirectSubclasses(cls)) { | 296 for (final ClassElement subclass in getDirectSubclasses(cls)) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (!first) targetBuffer.add(",\n"); | 426 if (!first) targetBuffer.add(",\n"); |
| 427 targetBuffer.add(" $name: $function"); | 427 targetBuffer.add(" $name: $function"); |
| 428 first = false; | 428 first = false; |
| 429 }); | 429 }); |
| 430 targetBuffer.add("\n});\n\n"); | 430 targetBuffer.add("\n});\n\n"); |
| 431 } | 431 } |
| 432 targetBuffer.add('$nativeBuffer'); | 432 targetBuffer.add('$nativeBuffer'); |
| 433 targetBuffer.add('\n'); | 433 targetBuffer.add('\n'); |
| 434 } | 434 } |
| 435 } | 435 } |
| OLD | NEW |