Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Conversation

@matanlurey
Copy link
Contributor

Also ran dartfmt and organized members by name in classes so the diff is much larger than it actually is (sorry about that). Added more tests for when a Scope is used.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you if you want to use Dart keywords as identifiers. I'd be worried that one day it might become illegal as the language evolves. Also, it throws off syntax highlighters.

My suggestion is to be one standard prefix for all booleans that control the existence of a keyword. For example "as":

new FunctionBuilder(
  asAbstract: true,
  asStatic: false,
)

@visibleForTesting
String dartfmt(String source) => _dartfmt.format(source);

// Creates a defensive copy of an AST node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cloning only useful for defensive purposes? If not, I'd drop "defensive". Also, if the cloning is deep, I'd note that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defensive --> deep.

Done.

return new SimpleIdentifier(new StringToken(TokenType.STRING, s, 0));
}

Literal _stringLit(String s) {
Copy link
Contributor

@yjbanov yjbanov Sep 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dart style police calls: avoid abbreviations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

// Simplifies some of the builders by having a mutable node we clone from.
@Deprecated('Builders are all becoming lazy')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth deprecating an internal class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's helping me (in the analyzer) show what work I have left to do

}) =>
new ClassBuilder._(
name,
abstract,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While legal Dart code I'm not a fan of Dart keywords used as identifiers, especially in the public API (this named parameter is visible to user code)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Split off to ClassBuilder.asAbstract(...)


/// Returns wrapped as a [FunctionExpression] AST.
FunctionExpression toFunctionExpression() => _asFunctionExpression(this);
FunctionExpression toFunctionExpression([Scope scope = const Scope.identity()]) => _asFunctionExpression(this, scope);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a looooong line. Did you dartfmt this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

this._name, {
TypeBuilder type,
ExpressionBuilder initialize,
bool static: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another Dart keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--> asStatic. Thanks!

@matanlurey matanlurey merged commit 8dc8d48 into dart-archive:master Sep 16, 2016
@matanlurey matanlurey deleted the full_scope branch September 16, 2016 17:51
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
* Add full scoping support for Library

* Address comments.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants