OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.body_builder; | 5 library fasta.body_builder; |
6 | 6 |
7 import '../parser/parser.dart' show FormalParameterType, optional; | 7 import '../parser/parser.dart' show FormalParameterType, optional; |
8 | 8 |
9 import '../parser/error_kind.dart' show ErrorKind; | 9 import '../parser/error_kind.dart' show ErrorKind; |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 Expression popForEffect() => toEffect(pop()); | 163 Expression popForEffect() => toEffect(pop()); |
164 | 164 |
165 Expression popForValueIfNotNull(Object value) { | 165 Expression popForValueIfNotNull(Object value) { |
166 return value == null ? null : popForValue(); | 166 return value == null ? null : popForValue(); |
167 } | 167 } |
168 | 168 |
169 @override | 169 @override |
170 Expression toValue(Object node) { | 170 Expression toValue(Object node) { |
171 if (node is UnresolvedIdentifier) { | 171 if (node is UnresolvedIdentifier) { |
| 172 if (isDartLibrary && |
| 173 node.name.name == "main" && |
| 174 library.uri.path == "_builtin" && |
| 175 member?.name == "_getMainClosure") { |
| 176 // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989 |
| 177 return new NullLiteral()..fileOffset = node.fileOffset; |
| 178 } |
172 return throwNoSuchMethodError( | 179 return throwNoSuchMethodError( |
173 node.name.name, new Arguments.empty(), node.fileOffset, | 180 node.name.name, new Arguments.empty(), node.fileOffset, |
174 isGetter: true); | 181 isGetter: true); |
175 } else if (node is BuilderAccessor) { | 182 } else if (node is BuilderAccessor) { |
176 return node.buildSimpleRead(); | 183 return node.buildSimpleRead(); |
177 } else if (node is TypeVariableBuilder) { | 184 } else if (node is TypeVariableBuilder) { |
178 TypeParameterType type = node.buildTypesWithBuiltArguments(library, null); | 185 TypeParameterType type = node.buildTypesWithBuiltArguments(library, null); |
179 if (!isInstanceContext && type.parameter.parent is Class) { | 186 if (!isInstanceContext && type.parameter.parent is Class) { |
180 return buildCompileTimeError( | 187 return buildCompileTimeError( |
181 "Type variables can only be used in instance methods."); | 188 "Type variables can only be used in instance methods."); |
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 } else if (node is TypeDeclarationBuilder) { | 2702 } else if (node is TypeDeclarationBuilder) { |
2696 return node.name; | 2703 return node.name; |
2697 } else if (node is PrefixBuilder) { | 2704 } else if (node is PrefixBuilder) { |
2698 return node.name; | 2705 return node.name; |
2699 } else if (node is ThisPropertyAccessor) { | 2706 } else if (node is ThisPropertyAccessor) { |
2700 return node.name.name; | 2707 return node.name.name; |
2701 } else { | 2708 } else { |
2702 return internalError("Unhandled: ${node.runtimeType}"); | 2709 return internalError("Unhandled: ${node.runtimeType}"); |
2703 } | 2710 } |
2704 } | 2711 } |
OLD | NEW |