platform/lib/src/language/ast/variable_definitions.dart

29 lines
710 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import '../token.dart';
import 'node.dart';
import 'package:source_span/src/span.dart';
import 'variable_definition.dart';
class VariableDefinitionsContext extends Node {
final Token LPAREN, RPAREN;
final List<VariableDefinitionContext> variableDefinitions = [];
VariableDefinitionsContext(this.LPAREN, this.RPAREN);
@override
SourceSpan get span =>
new SourceSpan(LPAREN.span?.end, RPAREN.span?.end, toSource());
@override
String toSource() {
var buf = new StringBuffer('[');
for (int i = 0; i < variableDefinitions.length; i++) {
if (i > 0) buf.write(',');
buf.write(variableDefinitions[i].toSource());
}
buf.write(']');
return buf.toString();
}
}