Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/order-utils: Add comments to regex parsing code in `revert_erro…
Browse files Browse the repository at this point in the history
…r.ts`.
  • Loading branch information
dorothy-zbornak committed Aug 20, 2019
1 parent 89db13a commit 2e51fac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/utils/src/revert_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ function declarationToAbi(declaration: string): RevertErrorAbi {
const [name, args] = m.slice(1);
const argList: string[] = _.filter(args.split(','));
const argData: DataItem[] = _.map(argList, (a: string) => {
// Match a function parameter in the format 'TYPE ID', where 'TYPE' may be
// an array type.
m = /^\s*(([_a-z][a-z0-9_]*)(\[\d*\])*)\s+([_a-z][a-z0-9_]*)\s*$/i.exec(a);
if (!m) {
throw new Error(`Invalid Revert Error signature: "${declaration}"`);
Expand All @@ -414,7 +416,7 @@ function checkArgEquality(type: string, lhs: ArgTypes, rhs: ArgTypes): boolean {
return normalizeBytes(lhs as string) === normalizeBytes(rhs as string);
} else if (type === 'string') {
return lhs === rhs;
} else if (/\[\d*\]$/.test(type)) {
} else if (/\[\d*\]$/.test(type)) { // An array type.
// tslint:disable: custom-no-magic-numbers
// Arguments must be arrays and have the same dimensions.
if ((lhs as any[]).length !== (rhs as any[]).length) {
Expand Down

0 comments on commit 2e51fac

Please sign in to comment.