| 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.fasta_accessors; | 5 library fasta.fasta_accessors; |
| 6 | 6 |
| 7 export 'frontend_accessors.dart' show wrapInvalid; | 7 export 'frontend_accessors.dart' show wrapInvalid; |
| 8 | 8 |
| 9 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' | 9 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' |
| 10 show KernelArguments, KernelMethodInvocation; | 10 show KernelArguments, KernelMethodInvocation; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 int offset}) { | 150 int offset}) { |
| 151 return helper.throwNoSuchMethodError(name ?? plainNameForWrite, arguments, | 151 return helper.throwNoSuchMethodError(name ?? plainNameForWrite, arguments, |
| 152 offset ?? offsetForToken(this.token), | 152 offset ?? offsetForToken(this.token), |
| 153 isGetter: isGetter, isSetter: isSetter, isSuper: isSuper); | 153 isGetter: isGetter, isSetter: isSetter, isSuper: isSuper); |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool get isThisPropertyAccessor => false; | 156 bool get isThisPropertyAccessor => false; |
| 157 } | 157 } |
| 158 | 158 |
| 159 abstract class ErrorAccessor implements FastaAccessor { | 159 abstract class ErrorAccessor implements FastaAccessor { |
| 160 @override | |
| 161 Expression get builtBinary => internalError("Unsupported operation."); | |
| 162 | |
| 163 @override | |
| 164 void set builtBinary(Expression expression) { | |
| 165 internalError("Unsupported operation."); | |
| 166 } | |
| 167 | |
| 168 @override | |
| 169 Expression get builtGetter => internalError("Unsupported operation."); | |
| 170 | |
| 171 @override | |
| 172 void set builtGetter(Expression expression) { | |
| 173 internalError("Unsupported operation."); | |
| 174 } | |
| 175 | |
| 176 /// Pass [arguments] that must be evaluated before throwing an error. At | 160 /// Pass [arguments] that must be evaluated before throwing an error. At |
| 177 /// most one of [isGetter] and [isSetter] should be true and they're passed | 161 /// most one of [isGetter] and [isSetter] should be true and they're passed |
| 178 /// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used. | 162 /// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used. |
| 179 Expression buildError(Arguments arguments, | 163 Expression buildError(Arguments arguments, |
| 180 {bool isGetter: false, bool isSetter: false, int offset}); | 164 {bool isGetter: false, bool isSetter: false, int offset}); |
| 181 | 165 |
| 182 Name get name => internalError("Unsupported operation."); | 166 Name get name => internalError("Unsupported operation."); |
| 183 | 167 |
| 184 @override | 168 @override |
| 185 String get plainNameForRead => name.name; | 169 String get plainNameForRead => name.name; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 251 |
| 268 final Token token; | 252 final Token token; |
| 269 | 253 |
| 270 final bool isInitializer; | 254 final bool isInitializer; |
| 271 | 255 |
| 272 final bool isSuper; | 256 final bool isSuper; |
| 273 | 257 |
| 274 ThisAccessor(this.helper, this.token, this.isInitializer, | 258 ThisAccessor(this.helper, this.token, this.isInitializer, |
| 275 {this.isSuper: false}); | 259 {this.isSuper: false}); |
| 276 | 260 |
| 277 @override | |
| 278 Expression get builtBinary => internalError("Unsupported operation."); | |
| 279 | |
| 280 @override | |
| 281 void set builtBinary(Expression expression) { | |
| 282 internalError("Unsupported operation."); | |
| 283 } | |
| 284 | |
| 285 @override | |
| 286 Expression get builtGetter => internalError("Unsupported operation."); | |
| 287 | |
| 288 @override | |
| 289 void set builtGetter(Expression expression) { | |
| 290 internalError("Unsupported operation."); | |
| 291 } | |
| 292 | |
| 293 String get plainNameForRead => internalError(isSuper ? "super" : "this"); | 261 String get plainNameForRead => internalError(isSuper ? "super" : "this"); |
| 294 | 262 |
| 295 Expression buildSimpleRead() { | 263 Expression buildSimpleRead() { |
| 296 if (!isSuper) { | 264 if (!isSuper) { |
| 297 return new ThisExpression(); | 265 return new ThisExpression(); |
| 298 } else { | 266 } else { |
| 299 return helper.buildCompileTimeError( | 267 return helper.buildCompileTimeError( |
| 300 "Can't use `super` as an expression.", offsetForToken(token)); | 268 "Can't use `super` as an expression.", offsetForToken(token)); |
| 301 } | 269 } |
| 302 } | 270 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 abstract class IncompleteSend extends FastaAccessor { | 374 abstract class IncompleteSend extends FastaAccessor { |
| 407 final BuilderHelper helper; | 375 final BuilderHelper helper; |
| 408 | 376 |
| 409 @override | 377 @override |
| 410 final Token token; | 378 final Token token; |
| 411 | 379 |
| 412 final Name name; | 380 final Name name; |
| 413 | 381 |
| 414 IncompleteSend(this.helper, this.token, this.name); | 382 IncompleteSend(this.helper, this.token, this.name); |
| 415 | 383 |
| 416 @override | |
| 417 Expression get builtBinary => internalError("Unsupported operation."); | |
| 418 | |
| 419 @override | |
| 420 void set builtBinary(Expression expression) { | |
| 421 internalError("Unsupported operation."); | |
| 422 } | |
| 423 | |
| 424 @override | |
| 425 Expression get builtGetter => internalError("Unsupported operation."); | |
| 426 | |
| 427 @override | |
| 428 void set builtGetter(Expression expression) { | |
| 429 internalError("Unsupported operation."); | |
| 430 } | |
| 431 | |
| 432 withReceiver(Object receiver, {bool isNullAware}); | 384 withReceiver(Object receiver, {bool isNullAware}); |
| 433 } | 385 } |
| 434 | 386 |
| 435 class IncompleteError extends IncompleteSend with ErrorAccessor { | 387 class IncompleteError extends IncompleteSend with ErrorAccessor { |
| 436 final Object error; | 388 final Object error; |
| 437 | 389 |
| 438 IncompleteError(BuilderHelper helper, Token token, this.error) | 390 IncompleteError(BuilderHelper helper, Token token, this.error) |
| 439 : super(helper, token, null); | 391 : super(helper, token, null); |
| 440 | 392 |
| 441 @override | 393 @override |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 new NullLiteral(), | 875 new NullLiteral(), |
| 924 new KernelMethodInvocation( | 876 new KernelMethodInvocation( |
| 925 new VariableGet(variable), name, arguments) | 877 new VariableGet(variable), name, arguments) |
| 926 ..fileOffset = offset, | 878 ..fileOffset = offset, |
| 927 const DynamicType())); | 879 const DynamicType())); |
| 928 } else { | 880 } else { |
| 929 return new KernelMethodInvocation(receiver, name, arguments) | 881 return new KernelMethodInvocation(receiver, name, arguments) |
| 930 ..fileOffset = offset; | 882 ..fileOffset = offset; |
| 931 } | 883 } |
| 932 } | 884 } |
| OLD | NEW |