OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
6 | 6 |
7 import 'dart:collection' show HashSet, HashMap; | 7 import 'dart:collection' show HashSet, HashMap; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 JS.ArrayInitializer _emitTypeNames(List<DartType> types, | 1177 JS.ArrayInitializer _emitTypeNames(List<DartType> types, |
1178 {dynamicIsBottom: false}) { | 1178 {dynamicIsBottom: false}) { |
1179 var build = (t) => _emitTypeName(t, dynamicIsBottom: dynamicIsBottom); | 1179 var build = (t) => _emitTypeName(t, dynamicIsBottom: dynamicIsBottom); |
1180 return new JS.ArrayInitializer(types.map(build).toList()); | 1180 return new JS.ArrayInitializer(types.map(build).toList()); |
1181 } | 1181 } |
1182 | 1182 |
1183 JS.ObjectInitializer _emitTypeProperties(Map<String, DartType> types, | 1183 JS.ObjectInitializer _emitTypeProperties(Map<String, DartType> types, |
1184 {dynamicIsBottom: false}) { | 1184 {dynamicIsBottom: false}) { |
1185 var properties = <JS.Property>[]; | 1185 var properties = <JS.Property>[]; |
1186 types.forEach((name, type) { | 1186 types.forEach((name, type) { |
1187 var key = new JS.LiteralString(name); | 1187 var key = _propertyName(name); |
1188 var value = _emitTypeName(type, dynamicIsBottom: dynamicIsBottom); | 1188 var value = _emitTypeName(type, dynamicIsBottom: dynamicIsBottom); |
1189 properties.add(new JS.Property(key, value)); | 1189 properties.add(new JS.Property(key, value)); |
1190 }); | 1190 }); |
1191 return new JS.ObjectInitializer(properties); | 1191 return new JS.ObjectInitializer(properties); |
1192 } | 1192 } |
1193 | 1193 |
1194 /// Emit the pieces of a function type, as an array of return type, | 1194 /// Emit the pieces of a function type, as an array of return type, |
1195 /// regular args, and optional/named args. | 1195 /// regular args, and optional/named args. |
1196 /// If [dynamicIsBottom] is true, then dynamics in argument positions | 1196 /// If [dynamicIsBottom] is true, then dynamics in argument positions |
1197 /// will be lowered to bottom instead of Object. | 1197 /// will be lowered to bottom instead of Object. |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 | 2612 |
2613 /// A special kind of element created by the compiler, signifying a temporary | 2613 /// A special kind of element created by the compiler, signifying a temporary |
2614 /// variable. These objects use instance equality, and should be shared | 2614 /// variable. These objects use instance equality, and should be shared |
2615 /// everywhere in the tree where they are treated as the same variable. | 2615 /// everywhere in the tree where they are treated as the same variable. |
2616 class TemporaryVariableElement extends LocalVariableElementImpl { | 2616 class TemporaryVariableElement extends LocalVariableElementImpl { |
2617 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 2617 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
2618 | 2618 |
2619 int get hashCode => identityHashCode(this); | 2619 int get hashCode => identityHashCode(this); |
2620 bool operator ==(Object other) => identical(this, other); | 2620 bool operator ==(Object other) => identical(this, other); |
2621 } | 2621 } |
OLD | NEW |