at() -> items[]

This commit is contained in:
Luna 2020-07-23 16:46:46 -03:00
parent e0f0ae7f24
commit 56be677c7a
3 changed files with 7 additions and 7 deletions

View file

@ -258,7 +258,7 @@ pub const Analyzer = struct {
var func_sym = symbol.Function; var func_sym = symbol.Function;
for (call.arguments.items) |arg_expr, idx| { for (call.arguments.items) |arg_expr, idx| {
var param_type = func_sym.parameter_list.at(idx); var param_type = func_sym.parameter_list.items[idx];
var arg_type = try self.resolveExprType(ctx, &arg_expr); var arg_type = try self.resolveExprType(ctx, &arg_expr);
self.expectSymUnTypeEqual(arg_type, param_type) catch { self.expectSymUnTypeEqual(arg_type, param_type) catch {
@ -490,7 +490,7 @@ pub const Analyzer = struct {
// we intentionally insert the function so that: // we intentionally insert the function so that:
// - we can do return statement validation // - we can do return statement validation
// - we have parameter types fully analyzed // - we have parameter types fully analyzed
if (ret_type != null and parameters.len == decl.params.len) { if (ret_type != null and parameters.items.len == decl.params.items.len) {
try ctx.insertFn(decl, ret_type.?, parameters, scope); try ctx.insertFn(decl, ret_type.?, parameters, scope);
} else { } else {
if (ret_type != null) if (ret_type != null)

View file

@ -70,7 +70,7 @@ pub const Scope = struct {
} }
pub fn nextChild(self: *@This()) *Scope { pub fn nextChild(self: *@This()) *Scope {
var child = self.children.at(self.cur_child_idx); var child = self.children.items[self.cur_child_idx];
self.cur_child_idx += 1; self.cur_child_idx += 1;
return child; return child;
} }
@ -272,7 +272,7 @@ pub const CompilationContext = struct {
var type_map = UnderlyingTypeMap.init(self.allocator); var type_map = UnderlyingTypeMap.init(self.allocator);
for (struc.fields.items) |field, idx| { for (struc.fields.items) |field, idx| {
_ = try type_map.put(field.name.lexeme, field_types.at(idx)); _ = try type_map.put(field.name.lexeme, field_types.items[idx]);
} }
var symbol = try self.allocator.create(SymbolData); var symbol = try self.allocator.create(SymbolData);
@ -295,7 +295,7 @@ pub const CompilationContext = struct {
param_sym.* = Parameter{ param_sym.* = Parameter{
.name = param.name.lexeme, .name = param.name.lexeme,
.idx = idx, .idx = idx,
.typ = param_types.at(idx), .typ = param_types.items[idx],
}; };
_ = try param_map.put(param.name.lexeme, param_sym); _ = try param_map.put(param.name.lexeme, param_sym);
} }

View file

@ -138,11 +138,11 @@ pub const Parser = struct {
} }
fn peek(self: *Parser) Token { fn peek(self: *Parser) Token {
return self.tokens.at(self.tokens.len - 1); return self.tokens.items[self.tokens.items.len - 1];
} }
fn previous(self: *Parser) Token { fn previous(self: *Parser) Token {
return self.tokens.at(self.tokens.len - 2); return self.tokens.items[self.tokens.items.len - 2];
} }
fn tokenError(self: *Parser, token: Token, msg: []const u8) ParseError { fn tokenError(self: *Parser, token: Token, msg: []const u8) ParseError {