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 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 5 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/visitor.dart'; | |
11 import 'package:analyzer/dart/element/type.dart'; | |
12 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; | |
10 import 'package:analyzer/src/generated/constant.dart'; | 13 import 'package:analyzer/src/generated/constant.dart'; |
11 import 'package:analyzer/src/generated/element.dart'; | 14 //TODO(leafp): Remove deprecated dependency |
15 //ignore: DEPRECATED_MEMBER_USE | |
16 import 'package:analyzer/src/generated/element.dart' | |
17 show DynamicElementImpl, DynamicTypeImpl, LocalVariableElementImpl; | |
Leaf
2016/03/14 22:47:55
There's no DynamicElement, should there be?
We
Jennifer Messerly
2016/03/14 23:12:42
We use this in one place:
// type literal
Leaf
2016/03/14 23:58:42
It does. But so does TypeParameterElement, which
Brian Wilkerson
2016/03/15 00:14:16
I made it that way because a type parameter define
Leaf
2016/03/15 00:35:14
Sorry - I meant that it might be a bug in the code
Jennifer Messerly
2016/03/15 16:23:18
+1, I think it's a bug in the code generator. You
| |
12 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 18 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
13 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 19 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
14 import 'package:analyzer/src/dart/ast/token.dart' | 20 import 'package:analyzer/src/dart/ast/token.dart' |
15 show StringToken, Token, TokenType; | 21 show StringToken, Token, TokenType; |
16 import 'package:analyzer/src/generated/type_system.dart' | 22 import 'package:analyzer/src/generated/type_system.dart' |
17 show StrongTypeSystemImpl; | 23 show StrongTypeSystemImpl; |
18 | 24 |
19 import 'ast_builder.dart' show AstBuilder; | 25 import 'ast_builder.dart' show AstBuilder; |
20 import 'reify_coercions.dart' show CoercionReifier, Tuple2; | 26 import 'reify_coercions.dart' show CoercionReifier, Tuple2; |
21 | 27 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 var type = element.type; | 496 var type = element.type; |
491 var name = js.string(type.name); | 497 var name = js.string(type.name); |
492 var id = new JS.Identifier(type.name); | 498 var id = new JS.Identifier(type.name); |
493 | 499 |
494 // Generate a class per section 13 of the spec. | 500 // Generate a class per section 13 of the spec. |
495 // TODO(vsm): Generate any accompanying metadata | 501 // TODO(vsm): Generate any accompanying metadata |
496 | 502 |
497 // Create constructor and initialize index | 503 // Create constructor and initialize index |
498 var constructor = new JS.Method( | 504 var constructor = new JS.Method( |
499 name, js.call('function(index) { this.index = index; }') as JS.Fun); | 505 name, js.call('function(index) { this.index = index; }') as JS.Fun); |
500 var fields = new List<ConstFieldElementImpl>.from( | 506 var fields = new List<FieldElement>.from( |
Leaf
2016/03/14 22:47:55
There is no ConstFieldElement. Using FieldElement
Jennifer Messerly
2016/03/14 23:12:42
seems to still be there?
https://github.com/dart-l
Leaf
2016/03/14 23:58:42
There's a ConstFieldElementImpl (which is in the p
| |
501 element.fields.where((f) => f.type == type)); | 507 element.fields.where((f) => f.type == type)); |
502 | 508 |
503 // Create toString() method | 509 // Create toString() method |
504 var properties = new List<JS.Property>(); | 510 var properties = new List<JS.Property>(); |
505 for (var i = 0; i < fields.length; ++i) { | 511 for (var i = 0; i < fields.length; ++i) { |
506 properties.add(new JS.Property( | 512 properties.add(new JS.Property( |
507 js.number(i), js.string('${type.name}.${fields[i].name}'))); | 513 js.number(i), js.string('${type.name}.${fields[i].name}'))); |
508 } | 514 } |
509 var nameMap = new JS.ObjectInitializer(properties, multiline: true); | 515 var nameMap = new JS.ObjectInitializer(properties, multiline: true); |
510 var toStringF = new JS.Method(js.string('toString'), | 516 var toStringF = new JS.Method(js.string('toString'), |
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3833 | 3839 |
3834 /// A special kind of element created by the compiler, signifying a temporary | 3840 /// A special kind of element created by the compiler, signifying a temporary |
3835 /// variable. These objects use instance equality, and should be shared | 3841 /// variable. These objects use instance equality, and should be shared |
3836 /// everywhere in the tree where they are treated as the same variable. | 3842 /// everywhere in the tree where they are treated as the same variable. |
3837 class TemporaryVariableElement extends LocalVariableElementImpl { | 3843 class TemporaryVariableElement extends LocalVariableElementImpl { |
3838 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3844 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
3839 | 3845 |
3840 int get hashCode => identityHashCode(this); | 3846 int get hashCode => identityHashCode(this); |
3841 bool operator ==(Object other) => identical(this, other); | 3847 bool operator ==(Object other) => identical(this, other); |
3842 } | 3848 } |
OLD | NEW |