| 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 part of js_backend; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
| 10 | 10 |
| 11 final CodeEmitterTask emitterTask; | 11 final CodeEmitterTask emitterTask; |
| 12 | 12 |
| 13 // Whether the application contains native classes. | 13 // Whether the application contains native classes. |
| 14 bool hasNativeClasses = false; | 14 bool hasNativeClasses = false; |
| 15 | 15 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 String encoding = sb.toString(); | 208 String encoding = sb.toString(); |
| 209 | 209 |
| 210 ClassBuilder builder = builders[classElement]; | 210 ClassBuilder builder = builders[classElement]; |
| 211 if (builder == null) { | 211 if (builder == null) { |
| 212 // No builder because this is an intermediate mixin application or | 212 // No builder because this is an intermediate mixin application or |
| 213 // Interceptor - these are not direct native classes. | 213 // Interceptor - these are not direct native classes. |
| 214 if (encoding != '') { | 214 if (encoding != '') { |
| 215 Map<String, jsAst.Expression> properties = | 215 Map<String, jsAst.Expression> properties = |
| 216 additionalProperties.putIfAbsent(classElement, | 216 additionalProperties.putIfAbsent(classElement, |
| 217 () => new LinkedHashMap<String, jsAst.Expression>()); | 217 () => new Map<String, jsAst.Expression>()); |
| 218 properties[backend.namer.nativeSpecProperty] = js.string(encoding); | 218 properties[backend.namer.nativeSpecProperty] = js.string(encoding); |
| 219 } | 219 } |
| 220 } else { | 220 } else { |
| 221 builder.addProperty( | 221 builder.addProperty( |
| 222 backend.namer.nativeSpecProperty, js.string(encoding)); | 222 backend.namer.nativeSpecProperty, js.string(encoding)); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 generateClassInfo(backend.jsInterceptorClass); | 225 generateClassInfo(backend.jsInterceptorClass); |
| 226 for (ClassElement classElement in classes) { | 226 for (ClassElement classElement in classes) { |
| 227 generateClassInfo(classElement); | 227 generateClassInfo(classElement); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 targetOutput.add(';'); | 470 targetOutput.add(';'); |
| 471 } | 471 } |
| 472 targetOutput.addBuffer(jsAst.prettyPrint( | 472 targetOutput.addBuffer(jsAst.prettyPrint( |
| 473 new jsAst.ExpressionStatement(init), compiler)); | 473 new jsAst.ExpressionStatement(init), compiler)); |
| 474 targetOutput.add('\n'); | 474 targetOutput.add('\n'); |
| 475 } | 475 } |
| 476 | 476 |
| 477 targetOutput.add('\n'); | 477 targetOutput.add('\n'); |
| 478 } | 478 } |
| 479 } | 479 } |
| OLD | NEW |