OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
6 class Parameter { | 6 class Parameter { |
7 FormalNode definition; | 7 FormalNode definition; |
8 | 8 |
9 String name; | 9 String name; |
10 Type type; | 10 Type type; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool get isOptional() => definition != null && definition.value != null; | 71 bool get isOptional() => definition != null && definition.value != null; |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 interface Named { | 75 interface Named { |
76 String get name(); | 76 String get name(); |
77 Library get library(); | 77 Library get library(); |
78 bool get isNative(); | 78 bool get isNative(); |
79 String get jsname(); | 79 String get jsname(); |
80 set jsname(String name); | 80 set jsname(String name); |
| 81 |
| 82 SourceSpan get span(); |
81 } | 83 } |
82 | 84 |
83 class Member implements Named { | 85 class Member implements Named { |
84 final String name; | 86 final String name; |
85 final Type declaringType; | 87 final Type declaringType; |
86 | 88 |
87 String _jsname; | 89 String _jsname; |
88 | 90 |
89 bool isGenerated; | 91 bool isGenerated; |
90 MethodGenerator generator; | 92 MethodGenerator generator; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 246 |
245 void resolve(Type inType) {} | 247 void resolve(Type inType) {} |
246 | 248 |
247 Value _get(MethodGenerator context, Node node, Value target, | 249 Value _get(MethodGenerator context, Node node, Value target, |
248 [bool isDynamic=false]) { | 250 [bool isDynamic=false]) { |
249 return new Value.type(type, node.span); | 251 return new Value.type(type, node.span); |
250 } | 252 } |
251 | 253 |
252 Value _set(MethodGenerator context, Node node, Value target, Value value, | 254 Value _set(MethodGenerator context, Node node, Value target, Value value, |
253 [bool isDynamic=false]) { | 255 [bool isDynamic=false]) { |
254 world.error('can not set type', node.span); | 256 world.error('cannot set type', node.span); |
255 } | 257 } |
256 | 258 |
257 Value invoke(MethodGenerator context, Node node, Value target, Arguments args, | 259 Value invoke(MethodGenerator context, Node node, Value target, Arguments args, |
258 [bool isDynamic=false]) { | 260 [bool isDynamic=false]) { |
259 world.error('can not invoke type', node.span); | 261 world.error('cannot invoke type', node.span); |
260 } | 262 } |
261 } | 263 } |
262 | 264 |
263 /** Represents a Dart field from source code. */ | 265 /** Represents a Dart field from source code. */ |
264 class FieldMember extends Member { | 266 class FieldMember extends Member { |
265 final VariableDefinition definition; | 267 final VariableDefinition definition; |
266 final Expression value; | 268 final Expression value; |
267 | 269 |
268 Type type; | 270 Type type; |
269 Value _computedValue; | 271 Value _computedValue; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 750 } |
749 return -1; | 751 return -1; |
750 } | 752 } |
751 | 753 |
752 bool get prefersPropertySyntax() => true; | 754 bool get prefersPropertySyntax() => true; |
753 bool get requiresFieldSyntax() => false; | 755 bool get requiresFieldSyntax() => false; |
754 | 756 |
755 void provideFieldSyntax() { _provideFieldSyntax = true; } | 757 void provideFieldSyntax() { _provideFieldSyntax = true; } |
756 void providePropertySyntax() { _providePropertySyntax = true; } | 758 void providePropertySyntax() { _providePropertySyntax = true; } |
757 | 759 |
758 Value _set(MethodGenerator context, Node, Value target, Value value, | 760 Value _set(MethodGenerator context, Node node, Value target, Value value, |
759 [bool isDynamic=false]) { | 761 [bool isDynamic=false]) { |
760 world.error('can not set method', definition.span); | 762 world.error('cannot set method', node.span); |
761 } | 763 } |
762 | 764 |
763 Value _get(MethodGenerator context, Node node, Value target, | 765 Value _get(MethodGenerator context, Node node, Value target, |
764 [bool isDynamic=false]) { | 766 [bool isDynamic=false]) { |
765 // TODO(jimhug): Would prefer to invoke! | 767 // TODO(jimhug): Would prefer to invoke! |
766 declaringType.genMethod(this); | 768 declaringType.genMethod(this); |
767 _provideOptionalParamInfo = true; | 769 _provideOptionalParamInfo = true; |
768 if (isStatic) { | 770 if (isStatic) { |
769 // ensure the type is generated. | 771 // ensure the type is generated. |
770 // TODO(sigmund): can we avoid generating the entire type, but only what | 772 // TODO(sigmund): can we avoid generating the entire type, but only what |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 } | 1696 } |
1695 | 1697 |
1696 void forEach(void f(Member member)) { | 1698 void forEach(void f(Member member)) { |
1697 factories.forEach((_, Map constructors) { | 1699 factories.forEach((_, Map constructors) { |
1698 constructors.forEach((_, Member member) { | 1700 constructors.forEach((_, Member member) { |
1699 f(member); | 1701 f(member); |
1700 }); | 1702 }); |
1701 }); | 1703 }); |
1702 } | 1704 } |
1703 } | 1705 } |
OLD | NEW |