Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: pkg/analyzer/lib/src/dart/ast/ast.dart

Issue 2326813002: Replace and remove JavaException(s). (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.ast.ast; 5 library analyzer.src.dart.ast.ast;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 ..addAll(_arguments) 392 ..addAll(_arguments)
393 ..add(rightParenthesis); 393 ..add(rightParenthesis);
394 394
395 List<ParameterElement> get correspondingPropagatedParameters => 395 List<ParameterElement> get correspondingPropagatedParameters =>
396 _correspondingPropagatedParameters; 396 _correspondingPropagatedParameters;
397 397
398 @override 398 @override
399 void set correspondingPropagatedParameters( 399 void set correspondingPropagatedParameters(
400 List<ParameterElement> parameters) { 400 List<ParameterElement> parameters) {
401 if (parameters != null && parameters.length != _arguments.length) { 401 if (parameters != null && parameters.length != _arguments.length) {
402 throw new IllegalArgumentException( 402 throw new ArgumentError(
403 "Expected ${_arguments.length} parameters, not ${parameters.length}"); 403 "Expected ${_arguments.length} parameters, not ${parameters.length}");
404 } 404 }
405 _correspondingPropagatedParameters = parameters; 405 _correspondingPropagatedParameters = parameters;
406 } 406 }
407 407
408 List<ParameterElement> get correspondingStaticParameters => 408 List<ParameterElement> get correspondingStaticParameters =>
409 _correspondingStaticParameters; 409 _correspondingStaticParameters;
410 410
411 @override 411 @override
412 void set correspondingStaticParameters(List<ParameterElement> parameters) { 412 void set correspondingStaticParameters(List<ParameterElement> parameters) {
413 if (parameters != null && parameters.length != _arguments.length) { 413 if (parameters != null && parameters.length != _arguments.length) {
414 throw new IllegalArgumentException( 414 throw new ArgumentError(
415 "Expected ${_arguments.length} parameters, not ${parameters.length}"); 415 "Expected ${_arguments.length} parameters, not ${parameters.length}");
416 } 416 }
417 _correspondingStaticParameters = parameters; 417 _correspondingStaticParameters = parameters;
418 } 418 }
419 419
420 @override 420 @override
421 Token get endToken => rightParenthesis; 421 Token get endToken => rightParenthesis;
422 422
423 @override 423 @override
424 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 424 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
(...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after
5170 Token get beginToken { 5170 Token get beginToken {
5171 if (_typeParameters != null) { 5171 if (_typeParameters != null) {
5172 return _typeParameters.beginToken; 5172 return _typeParameters.beginToken;
5173 } else if (_parameters != null) { 5173 } else if (_parameters != null) {
5174 return _parameters.beginToken; 5174 return _parameters.beginToken;
5175 } else if (_body != null) { 5175 } else if (_body != null) {
5176 return _body.beginToken; 5176 return _body.beginToken;
5177 } 5177 }
5178 // This should never be reached because external functions must be named, 5178 // This should never be reached because external functions must be named,
5179 // hence either the body or the name should be non-null. 5179 // hence either the body or the name should be non-null.
5180 throw new IllegalStateException("Non-external functions must have a body"); 5180 throw new StateError("Non-external functions must have a body");
5181 } 5181 }
5182 5182
5183 @override 5183 @override
5184 FunctionBody get body => _body; 5184 FunctionBody get body => _body;
5185 5185
5186 @override 5186 @override
5187 void set body(FunctionBody functionBody) { 5187 void set body(FunctionBody functionBody) {
5188 _body = _becomeParentOf(functionBody as AstNodeImpl); 5188 _body = _becomeParentOf(functionBody as AstNodeImpl);
5189 } 5189 }
5190 5190
5191 @override 5191 @override
5192 Iterable get childEntities => 5192 Iterable get childEntities =>
5193 new ChildEntities()..add(_parameters)..add(_body); 5193 new ChildEntities()..add(_parameters)..add(_body);
5194 5194
5195 @override 5195 @override
5196 Token get endToken { 5196 Token get endToken {
5197 if (_body != null) { 5197 if (_body != null) {
5198 return _body.endToken; 5198 return _body.endToken;
5199 } else if (_parameters != null) { 5199 } else if (_parameters != null) {
5200 return _parameters.endToken; 5200 return _parameters.endToken;
5201 } 5201 }
5202 // This should never be reached because external functions must be named, 5202 // This should never be reached because external functions must be named,
5203 // hence either the body or the name should be non-null. 5203 // hence either the body or the name should be non-null.
5204 throw new IllegalStateException("Non-external functions must have a body"); 5204 throw new StateError("Non-external functions must have a body");
5205 } 5205 }
5206 5206
5207 @override 5207 @override
5208 FormalParameterList get parameters => _parameters; 5208 FormalParameterList get parameters => _parameters;
5209 5209
5210 @override 5210 @override
5211 void set parameters(FormalParameterList parameters) { 5211 void set parameters(FormalParameterList parameters) {
5212 _parameters = _becomeParentOf(parameters as AstNodeImpl); 5212 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5213 } 5213 }
5214 5214
(...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after
9290 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 9290 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
9291 visitor.visitStringInterpolation(this); 9291 visitor.visitStringInterpolation(this);
9292 9292
9293 @override 9293 @override
9294 void visitChildren(AstVisitor visitor) { 9294 void visitChildren(AstVisitor visitor) {
9295 _elements.accept(visitor); 9295 _elements.accept(visitor);
9296 } 9296 }
9297 9297
9298 @override 9298 @override
9299 void _appendStringValue(StringBuffer buffer) { 9299 void _appendStringValue(StringBuffer buffer) {
9300 throw new IllegalArgumentException(); 9300 throw new ArgumentError();
9301 } 9301 }
9302 } 9302 }
9303 9303
9304 /** 9304 /**
9305 * A helper for analyzing string lexemes. 9305 * A helper for analyzing string lexemes.
9306 */ 9306 */
9307 class StringLexemeHelper { 9307 class StringLexemeHelper {
9308 final String lexeme; 9308 final String lexeme;
9309 final bool isFirst; 9309 final bool isFirst;
9310 final bool isLast; 9310 final bool isLast;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
9403 * [SimpleStringLiteral] 9403 * [SimpleStringLiteral]
9404 * | [AdjacentStrings] 9404 * | [AdjacentStrings]
9405 * | [StringInterpolation] 9405 * | [StringInterpolation]
9406 */ 9406 */
9407 abstract class StringLiteralImpl extends LiteralImpl implements StringLiteral { 9407 abstract class StringLiteralImpl extends LiteralImpl implements StringLiteral {
9408 @override 9408 @override
9409 String get stringValue { 9409 String get stringValue {
9410 StringBuffer buffer = new StringBuffer(); 9410 StringBuffer buffer = new StringBuffer();
9411 try { 9411 try {
9412 _appendStringValue(buffer); 9412 _appendStringValue(buffer);
9413 } on IllegalArgumentException { 9413 } on ArgumentError {
9414 return null; 9414 return null;
9415 } 9415 }
9416 return buffer.toString(); 9416 return buffer.toString();
9417 } 9417 }
9418 9418
9419 /** 9419 /**
9420 * Append the value of this string literal to the given [buffer]. Throw an 9420 * Append the value of this string literal to the given [buffer]. Throw an
9421 * [IllegalArgumentException] if the string is not a constant string without 9421 * [ArgumentError] if the string is not a constant string without any
9422 * any string interpolation. 9422 * string interpolation.
9423 */ 9423 */
9424 void _appendStringValue(StringBuffer buffer); 9424 void _appendStringValue(StringBuffer buffer);
9425 } 9425 }
9426 9426
9427 /** 9427 /**
9428 * The invocation of a superclass' constructor from within a constructor's 9428 * The invocation of a superclass' constructor from within a constructor's
9429 * initialization list. 9429 * initialization list.
9430 * 9430 *
9431 * superInvocation ::= 9431 * superInvocation ::=
9432 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] 9432 * 'super' ('.' [SimpleIdentifier])? [ArgumentList]
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
11043 11043
11044 @override 11044 @override
11045 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11045 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11046 visitor.visitYieldStatement(this); 11046 visitor.visitYieldStatement(this);
11047 11047
11048 @override 11048 @override
11049 void visitChildren(AstVisitor visitor) { 11049 void visitChildren(AstVisitor visitor) {
11050 _expression?.accept(visitor); 11050 _expression?.accept(visitor);
11051 } 11051 }
11052 } 11052 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698