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 js_backend; |
6 | 6 |
7 class CodeEmitterNoEvalTask extends CodeEmitterTask { | 7 class CodeEmitterNoEvalTask extends CodeEmitterTask { |
8 CodeEmitterNoEvalTask(Compiler compiler, | 8 CodeEmitterNoEvalTask(Compiler compiler, |
9 Namer namer, | 9 Namer namer, |
10 bool generateSourceMap) | 10 bool generateSourceMap) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void emitLazyInitializedGetter(VariableElement element, CodeBuffer buffer) { | 70 void emitLazyInitializedGetter(VariableElement element, CodeBuffer buffer) { |
71 String isolate = namer.CURRENT_ISOLATE; | 71 String isolate = namer.CURRENT_ISOLATE; |
72 buffer.add(', function() { return $isolate.${namer.getName(element)}; }'); | 72 buffer.add(', function() { return $isolate.${namer.getName(element)}; }'); |
73 } | 73 } |
74 | 74 |
75 js.Expression buildConstructor(String mangledName, List<String> fieldNames) { | 75 js.Expression buildConstructor(String mangledName, List<String> fieldNames) { |
76 return new js.NamedFunction( | 76 return new js.NamedFunction( |
77 new js.VariableDeclaration(mangledName), | 77 new js.VariableDeclaration(mangledName), |
78 new js.Fun( | 78 new js.Fun( |
79 fieldNames.map((fieldName) => new js.Parameter(fieldName)), | 79 fieldNames |
| 80 .mappedBy((fieldName) => new js.Parameter(fieldName)) |
| 81 .toList(), |
80 new js.Block( | 82 new js.Block( |
81 fieldNames.map((fieldName) => | 83 fieldNames.mappedBy((fieldName) => |
82 new js.ExpressionStatement( | 84 new js.ExpressionStatement( |
83 new js.Assignment( | 85 new js.Assignment( |
84 new js.This().dot(fieldName), | 86 new js.This().dot(fieldName), |
85 new js.VariableUse(fieldName))))))); | 87 new js.VariableUse(fieldName)))) |
| 88 .toList()))); |
86 } | 89 } |
87 | 90 |
88 void emitBoundClosureClassHeader(String mangledName, | 91 void emitBoundClosureClassHeader(String mangledName, |
89 String superName, | 92 String superName, |
90 List<String> fieldNames, | 93 List<String> fieldNames, |
91 ClassBuilder builder) { | 94 ClassBuilder builder) { |
92 builder.addProperty('', buildConstructor(mangledName, fieldNames)); | 95 builder.addProperty('', buildConstructor(mangledName, fieldNames)); |
93 builder.addProperty('super', js.string(superName)); | 96 builder.addProperty('super', js.string(superName)); |
94 } | 97 } |
95 | 98 |
(...skipping 27 matching lines...) Expand all Loading... |
123 } | 126 } |
124 | 127 |
125 void emitClassFields(ClassElement classElement, | 128 void emitClassFields(ClassElement classElement, |
126 ClassBuilder builder, | 129 ClassBuilder builder, |
127 { String superClass: "", | 130 { String superClass: "", |
128 bool classIsNative: false}) { | 131 bool classIsNative: false}) { |
129 } | 132 } |
130 | 133 |
131 bool get getterAndSetterCanBeImplementedByFieldSpec => false; | 134 bool get getterAndSetterCanBeImplementedByFieldSpec => false; |
132 } | 135 } |
OLD | NEW |